]> granicus.if.org Git - php/commitdiff
ok, call pdo_mysql_error() before returning -1
authorAndrey Hristov <andrey@php.net>
Tue, 12 Jul 2005 19:32:13 +0000 (19:32 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 12 Jul 2005 19:32:13 +0000 (19:32 +0000)
ext/pdo_mysql/mysql_driver.c

index 08b44298804a5eeec3b185c18e2f02f80cc696d6..2f7d9437c980a583a5f12fbe0ce121aceebe8706 100755 (executable)
@@ -177,8 +177,7 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
                return 0;
        }
 
-       S->stmt = mysql_stmt_init(H->server);
-       if (!S->stmt) {
+       if (!(S->stmt = mysql_stmt_init(H->server))) {
                pdo_mysql_error(dbh);
                if (nsql) {
                        efree(nsql);
@@ -226,7 +225,7 @@ static long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRM
                return -1;
        } else {
                my_ulonglong c= mysql_affected_rows(H->server);
-               return c != (my_ulonglong)-1 ? c:-1
+               return c != (my_ulonglong)-1 ? c:(pdo_mysql_error(dbh),-1)
        }
 }