當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BasePeer::doDeleteAll方法代碼示例

本文整理匯總了PHP中BasePeer::doDeleteAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP BasePeer::doDeleteAll方法的具體用法?PHP BasePeer::doDeleteAll怎麽用?PHP BasePeer::doDeleteAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BasePeer的用法示例。


在下文中一共展示了BasePeer::doDeleteAll方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDoDeleteAll

 public function testDoDeleteAll()
 {
     try {
         BasePeer::doDeleteAll('BAD TABLE', Propel::getConnection());
     } catch (PropelException $e) {
         $this->assertContains('[DELETE FROM `BAD` `TABLE`]', $e->getMessage(), 'SQL query is written in the exception message');
     }
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:8,代碼來源:BasePeerExceptionsTest.php

示例2: doDeleteAll

 public static function doDeleteAll($con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $affectedRows = 0;
     try {
         $con->begin();
         $affectedRows += BasePeer::doDeleteAll(LorfieldsPeer::TABLE_NAME, $con);
         $con->commit();
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }
開發者ID:Ayaan123,項目名稱:alumnisangam,代碼行數:16,代碼來源:BaseLorfieldsPeer.php

示例3: doDeleteAll

 /**
  * Method to DELETE all rows from the exam_comment_dig table.
  *
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 public static function doDeleteAll($con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(ExamCommentDigPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     try {
         // use transaction because $criteria could contain info
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
         $con->beginTransaction();
         $affectedRows += BasePeer::doDeleteAll(ExamCommentDigPeer::TABLE_NAME, $con);
         $con->commit();
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
開發者ID:rafd,項目名稱:SkuleCourses,代碼行數:24,代碼來源:BaseExamCommentDigPeer.php

示例4: doDeleteAll

 /**
  * Method to DELETE all rows from the metadata_profile table.
  *
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 public static function doDeleteAll($con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(MetadataProfilePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     try {
         // use transaction because $criteria could contain info
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
         $con->beginTransaction();
         $affectedRows += BasePeer::doDeleteAll(MetadataProfilePeer::TABLE_NAME, $con);
         // Because this db requires some delete cascade/set null emulation, we have to
         // clear the cached instance *after* the emulation has happened (since
         // instances get re-added by the select statement contained therein).
         MetadataProfilePeer::clearInstancePool();
         MetadataProfilePeer::clearRelatedInstancePool();
         $con->commit();
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
開發者ID:DBezemer,項目名稱:server,代碼行數:29,代碼來源:BaseMetadataProfilePeer.php

示例5: doDeleteAll

 public static function doDeleteAll($con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(TipodocentePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $affectedRows = 0;
     try {
         $con->beginTransaction();
         $affectedRows += BasePeer::doDeleteAll(TipodocentePeer::TABLE_NAME, $con);
         $con->commit();
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
開發者ID:mediasadc,項目名稱:alba,代碼行數:16,代碼來源:BaseTipodocentePeer.php

示例6: doDeleteAll

 public static function doDeleteAll($con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $affectedRows = 0;
     try {
         $con->begin();
         $affectedRows += VClassGroupPeer::doOnDeleteCascade(new Criteria(), $con);
         $affectedRows += BasePeer::doDeleteAll(VClassGroupPeer::TABLE_NAME, $con);
         $con->commit();
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }
開發者ID:taryono,項目名稱:school,代碼行數:17,代碼來源:BaseVClassGroupPeer.php

示例7: restoreFromFile

 /**
  * Restore database from file.
  * 
  * @todo Fix $maxExecutionTime.
  *
  * @param string|resource $file
  * @param array|null $tables
  * @param float $maxExecutionTime
  * @param int $continueLine
  * @param AbstractLegacyBackend|null $backend
  * @return bool	True on success, false otherwise.
  */
 public static function restoreFromFile($file, $tables = null, $maxExecutionTime = 0, $continueLine = 0, AbstractLegacyBackend $backend = null)
 {
     global $CURRY_DATABASE_RESTORE;
     $CURRY_DATABASE_RESTORE = true;
     $fp = is_string($file) ? fopen($file, "r") : $file;
     $t = microtime(true);
     $total = 0;
     $skipped = 0;
     $failed = 0;
     $session = new \Zend\Session\Container(__CLASS__);
     $con = Propel::getConnection();
     $con->beginTransaction();
     $adapter = Propel::getDB();
     if ($adapter instanceof DBMySQL) {
         $con->exec("SET foreign_key_checks = 0");
     }
     // Read header
     $firstline = stream_get_line($fp, self::MAX_LINE_LENGTH, "\n");
     $header = json_decode($firstline, true);
     if (is_array($header) && isset($header['header'])) {
         $header = $header['header'];
         // Check header version
         $version = isset($header['version']) ? (int) $header['version'] : 0;
         if ($version > self::VERSION) {
             throw new Exception('Unsupported database version. The file you are trying to restore from is from a newer version of currycms.');
         }
         // Check page version
         $pageVersion = isset($header['page-version']) ? (int) $header['page-version'] : 0;
         if ($pageVersion > Page::VERSION) {
             throw new Exception('Unsupported page version. The file you are trying to restore from is from a newer version of currycms.');
         }
         if ($backend) {
             $backend->addMessage("Restoring from " . $header['date']);
         }
         if ($pageVersion !== Page::VERSION) {
             if ($backend) {
                 $backend->addMessage("Migrating data from version {$pageVersion} to " . Page::VERSION, AbstractBackend::MSG_WARNING);
             }
             Page::preMigrate($pageVersion);
         }
     } else {
         throw new Exception('Invalid header');
     }
     // Empty tables
     if ($continueLine == 0) {
         foreach (Propel::getModels() as $classes) {
             foreach ($classes as $table) {
                 try {
                     if (is_array($tables) && !in_array($table, $tables)) {
                         continue;
                     }
                     if (!method_exists($table, 'delete')) {
                         if ($backend) {
                             $backend->addMessage("Skipping read-only table: {$table}", AbstractBackend::MSG_WARNING);
                         }
                         continue;
                     }
                     $tableName = PropelQuery::from($table)->getTableMap()->getName();
                     // use basePeer to avoid foreign key emulation in Normal peer class
                     BasePeer::doDeleteAll($tableName, $con);
                 } catch (Exception $e) {
                     throw new Exception('Unable to empty table ' . $table . ': ' . $e->getMessage());
                 }
             }
         }
         if ($backend) {
             $backend->addMessage("Cleared tables in " . round(microtime(true) - $t, 2) . "s");
         }
         $t = microtime(true);
     } else {
         $total = $session->total;
         $skipped = $session->skipped;
         $failed = $session->failed;
         if ($backend) {
             $backend->addMessage("Continuing from line {$continueLine}.");
         }
         for ($i = 0; $i < $continueLine; ++$i) {
             stream_get_line($fp, self::MAX_LINE_LENGTH, "\n");
         }
     }
     $currentTable = null;
     $buffer = array();
     while (!feof($fp)) {
         // Read line
         $data = json_decode(stream_get_line($fp, self::MAX_LINE_LENGTH, "\n"), true);
         ++$total;
         if (is_array($data) && isset($data['table'])) {
             if (is_array($tables) && !in_array($data['table'], $tables) || !method_exists($data['table'], 'delete')) {
//.........這裏部分代碼省略.........
開發者ID:bombayworks,項目名稱:currycms,代碼行數:101,代碼來源:DatabaseHelper.php

示例8: doDeleteAll

 /**
  * Method to DELETE all rows from the post table.
  *
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 public static function doDeleteAll($con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     try {
         // use transaction because $criteria could contain info
         // for more than one table or we could emulating ON DELETE CASCADE, etc.
         $con->begin();
         $affectedRows += PostPeer::doOnDeleteCascade(new Criteria(), $con);
         $affectedRows += BasePeer::doDeleteAll(PostPeer::TABLE_NAME, $con);
         $con->commit();
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
 }
開發者ID:noose,項目名稱:Planeta,代碼行數:25,代碼來源:BasePostPeer.php


注:本文中的BasePeer::doDeleteAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。