BUG 9321 executeQuery() does not return the number of records affected..SLOVED

- ExecuteQuery() is supposed to return the number of records affected by DELETE, UPDATE and INSERT commands.
- Adjustment in the number of records for different Engines.
This commit is contained in:
Hector Cortez
2012-10-12 16:57:47 -04:00
parent 6fe1458bd2
commit d9d3eed6ff
3 changed files with 8 additions and 5 deletions

View File

@@ -192,7 +192,8 @@ class MSSQLConnection extends ConnectionCommon implements Connection {
throw new SQLException('Could not execute update', mssql_get_last_message(), $sql); throw new SQLException('Could not execute update', mssql_get_last_message(), $sql);
} }
return $this->getUpdateCount(); return (int) mssql_rows_affected($this->dblink);
// return $this->getUpdateCount();
} }
/** /**

View File

@@ -250,19 +250,20 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
break; break;
case preg_match( "/^INSERT\s/i", $statement ): case preg_match( "/^INSERT\s/i", $statement ):
$rs = $con->executeUpdate( $SqlStatement ); $rs = $con->executeUpdate( $SqlStatement );
$result = $con->getUpdateCount();
$con->commit(); $con->commit();
//$result = $lastId->getId(); //$result = $lastId->getId();
$result = 1; // $result = 1;
break; break;
case preg_match( "/^UPDATE\s/i", $statement ): case preg_match( "/^UPDATE\s/i", $statement ):
$rs = $con->executeUpdate( $SqlStatement ); $rs = $con->executeUpdate( $SqlStatement );
$con->commit();
$result = $con->getUpdateCount(); $result = $con->getUpdateCount();
$con->commit();
break; break;
case preg_match( "/^DELETE\s/i", $statement ): case preg_match( "/^DELETE\s/i", $statement ):
$rs = $con->executeUpdate( $SqlStatement ); $rs = $con->executeUpdate( $SqlStatement );
$con->commit();
$result = $con->getUpdateCount(); $result = $con->getUpdateCount();
$con->commit();
break; break;
} }
} else { } else {

View File

@@ -679,6 +679,7 @@ function executeQueryOci ($sql, $connection, $aParameter = array())
} }
} }
$objExecute = oci_execute( $stid, OCI_DEFAULT ); $objExecute = oci_execute( $stid, OCI_DEFAULT );
$result = oci_num_rows ($stid);
if ($objExecute) { if ($objExecute) {
oci_commit( $conn ); oci_commit( $conn );
} else { } else {
@@ -688,7 +689,7 @@ function executeQueryOci ($sql, $connection, $aParameter = array())
oci_free_statement( $stid ); oci_free_statement( $stid );
oci_close( $conn ); oci_close( $conn );
if ($isValid) { if ($isValid) {
return true; return $result;
} else { } else {
return oci_error(); return oci_error();
} }