Author: jschlueter
Date: 2008-02-15 18:01:26 +0100 (Fri, 15 Feb 2008)
New Revision: 1285
Modified:
trunk/php5/ext/pdo_mysqlnd/mysql_statement.c
trunk/php5/ext/pdo_mysqlnd/php_pdo_mysql_int.h
Log:
Fix fetching result sets with emulation on
Modified: trunk/php5/ext/pdo_mysqlnd/mysql_statement.c
===================================================================
--- trunk/php5/ext/pdo_mysqlnd/mysql_statement.c 2008-02-15 14:14:14 UTC (rev 1284)
+++ trunk/php5/ext/pdo_mysqlnd/mysql_statement.c 2008-02-15 17:01:26 UTC (rev 1285)
@@ -129,6 +129,7 @@
# if HAVE_MYSQLND
S->result = mysqlnd_stmt_result_metadata(S->stmt);
if (S->result) {
+ /* TODO: implement mysql_fetch_fields in mysqlnd instead of directly accesing it's
data structures */
S->fields = S->result->meta->fields;
}
# else
@@ -263,7 +264,10 @@
if (!stmt->executed) {
stmt->column_count = (int) mysql_num_fields(S->result);
-#ifdef TODO_JOHANNES
+#if HAVE_MYSQLND
+ /* TODO: implement mysql_fetch_fields in mysqlnd instead of directly accesing it's
data structures */
+ S->fields = S->result->meta->fields;
+#else
S->fields = mysql_fetch_fields(S->result);
#endif
}
@@ -515,15 +519,12 @@
return 0;
}
-#ifndef HAVE_MYSQLND
- /* S->stmt == NULL and mysqlnd -> we fetch data here here */
if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
if (mysql_errno(S->H->server)) {
pdo_mysql_error_stmt(stmt);
}
return 0;
}
-#endif
S->current_lengths = mysql_fetch_lengths(S->result);
return 1;
@@ -577,17 +578,15 @@
return 0;
}
-#ifndef HAVE_MYSQLND
/* With mysqlnd data is stored inside mysqlnd, not S->current_data */
-# if HAVE_MYSQL_STMT_PREPARE
+#if HAVE_MYSQL_STMT_PREPARE || HAVE_MYSQLND
if (!S->stmt) {
-# endif
+#endif
if (S->current_data == NULL || !S->result) {
return 0;
}
-# if HAVE_MYSQL_STMT_PREPARE
+#if HAVE_MYSQL_STMT_PREPARE || HAVE_MYSQLND
}
-# endif
#endif
if (colno >= stmt->column_count) {
/* error invalid column */
@@ -636,8 +635,8 @@
*len = S->out_length[colno];
return 1;
}
- *ptr = S->current_data[colno];
#endif
+ *ptr = S->current_data[colno];
*len = S->current_lengths[colno];
return 1;
} /* }}} */
Modified: trunk/php5/ext/pdo_mysqlnd/php_pdo_mysql_int.h
===================================================================
--- trunk/php5/ext/pdo_mysqlnd/php_pdo_mysql_int.h 2008-02-15 14:14:14 UTC (rev 1284)
+++ trunk/php5/ext/pdo_mysqlnd/php_pdo_mysql_int.h 2008-02-15 17:01:26 UTC (rev 1285)
@@ -61,9 +61,7 @@
pdo_mysql_db_handle *H;
MYSQL_RES *result;
MYSQL_FIELD *fields;
-#ifndef HAVE_MYSQLND
MYSQL_ROW current_data;
-#endif
#if HAVE_MYSQLND
unsigned long *current_lengths;
#else
| Thread |
|---|
| • PHP mysqlnd svn commit: r1285 - trunk/php5/ext/pdo_mysqlnd | jschlueter | 15 Feb |