コード例 #1
0
 /**
  * Executes an array of database queries.
  *
  * @global \TYPO3\CMS\Core\Database\DatabaseConnection $TYPO3_DB
  * @param array $queries
  *            An array of SQL queries.
  * @return \Ecodev\Newsletter\Update\TransactionResult
  */
 private static function transactDBQueries(array $queries)
 {
     $results = new TransactionResult(count($queries));
     if (!empty($queries)) {
         global $TYPO3_DB;
         foreach ($queries as $query) {
             $res = $TYPO3_DB->sql_query($query);
             $results->appendAffectedDataCount($TYPO3_DB->sql_affected_rows($res));
             $error = $TYPO3_DB->sql_error();
             if ($error) {
                 $results->setErrorMessage($error);
                 break;
             }
             $results->stepProcessed();
         }
         $TYPO3_DB->sql_free_result($res);
     }
     return $results;
 }