示例#1
0
文件: DbTest.php 项目: Konafets/oelib
 /**
  * @test
  */
 public function tableHasColumnUidCanReturnDifferentResultsForDifferentTables()
 {
     self::assertNotSame(Tx_Oelib_Db::tableHasColumnUid('tx_oelib_test'), Tx_Oelib_Db::tableHasColumnUid('tx_oelib_test_article_mm'));
 }
示例#2
0
 /**
  * Resets the auto increment value for a given table to the highest existing
  * UID + 1 if the current auto increment value is higher than a certain
  * threshold over the current maximum UID.
  *
  * The threshold is 100 by default and can be set using
  * setResetAutoIncrementThreshold.
  *
  * @param string $table the name of the table on which we're going to reset the auto increment entry, must not be empty
  *
  * @return void
  *
  * @see resetAutoIncrement
  */
 public function resetAutoIncrementLazily($table)
 {
     if (!$this->isTableNameAllowed($table)) {
         throw new InvalidArgumentException('The given table name is invalid. This means it is either empty or not in the list of allowed tables.', 1331490899);
     }
     // Checks whether the current table qualifies for this method. If there
     // is no column "uid" that has the "auto_increment" flag set, we should
     // not try to reset this inexistent auto increment index to avoid
     // database errors.
     if (!Tx_Oelib_Db::tableHasColumnUid($table)) {
         return;
     }
     if ($this->getAutoIncrement($table) > $this->getMaximumUidFromTable($table) + $this->resetAutoIncrementThreshold) {
         $this->resetAutoIncrement($table);
     }
 }