_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $PDO_MYSQL_LIBS"
- AC_CHECK_FUNCS([mysql_commit mysql_stmt_prepare])
+ AC_CHECK_FUNCS([mysql_commit mysql_stmt_prepare mysql_next_result])
LDFLAGS=$_SAVE_LDFLAGS
PHP_CHECK_PDO_INCLUDES
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2004 The PHP Group |
+ | Copyright (c) 1997-2005 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
{ "port", "3306", 0 },
{ "unix_socket", PDO_MYSQL_UNIX_ADDR, 0 },
};
+ int connect_opts = 0
+#ifdef CLIENT_MULTI_RESULTS
+ |CLIENT_MULTI_RESULTS
+#endif
+#ifdef CLIENT_MULTI_STATEMENTS
+ |CLIENT_MULTI_STATEMENTS
+#endif
+ ;
php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 4);
port = atoi(vars[3].optval);
}
dbname = vars[1].optval;
- if (mysql_real_connect(H->server, host, dbh->username, dbh->password, dbname, port, unix_socket, 0) == NULL) {
+ if (mysql_real_connect(H->server, host, dbh->username, dbh->password, dbname, port, unix_socket, connect_opts) == NULL) {
pdo_mysql_error(dbh);
goto cleanup;
}
return 1;
}
+#if HAVE_MYSQL_NEXT_RESULT
+static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
+{
+ pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
+ pdo_mysql_db_handle *H = S->H;
+ my_ulonglong row_count;
+ int debug=0;
+ int ret;
+
+ /* ensure that we free any previous unfetched results */
+ if (S->result) {
+ mysql_free_result(S->result);
+ S->result = NULL;
+ }
+
+ ret = mysql_next_result(H->server);
+
+ if (ret > 0) {
+ pdo_mysql_error_stmt(stmt);
+ return 0;
+ } else if (ret < 0) {
+ /* No more results */
+ return 0;
+ } else {
+ row_count = mysql_affected_rows(H->server);
+ S->result = mysql_use_result(H->server);
+
+ if (NULL == S->result) {
+ return 0;
+ }
+
+ stmt->row_count = row_count;
+ stmt->column_count = (int) mysql_num_fields(S->result);
+ S->fields = mysql_fetch_fields(S->result);
+ return 1;
+ }
+}
+#endif
+
+
static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *param,
enum pdo_param_event event_type TSRMLS_DC)
{
pdo_mysql_stmt_param_hook,
NULL, /* set_attr */
NULL, /* get_attr */
- pdo_mysql_stmt_col_meta
+ pdo_mysql_stmt_col_meta,
+#if HAVE_MYSQL_NEXT_RESULT
+ pdo_mysql_stmt_next_rowset
+#endif
};
/*