public function resetAutoIncrement($tableName)
    {
        if (!$this->isTableNameAllowed($tableName)) {
            throw new \InvalidArgumentException(
                'The given table name is invalid. This means it is either empty or not in the list of allowed tables.',
                1334439521
            );
        }

        // 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 DB
        // errors.
        if (!Tx_Phpunit_Service_Database::tableHasColumnUid($tableName)) {
            return;
        }

        $newAutoIncrementValue = $this->getMaximumUidFromTable($tableName) + 1;

        \Tx_Phpunit_Service_Database::enableQueryLogging();
        // Updates the auto increment index for this table. The index will be
        // set to one UID above the highest existing UID.
        $dbResult = \Tx_Phpunit_Service_Database::getDatabaseConnection()->sql_query(
            'ALTER TABLE ' . $tableName . ' AUTO_INCREMENT=' . $newAutoIncrementValue . ';'
        );
        if ($dbResult === false) {
            throw new \Tx_Phpunit_Exception_Database(1334439540);
        }
    }
public function resetAutoIncrement($tableName)
    {
        if (!$this->isTableNameAllowed($tableName)) {
            throw new \InvalidArgumentException(
                'The given table name is invalid. This means it is either empty or not in the list of allowed tables.',
                1334439521
            );
        }

        // 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 DB
        // errors.
        if (!Tx_Phpunit_Service_Database::tableHasColumnUid($tableName)) {
            return;
        }

        $newAutoIncrementValue = $this->getMaximumUidFromTable($tableName) + 1;

        \Tx_Phpunit_Service_Database::enableQueryLogging();
        // Updates the auto increment index for this table. The index will be
        // set to one UID above the highest existing UID.
        $dbResult = \Tx_Phpunit_Service_Database::getDatabaseConnection()->sql_query(
            'ALTER TABLE ' . $tableName . ' AUTO_INCREMENT=' . $newAutoIncrementValue . ';'
        );
        if ($dbResult === false) {
            throw new \Tx_Phpunit_Exception_Database(1334439540);
        }
    }
public function resetAutoIncrement ( $ tableName ) { if ( ! $ this -> isTableNameAllowed ( $ tableName ) ) { throw new \ InvalidArgumentException ( 'The given table name is invalid. This means it is either empty or not in the list of allowed tables.' , 1334439521 ) ; } // 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 DB // errors. if ( ! Tx_Phpunit_Service_Database :: tableHasColumnUid ( $ tableName ) ) { return ; } $ newAutoIncrementValue = $ this -> getMaximumUidFromTable ( $ tableName ) + 1 ; \ Tx_Phpunit_Service_Database :: enableQueryLogging ( ) ; // Updates the auto increment index for this table. The index will be // set to one UID above the highest existing UID. $ dbResult = \ Tx_Phpunit_Service_Database :: getDatabaseConnection ( ) -> sql_query ( 'ALTER TABLE ' . $ tableName . ' AUTO_INCREMENT=' . $ newAutoIncrementValue . ';' ) ; if ( $ dbResult === false ) { throw new \ Tx_Phpunit_Exception_Database ( 1334439540 ) ; } }
Eagerly resets the auto increment value for a given table to the highest
existing UID + 1.

@param string $tableName
the name of the table on which we're going to reset the auto
increment entry, must not be empty

@see resetAutoIncrementLazily

@return void

@throws \InvalidArgumentException
@throws \Tx_Phpunit_Exception_Database
Eagerly resets the auto increment value for a given table to the highest existing UID + 1 .