]> granicus.if.org Git - php/commitdiff
PDO MySQL: Use set_row_count() helper
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 9 Dec 2020 14:20:47 +0000 (15:20 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 9 Dec 2020 14:21:12 +0000 (15:21 +0100)
ext/pdo_mysql/mysql_statement.c

index a8be36c426752abdde8c955d15e37ef2bad430a6..3203f1808a3fa966019d0798bbeedcc61e8b9c4a 100644 (file)
@@ -113,9 +113,8 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt) /* {{{ */
 
 static void pdo_mysql_stmt_set_row_count(pdo_stmt_t *stmt) /* {{{ */
 {
-       zend_long row_count;
        pdo_mysql_stmt *S = stmt->driver_data;
-       row_count = (zend_long) mysql_stmt_affected_rows(S->stmt);
+       zend_long row_count = (zend_long) mysql_stmt_affected_rows(S->stmt);
        if (row_count != (zend_long)-1) {
                stmt->row_count = row_count;
        }
@@ -343,9 +342,6 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */
 {
        pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
        pdo_mysql_db_handle *H = S->H;
-#ifdef PDO_USE_MYSQLND
-       zend_long row_count;
-#endif
        PDO_DBG_ENTER("pdo_mysql_stmt_next_rowset");
        PDO_DBG_INF_FMT("stmt=%p", S->stmt);
 
@@ -390,10 +386,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt) /* {{{ */
                                }
                        }
                }
-               row_count = (zend_long) mysql_stmt_affected_rows(S->stmt);
-               if (row_count != (zend_long)-1) {
-                       stmt->row_count = row_count;
-               }
+               pdo_mysql_stmt_set_row_count(stmt);
                PDO_DBG_RETURN(1);
        }
 #endif