cleaner code
This commit is contained in:
parent
b9a2c093e4
commit
816856cbc0
|
@ -2048,10 +2048,10 @@ namespace core {
|
|||
// instead of throwing an exception, return 0 if the r=-1, stament has been executed, and has a HY010 error
|
||||
// (HY010 error should not return if stmt->execute is true)
|
||||
#ifndef _WIN32
|
||||
sqlsrv_error_auto_ptr error;
|
||||
if ( stmt->current_results != NULL ) {
|
||||
if ( r == -1 && stmt->executed && stmt->current_results != NULL ) {
|
||||
sqlsrv_error_auto_ptr error;
|
||||
error = stmt->current_results->get_diag_rec( 1 );
|
||||
if ( r == -1 && stmt->executed && strcmp( reinterpret_cast<const char*>( error->sqlstate ), "HY010" ) == 0 )
|
||||
if ( strcmp( reinterpret_cast<const char*>( error->sqlstate ), "HY010" ) == 0 )
|
||||
return 0;
|
||||
}
|
||||
#endif // !_WIN32
|
||||
|
|
|
@ -26,18 +26,18 @@ $Statement = $conn->exec("INSERT INTO foo_table (intField) VALUES(3)");
|
|||
//test prepare, not args
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
if ($conn->errorCode() == 00000)
|
||||
if ($conn->errorCode() == "00000")
|
||||
echo "prepare OK\n";
|
||||
|
||||
//test prepare, with args
|
||||
$stmt = $conn->prepare($sqlWithParameter);
|
||||
$stmt->execute(array(':id' => $sqlParameter));
|
||||
if ($conn->errorCode() == 00000)
|
||||
if ($conn->errorCode() == "00000")
|
||||
echo "prepare with args OK\n";
|
||||
|
||||
//test direct exec
|
||||
$stmt = $conn->exec($sql);
|
||||
if ($conn->errorCode() == 00000)
|
||||
if ($conn->errorCode() == "00000")
|
||||
echo "direct exec OK\n";
|
||||
|
||||
$Statement = $conn->exec("IF OBJECT_ID('foo_table', 'U') IS NOT NULL DROP TABLE foo_table");
|
||||
|
|
Loading…
Reference in a new issue