]> granicus.if.org Git - php/commitdiff
exec() now returns affected row count
authorGeorge Schlossnagle <gschlossnagle@php.net>
Wed, 19 May 2004 19:31:33 +0000 (19:31 +0000)
committerGeorge Schlossnagle <gschlossnagle@php.net>
Wed, 19 May 2004 19:31:33 +0000 (19:31 +0000)
ext/pdo_mysql/mysql_driver.c

index 2aed63dd3f43d8216cf3e69de3db0c9086c634d6..3f64a8326f2cebe73153d4fc2fc5fbd28d37401f 100755 (executable)
@@ -75,26 +75,18 @@ static int mysql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
        return 1;
 }
 
-static int mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC)
+static long mysql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC)
 {
        pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
 
        if (mysql_real_query(H->server, sql, sql_len)) {
                pdo_mysql_error(H);
-               return 0;
+               return -1;
        } else {
-               return 1;
+               return mysql_affected_rows(H->server);
        }
 }
 
-static long pdo_mysql_affected_rows(pdo_dbh_t *dbh TSRMLS_DC)
-{
-       pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
-       my_ulonglong afr = mysql_affected_rows(H->server);
-
-       return afr == (my_ulonglong) - 1 ? 0 : (long) afr;
-}
-
 static long pdo_mysql_last_insert_id(pdo_dbh_t *dbh TSRMLS_DC)
 {
        pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
@@ -124,7 +116,6 @@ static struct pdo_dbh_methods mysql_methods = {
        NULL,
        NULL,
        NULL,
-       pdo_mysql_affected_rows,
        pdo_mysql_last_insert_id
 };