Ejemplo n.º 1
0
 public static function executeStatementTestForCollision($dbh, $stmt, $value_list)
 {
     // execute the SQL statement through PDO
     $pdo_stmt = $dbh->prepare($stmt);
     $rows_affected = SDO_DAS_Relational_DatabaseHelper::executeStatementTestForError($dbh, $pdo_stmt, $value_list, $stmt);
     // Test if the SQL execute resulted in any change rows
     if ($rows_affected == 0) {
         $msg = "\nSDO/DAS/Relational.php::applyChanges resulted in no rows being affect when executing {$stmt}";
         $msg .= "\nThis may happen if the data that was retrieved and updated has been changed by another processs in the database in the meantime.";
         $dbh->rollback();
         $msg .= "\nAll changes have been rolled back.";
         throw new SDO_DAS_Relational_Exception($msg);
     }
 }
Ejemplo n.º 2
0
 /**
  * Given an SQL query in the form of a prepared PDO statement and a value list, execute it,
  * normalise the result set into a data graph and return it.
  */
 public function executePreparedQuery($dbh, $pdo_stmt, $value_list, $column_specifier = null)
 {
     $this->ensureValueListIsNullOrAnArray($value_list);
     $this->ensureColumnSpecifierIsNullOrAnArrayContainingOnlyValidTableAndColumnNames($column_specifier);
     $dbh->beginTransaction();
     $rows_affected = SDO_DAS_Relational_DatabaseHelper::executeStatementTestForError($dbh, $pdo_stmt, $value_list, null);
     $root = $this->normaliseResultSet($pdo_stmt, $column_specifier);
     $dbh->commit();
     return $root;
 }