From:
Operating system: Linux
PHP version: 5.2.13
Package: ODBC related
Bug Type: Bug
Bug description:odbc_execute doesn't return proper result
Description:
------------
Result status for odbc_execute() is not correctly returned for CREATE TABLE
statements. Tested with MySQL and PostgreSQL ODBC drivers. Execution of
odbc_execute() for SELECT/UPDATE/INSERT statements doesn't have that
effect.
Testing CREATE TABLE with isql utility from unixODBC correctly returns an
error on second execution (assuming that table didn't exist before).
Test script:
---------------
$stmt = odbc_prepare($db, "CREATE TABLE x(id int)");
if ($stmt === false) {
$error = true;
$resultStr = "Query: $query\nPrepare Error: " .
odbc_errormsg($db);
echo $resultStr . "\n";
} else {
// Executing query (if prepare went fine)
$result = odbc_execute($stmt, $parameterArray);
echo $resultStr . "\n";
}
if (!$result) {
echo "ODBC Error: " . odbc_error($db) . "\n";
$resultStr = "Query: $query\nExecute error: " .
odbc_errormsg($db);
echo $resultStr . "\n";
$error = true;
}
Expected result:
----------------
Execution of the test script should create table "x" during the first
execution without reporting an error. The second execution should report an
error.
Actual result:
--------------
Every execution of the script reports an error:
Execute error: [unixODBC]Error while executing the query (non-fatal);
ERROR: relation "x" already exists
The table "x" is successfully created during the first test script
execution.
--
Edit bug report at http://bugs.php.net/bug.php?id=51476&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51476&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51476&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51476&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51476&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51476&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51476&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51476&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51476&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51476&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51476&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51476&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51476&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51476&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51476&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51476&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51476&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51476&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51476&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51476&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51476&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51476&r=mysqlcfg