From: George Schlossnagle Date: Wed, 19 May 2004 19:31:33 +0000 (+0000) Subject: exec() now returns affected row count X-Git-Tag: RELEASE_0_1~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38a409c02fa856f53b5ccc2408e6753ba0e3e779;p=php exec() now returns affected row count --- diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 2aed63dd3f..3f64a8326f 100755 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -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 };