Ejemplo n.º 1
0
 /**
  * Executes all sub-transactions
  * @param none
  * @access protected
  */
 function prepareSQL()
 {
     tNG_log::log('tNG_multipleDelete', 'prepareSQL', 'begin');
     $failed = false;
     $ret = null;
     for ($i = 1; true; $i++) {
         $tmp = KT_getRealValue("POST", $this->pkName . "_" . $i);
         if (!isset($tmp)) {
             break;
         }
         $this->multTNGs[$i - 1] = new tNG_delete($this->connection);
         $this->multTNGs[$i - 1]->setDispatcher($this->dispatcher);
         $this->multTNGs[$i - 1]->multipleIdx = $i;
         // register triggers
         $this->multTNGs[$i - 1]->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "VALUE", true);
         for ($j = 0; $j < sizeof($this->multTriggers); $j++) {
             call_user_func_array(array(&$this->multTNGs[$i - 1], "registerConditionalTrigger"), $this->multTriggers[$j]);
         }
         // add columns
         $this->multTNGs[$i - 1]->setTable($this->table);
         foreach ($this->columns as $colName => $colDetails) {
             $this->multTNGs[$i - 1]->addColumn($colName, $colDetails['type'], $colDetails['method'], $colDetails['reference'] . "_" . $i);
         }
         $this->multTNGs[$i - 1]->setPrimaryKey($this->primaryKey, $this->primaryKeyColumn['type'], "POST", $this->pkName . "_" . $i);
         $this->multTNGs[$i - 1]->executeTransaction();
         if ($this->multTNGs[$i - 1]->getError()) {
             $failed = true;
         }
     }
     if ($failed) {
         $ret = new tNG_error('MDEL_ERROR', array(), array());
     }
     tNG_log::log('tNG_multipleDelete', 'prepareSQL', 'end');
     return $ret;
 }
Ejemplo n.º 2
0
 /**
  * Get the local recordset associated to this transaction
  * @return object resource Recordset resource
  * @access protected
  */
 function getLocalRecordset()
 {
     tNG_log::log('tNG_custom', 'getLocalRecordset');
     $fakeArr = array();
     $tmpArr = $this->columns;
     foreach ($tmpArr as $colName => $colDetails) {
         $tmpVal = KT_escapeForSql($colDetails['default'], $colDetails['type'], true);
         $fakeArr[$colName] = $tmpVal;
     }
     return $this->getFakeRecordset($fakeArr);
 }
Ejemplo n.º 3
0
 /**
  * Prepares the delete SQL query to be executed
  * @access protected
  */
 function prepareSQL()
 {
     tNG_log::log('tNG_delete', 'prepareSQL', 'begin');
     parent::prepareSQL();
     // check if we have a valid primaryKey
     if (!$this->primaryKey) {
         $ret = new tNG_error('DEL_NO_PK_SET', array(), array());
     }
     // check the primary key value
     if (!isset($this->primaryKeyColumn['value'])) {
         $ret = new tNG_error('DEL_NO_PK_VAL', array(), array());
     }
     $ret = null;
     $sql = 'DELETE FROM ' . $this->table . ' WHERE ' . KT_escapeFieldName($this->primaryKey) . ' = ';
     $sql .= KT_escapeForSql($this->primaryKeyColumn['value'], $this->primaryKeyColumn['type']);
     $this->setSQL($sql);
     tNG_log::log('tNG_delete', 'prepareSQL', 'end');
     return $ret;
 }
Ejemplo n.º 4
0
 /**
  * Retrieve and store the saved values from database;
  * @return string 
  * @access public
  */
 function saveData()
 {
     tNG_log::log('tNG' . $this->transactionType, "saveData");
     $keyName = $this->getPrimaryKey();
     $keyValue = $this->getPrimaryKeyValue();
     $keyType = $this->getColumnType($keyName);
     $escapedKeyValue = KT_escapeForSql($keyValue, $keyType);
     $sql = 'SELECT * FROM ' . $this->getTable() . ' WHERE ' . KT_escapeFieldName($keyName) . ' = ' . $escapedKeyValue;
     $rs = $this->connection->Execute($sql);
     if ($rs === false) {
         return new tNG_error('FIELDS_SAVEDATA_ERROR', array(), array($sql, $this->connection->ErrorMsg()));
     }
     $this->savedData = $rs->fields;
     return null;
 }
Ejemplo n.º 5
0
 /**
  * executing the transaction (triggers, prepare SQL)
  * @access protected
  */
 function doTransaction()
 {
     tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'begin');
     $tmp = $this->getError();
     if (is_object($tmp)) {
         $this->setError($tmp);
         $this->executeTriggers("ERROR");
         tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'end');
         return false;
     }
     //calling the before triggers and terminate execution if we had an error
     $ret = $this->executeTriggers("BEFORE");
     if (is_object($ret)) {
         $this->setError($ret);
         $this->executeTriggers("ERROR");
         tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'end');
         return false;
     }
     //process the SQL for eventual auto-generation
     $ret = $this->prepareSQL();
     if (is_object($ret)) {
         tNG_log::log('KT_ERROR');
         $this->setError($ret);
         $this->executeTriggers("ERROR");
         tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'end');
         return false;
     }
     $ret = $this->getError();
     if (is_object($ret)) {
         $this->executeTriggers("ERROR");
         tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'end');
         return false;
     }
     //executing the transaction
     if ($this->sql != '') {
         tNG_log::log('tNG' . $this->transactionType, 'executeTransaction', 'execute sql');
         if (!is_array($this->sql)) {
             $this->transactionResult = $this->connection->Execute($this->sql);
         } else {
             for ($i = 0; $i < sizeof($this->sql); $i++) {
                 $this->transactionResult = $this->connection->Execute($this->sql[$i], $this->connection);
                 if ($this->transactionResult === false) {
                     break;
                 }
             }
         }
         //check if the transaction has been done OK
         if (!$this->transactionResult) {
             $ret = $this->parseSQLError($this->sql, $this->connection->ErrorMsg());
             $this->setError($ret);
             tNG_log::log('KT_ERROR');
             $this->executeTriggers("ERROR");
             tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'end');
             return false;
         }
     }
     $ret = $this->postExecuteSql();
     if (is_object($ret)) {
         $this->setError($ret);
         $this->executeTriggers("ERROR");
         tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'end');
         return false;
     }
     //if the SQL is a SELECT statement
     if (is_object($this->transactionResult)) {
         if ($this->transactionResult->RecordCount() == 0) {
             $this->transactionResult = null;
         }
     }
     //calling the after triggers
     $ret = $this->executeTriggers("AFTER");
     if (is_object($ret)) {
         $this->setError($ret);
         $this->executeTriggers("ERROR");
         tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'end');
         return false;
     }
     $ret = $this->executeTriggers("END");
     if (is_object($ret)) {
         $this->setError($ret);
         $this->executeTriggers("ERROR");
         tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'end');
         return false;
     }
     tNG_log::log('tNG' . $this->transactionType, 'doTransaction', 'end');
     return true;
 }
Ejemplo n.º 6
0
 /**
  * This function is called once the transaction SQL was actually executed
  * And only if the execution was succesffully. On insert, it sets the primary key value if it is not set.
  * @access protected
  */
 function postExecuteSql()
 {
     tNG_log::log('tNG_insert', 'postExecuteSql');
     if (isset($this->columns[$this->primaryKey])) {
         $this->primaryKeyColumn['value'] = $this->getColumnValue($this->primaryKey);
     } else {
         $this->primaryKeyColumn['value'] = $this->connection->Insert_ID($this->table, $this->primaryKey);
     }
     return null;
 }
Ejemplo n.º 7
0
 /**
  * Executes all sub-transactions
  * @access protected
  */
 function prepareSQL()
 {
     tNG_log::log('tNG_import', 'prepareSQL', 'begin');
     $ret = $this->prepareData();
     if ($ret === null) {
         $this->noSuccess = 0;
         $this->noSkip = 0;
         $failed = false;
         $line = $this->lineStart;
         $tNGindex = 1;
         for ($k = 0; $k < count($this->data); $k++) {
             $dataarr = $this->data[$k];
             $skipped = false;
             $line++;
             /*
             if ( !is_array($dataarr) || count($dataarr) < 1 || (count($dataarr) == 1 && reset($dataarr) == '') ) {
             	// skip empty lines
             	continue;
             }
             */
             // exports the values line to be available for KT_getRealValue and KT_DynamicData
             unset($GLOBALS[$this->importReference]);
             $GLOBALS[$this->importReference] = $dataarr;
             unset($GLOBALS[$this->importReference . '_LINE']);
             $GLOBALS[$this->importReference . '_LINE'] = $line;
             $isInsert = true;
             $uniqueColName = $this->uniqueKey;
             if ($uniqueColName != '') {
                 $uniqueColDetails = $this->computeMultipleValues($this->columns[$uniqueColName], $tNGindex);
                 if ($uniqueColDetails['value'] != '') {
                     $sql = 'SELECT ' . KT_escapeFieldName($uniqueColName) . ' FROM ' . $this->getTable() . ' WHERE ' . KT_escapeFieldName($uniqueColName) . ' = ' . KT_escapeForSql($uniqueColDetails['value'], $uniqueColDetails['type']);
                     $rs = $this->connection->Execute($sql);
                     if ($rs === false) {
                         $failed = true;
                         $ret = new tNG_error('IMPORT_SQL_ERROR', array(), array($sql, $this->connection->ErrorMsg()));
                         tNG_log::log('KT_ERROR');
                         break;
                     }
                     if ($rs->recordCount() >= 1) {
                         // duplicates found
                         if ($this->handleDuplicates == "SKIP") {
                             // ignore case
                             $isInsert = false;
                             $this->noSkip++;
                             continue;
                         }
                         if ($this->handleDuplicates == "UPDATE") {
                             // update case
                             $isInsert = false;
                             $this->multTNGs[$tNGindex - 1] = new tNG_update($this->connection);
                         }
                         if ($this->handleDuplicates == "SKIPWITHERROR") {
                             // throw error case
                             $isInsert = false;
                             $skipped = true;
                             $this->noSkip++;
                             $this->multTNGs[$tNGindex - 1] = new tNG_insert($this->connection);
                             $this->multTNGs[$tNGindex - 1]->setError(new tNG_error($this->importType . '_IMPORT_DUPLICATE_ERROR', array($line, $uniqueColDetails['value'], $uniqueColName), array()));
                         }
                     }
                 }
             }
             if ($isInsert) {
                 $this->multTNGs[$tNGindex - 1] = new tNG_insert($this->connection);
             }
             $this->multTNGs[$tNGindex - 1]->setDispatcher($this->dispatcher);
             $this->multTNGs[$tNGindex - 1]->multipleIdx = $tNGindex;
             // register triggers
             for ($j = 0; $j < sizeof($this->multTriggers); $j++) {
                 call_user_func_array(array(&$this->multTNGs[$tNGindex - 1], "registerConditionalTrigger"), $this->multTriggers[$j]);
             }
             $this->multTNGs[$tNGindex - 1]->setTable($this->table);
             // add columns
             foreach ($this->columns as $colName => $colDetails) {
                 $colDetails = $this->computeMultipleValues($colDetails, $tNGindex);
                 $this->columns[$colName]['value'] = $colDetails['value'];
                 if ($this->multTNGs[$tNGindex - 1]->transactionType == '_update') {
                     if ($colName != $uniqueColName) {
                         $this->multTNGs[$tNGindex - 1]->addColumn($colName, $colDetails['type'], $colDetails['method'], $colDetails['reference']);
                     }
                 } else {
                     $this->multTNGs[$tNGindex - 1]->addColumn($colName, $colDetails['type'], $colDetails['method'], $colDetails['reference'], $colDetails['default']);
                 }
             }
             if ($this->multTNGs[$tNGindex - 1]->transactionType == '_update') {
                 $this->multTNGs[$tNGindex - 1]->setPrimaryKey($uniqueColName, $uniqueColDetails['type'], 'VALUE', $uniqueColDetails['value']);
             } else {
                 $this->multTNGs[$tNGindex - 1]->setPrimaryKey($this->primaryKey, $this->primaryKeyColumn['type']);
             }
             $this->multTNGs[$tNGindex - 1]->compileColumnsValues();
             if ($this->getError()) {
                 $this->multTNGs[$tNGindex - 1]->setError($this->getError());
             }
             $this->multTNGs[$tNGindex - 1]->setStarted(true);
             $this->multTNGs[$tNGindex - 1]->doTransaction();
             if (!$skipped) {
                 if ($this->multTNGs[$tNGindex - 1]->getError()) {
                     $err = $this->multTNGs[$tNGindex - 1]->getError();
                     $tmp_all_errmsg = '';
                     $tmp_unique_details = '';
                     if ($uniqueColName != '') {
                         if ($uniqueColDetails['value'] != '') {
                             $tmp_unique_details = ' (' . $uniqueColName . ' = ' . $uniqueColDetails['value'] . ')';
                         }
                     }
                     foreach ($err->fieldErrors as $tmp_col => $tmp_errmsg) {
                         $tmp_all_errmsg .= "\n<br />&nbsp;&nbsp;&nbsp;- " . $tmp_col . " : " . $tmp_errmsg;
                     }
                     if ($tmp_all_errmsg == '') {
                         $tmp_all_errmsg = $err->getDetails();
                     }
                     $lineErr = $line . $tmp_unique_details;
                     $newErr = new tNG_error($this->importType . '_IMPORT_LINE_ERROR', array($lineErr, $tmp_all_errmsg), array());
                     $this->multTNGs[$tNGindex - 1]->setError($newErr);
                     $failed = true;
                 } else {
                     $this->noSuccess++;
                     if ($this->getPrimaryKey() == $this->multTNGs[$tNGindex - 1]->getPrimaryKey()) {
                         $this->primaryKeyColumn['value'] = $this->multTNGs[$tNGindex - 1]->getPrimaryKeyValue();
                     }
                 }
             }
             $tNGindex++;
         }
         if (!$failed) {
             for ($i = 0; $i < sizeof($this->multTNGs); $i++) {
                 if ($this->multTNGs[$i]->getError()) {
                     $failed = true;
                     $ret = new tNG_error('IMPORT_SKIPPED', array(), array());
                     tNG_log::log('KT_ERROR');
                     break;
                 }
             }
         }
         if ($failed) {
             if ($ret === null) {
                 $ret = new tNG_error('IMPORT_ERROR', array(), array());
                 tNG_log::log('KT_ERROR');
             }
             if ($this->executeSubSets === false) {
                 for ($i = 0; $i < sizeof($this->multTNGs); $i++) {
                     if (!$this->multTNGs[$i]->getError()) {
                         $this->multTNGs[$i]->setError($ret);
                         $this->multTNGs[$i]->executeTriggers('ERROR');
                     }
                 }
             }
         }
         if ($this->executeSubSets === false) {
             $this->noSuccess = 0;
         }
     } else {
         tNG_log::log('KT_ERROR');
     }
     tNG_log::log('tNG_import', 'prepareSQL', 'end');
     return $ret;
 }
Ejemplo n.º 8
0
 /**
  * Get the recordset associated to this transaction
  * The fake recordset on error or the local recordset
  * @params none
  * @return object resource Recordset resource
  */
 function getRecordset()
 {
     tNG_log::log('tNG' . $this->transactionType, "getRecordset");
     if ($this->getError()) {
         $fakeArr = array();
         for ($i = 0; $i < sizeof($this->multTNGs); $i++) {
             if ($this->multTNGs[$i]->getError()) {
                 $fakeArr[$i] = $this->multTNGs[$i]->getFakeRsArr();
             } else {
                 for ($j = $i + 1; $j < sizeof($this->multTNGs); $j++) {
                     $this->multTNGs[$j - 1] =& $this->multTNGs[$j];
                 }
                 array_pop($this->multTNGs);
                 $i--;
             }
         }
         if (sizeof($fakeArr) > 0) {
             return $this->getFakeRecordset($fakeArr);
         }
     }
     return $this->getLocalRecordset();
 }
Ejemplo n.º 9
0
 /**
  * Get the local recordset associated to this transaction
  * @return object resource Recordset resource
  * @access public
  */
 function getLocalRecordset()
 {
     tNG_log::log('tNG_update', 'getLocalRecordset');
     $sql = '';
     $tmpArr = $this->columns;
     $tmpArr[$this->primaryKey]['type'] = $this->primaryKeyColumn['type'];
     $tmpArr[$this->primaryKey]['method'] = $this->primaryKeyColumn['method'];
     $tmpArr[$this->primaryKey]['reference'] = $this->primaryKeyColumn['reference'];
     foreach ($tmpArr as $colName => $colDetails) {
         if ($sql != '') {
             $sql .= ',';
         }
         $sql .= KT_escapeFieldName($colName);
     }
     $sql .= ', ' . KT_escapeFieldName($this->primaryKey) . ' as ' . KT_escapeFieldName($this->pkName);
     $sql = 'SELECT ' . $sql . ' FROM ' . $this->table;
     $sql = $sql . ' WHERE ' . KT_escapeFieldName($this->primaryKey) . ' =';
     $pkValue = KT_getRealValue($this->primaryKeyColumn['method'], $this->primaryKeyColumn['reference']);
     $sql = $sql . KT_escapeForSql($pkValue, $this->primaryKeyColumn['type']);
     if (isset($this->connection->servermodel)) {
         $rs = $this->connection->MySQL_Execute($sql);
     } else {
         $rs = $this->connection->Execute($sql);
     }
     if (!$rs) {
         tNG_log::log('KT_ERROR');
         $this->setError(new tNG_error('UPD_RS', array(), array($this->connection->ErrorMsg(), $sql)));
         echo $this->dispatcher->getErrorMsg();
         exit;
     }
     return $rs;
 }
Ejemplo n.º 10
0
 /**
  * Get the local recordset associated to this transaction
  * @return object resource Recordset resource
  * @access protected
  */
 function getLocalRecordset()
 {
     tNG_log::log('tNG_multipleUpdate', 'getLocalRecordset');
     $sql = '';
     $tmpArr = $this->columns;
     $tmpArr[$this->primaryKey]['type'] = $this->primaryKeyColumn['type'];
     $tmpArr[$this->primaryKey]['method'] = $this->primaryKeyColumn['method'];
     $tmpArr[$this->primaryKey]['reference'] = $this->primaryKeyColumn['reference'];
     foreach ($tmpArr as $colName => $colDetails) {
         if ($sql != '') {
             $sql .= ',';
         }
         $sql .= KT_escapeFieldName($colName);
     }
     $sql .= ', ' . KT_escapeFieldName($this->primaryKey) . ' as ' . KT_escapeFieldName($this->pkName);
     $sql = 'SELECT ' . $sql . ' FROM ' . $this->table;
     $tmp_colValue = KT_getRealValue($this->primaryKeyColumn['method'], $this->primaryKeyColumn['reference'] . "_1");
     $pkv = KT_getRealValue($this->primaryKeyColumn['method'], $this->primaryKeyColumn['reference']);
     if (isset($tmp_colValue)) {
         $sql = $sql . ' WHERE ' . KT_escapeFieldName($this->primaryKey) . ' IN (';
         $sql = $sql . KT_escapeForSql($pkv, $this->primaryKeyColumn['type']);
         $cnt = 1;
         while (true) {
             $tmp_colValue = KT_getRealValue($this->primaryKeyColumn['method'], $this->primaryKeyColumn['reference'] . "_" . $cnt++);
             if (isset($tmp_colValue)) {
                 $sql = $sql . ", " . KT_escapeForSql($tmp_colValue, $this->primaryKeyColumn['type']);
             } else {
                 break;
             }
         }
         $sql = $sql . ')';
     } else {
         $sql = $sql . ' WHERE ' . KT_escapeFieldName($this->primaryKey) . '=';
         $sql = $sql . KT_escapeForSql($pkv, $this->primaryKeyColumn['type']);
     }
     $rs = false;
     if (isset($_SESSION['KT_lastUsedList']) && isset($_SESSION['sorter_tso_' . $_SESSION['KT_lastUsedList']])) {
         $tmp_sql = $sql . ' ORDER BY ' . $_SESSION['sorter_tso_' . $_SESSION['KT_lastUsedList']];
         $table_columns = array();
         if (isset($this->connection->servermodel)) {
             $res = $this->connection->Execute('SELECT * FROM ' . $this->table . ' LIMIT 1');
             $table_columns = array_keys($res->fields);
         } else {
             $res = $this->connection->MetaColumns($this->table);
             foreach ($res as $field => $col) {
                 $table_columns[] = $col->name;
             }
         }
         $order_column = str_replace(' DESC', '', $_SESSION['sorter_tso_' . $_SESSION['KT_lastUsedList']]);
         $order_column = explode('.', $order_column);
         $order_column = $order_column[count($order_column) - 1];
         if (in_array($order_column, $table_columns)) {
             if (isset($this->connection->servermodel)) {
                 $rs = $this->connection->MySQL_Execute($tmp_sql);
             } else {
                 $rs = $this->connection->Execute($tmp_sql);
             }
         }
     }
     if (!$rs) {
         if (isset($this->connection->servermodel)) {
             $rs = $this->connection->MySQL_Execute($sql);
         } else {
             $rs = $this->connection->Execute($sql);
         }
     }
     if (!$rs) {
         tNG_log::log('KT_ERROR');
         $this->setError(new tNG_error('MUPD_RS', array(), array($this->connection->ErrorMsg(), $sql)));
         echo $this->dispatcher->getErrorMsg();
         exit;
     }
     return $rs;
 }
Ejemplo n.º 11
0
 /**
  * Executes all sub-transactions
  * @access protected
  */
 function prepareSQL()
 {
     tNG_log::log('tNG_multipleInsert', 'prepareSQL', 'begin');
     $ret = null;
     $this->noSuccess = 0;
     $failed = false;
     for ($i = 1; true; $i++) {
         $tmp = KT_getRealValue("POST", $this->pkName . "_" . $i);
         if (!isset($tmp)) {
             break;
         }
         $this->multTNGs[$i - 1] = new tNG_insert($this->connection);
         $this->multTNGs[$i - 1]->setDispatcher($this->dispatcher);
         $this->multTNGs[$i - 1]->multipleIdx = $i;
         // register triggers
         for ($j = 0; $j < sizeof($this->multTriggers); $j++) {
             call_user_func_array(array(&$this->multTNGs[$i - 1], "registerConditionalTrigger"), $this->multTriggers[$j]);
         }
         // add columns
         $this->multTNGs[$i - 1]->setTable($this->table);
         foreach ($this->columns as $colName => $colDetails) {
             if ($colDetails['method'] == 'VALUE') {
                 $reference = $colDetails['reference'];
                 $value = KT_getRealValue($colDetails['method'], $colDetails['reference']);
             } else {
                 $reference = $colDetails['reference'] . "_" . $i;
                 $value = KT_getRealValue($colDetails['method'], $colDetails['reference'] . "_" . $i);
                 if (!isset($value)) {
                     $reference = $colDetails['reference'];
                     $value = KT_getRealValue($colDetails['method'], $colDetails['reference']);
                 }
             }
             $this->columns[$colName]['value'] = $value;
             $this->multTNGs[$i - 1]->addColumn($colName, $colDetails['type'], $colDetails['method'], $reference, $colDetails['default']);
         }
         $this->multTNGs[$i - 1]->setPrimaryKey($this->primaryKey, $this->primaryKeyColumn['type']);
         $this->multTNGs[$i - 1]->compileColumnsValues();
         if ($this->getError()) {
             $this->multTNGs[$i - 1]->setError($this->getError());
         }
         $this->multTNGs[$i - 1]->setStarted(true);
         $this->multTNGs[$i - 1]->doTransaction();
         if ($this->multTNGs[$i - 1]->getError()) {
             $sw = $this->multTNGs[$i - 1]->wereValuesSubmitted();
             if ($sw) {
                 $failed = true;
             } else {
                 if ($i != 1) {
                     // if there was an unival error on one of the 2nd-to-last inserts, ignore it.
                     $this->multTNGs[$i - 1]->setError(null);
                 }
             }
         } else {
             $this->noSuccess++;
             $this->primaryKeyColumn['value'] = $this->multTNGs[$i - 1]->getPrimaryKeyValue();
         }
     }
     if ($this->noSuccess == 0) {
         $failed = true;
     }
     if ($failed) {
         $ret = new tNG_error('MINS_ERROR', array(), array());
         if ($this->executeSubSets === false) {
             for ($i = 0; $i < sizeof($this->multTNGs); $i++) {
                 if (!$this->multTNGs[$i]->getError()) {
                     $this->multTNGs[$i]->setError($ret);
                     $this->multTNGs[$i]->executeTriggers('ERROR');
                 }
             }
         }
     }
     if ($this->executeSubSets === false) {
         $this->noSuccess = 0;
     }
     tNG_log::log('tNG_multipleInsert', 'prepareSQL', 'end');
     return $ret;
 }