}
}
- if (!stmt->dbh->supports_placeholders) {
+ /* TODO: handle the non-native types too... doh. */
+ if (PDO_PLACEHOLDER_NONE == stmt->supports_placeholders) {
int error_pos;
/* handle the emulated parameter binding,
* stmt->active_query_string holds the query with binds expanded and
# define FALSE 0
#endif
-#define PDO_DRIVER_API 20050111
+#define PDO_DRIVER_API 20050117
enum pdo_param_type {
PDO_PARAM_NULL,
*/
typedef int (*pdo_stmt_get_column_meta_func)(pdo_stmt_t *stmt, long colno, zval *return_value TSRMLS_DC);
+/* advances the statement to the next rowset of the batch.
+ * If it returns 1, PDO will tear down its idea of columns
+ * and meta data. If it returns 0, PDO will indicate an error
+ * to the caller. */
+typedef int (*pdo_stmt_next_rowset_func)(pdo_stmt_t *stmt TSRMLS_DC);
+
struct pdo_stmt_methods {
pdo_stmt_dtor_func dtor;
pdo_stmt_execute_func executer;
pdo_stmt_set_attr_func set_attribute;
pdo_stmt_get_attr_func get_attribute;
pdo_stmt_get_column_meta_func get_column_meta;
+ pdo_stmt_next_rowset_func next_rowset;
};
/* }}} */
* the columns that are returned */
unsigned alloc_own_columns:1;
- /* if true, the driver supports placeholders and can implement
- * bindParam() for its prepared statements, if false, PDO should
- * emulate prepare and bind on its behalf */
- unsigned supports_placeholders:2;
-
/* if true, commit or rollBack is allowed to be called */
unsigned in_txn:1;
/* the sum of the number of bits here and the bit fields preceeding should
* equal 32 */
- unsigned _reserved_flags:21;
+ unsigned _reserved_flags:23;
/* data source string used to open this handle */
const char *data_source;
/* if true, we've already successfully executed this statement at least
* once */
unsigned executed:1;
- unsigned _reserved:31;
+ /* if true, the statement supports placeholders and can implement
+ * bindParam() for its prepared statements, if false, PDO should
+ * emulate prepare and bind on its behalf */
+ unsigned supports_placeholders:2;
+
+ unsigned _reserved:29;
/* the number of columns in the result set; not valid until after
* the statement has been executed at least once. In some cases, might
S->H = H;
stmt->driver_data = S;
stmt->methods = &dblib_stmt_methods;
+ stmt->supports_placeholders = PDO_PLACEHOLDER_NONE;
S->err.sqlstate = stmt->error_code;
return 1;
}
ret = 1;
- dbh->supports_placeholders = 0;
dbh->max_escaped_char_length = 2;
dbh->alloc_own_columns = 1;
stmt->driver_data = S;
stmt->methods = &firebird_stmt_methods;
+ stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL;
return 1;
}
dbh->methods = &firebird_methods;
- dbh->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL;
dbh->native_case = PDO_CASE_UPPER;
dbh->alloc_own_columns = 1;
S->H = H;
stmt->driver_data = S;
stmt->methods = &mysql_stmt_methods;
+ stmt->supports_placeholders = PDO_PLACEHOLDER_NONE;
return 1;
}
H->attached = 1;
dbh->alloc_own_columns = 1;
- dbh->supports_placeholders = 0;
dbh->max_escaped_char_length = 2;
dbh->methods = &mysql_methods;
stmt->driver_data = S;
stmt->methods = &oci_stmt_methods;
+ stmt->supports_placeholders = PDO_PLACEHOLDER_NAMED;
return 1;
}
dbh->methods = &oci_methods;
dbh->alloc_own_columns = 1;
- dbh->supports_placeholders = PDO_PLACEHOLDER_NAMED;
dbh->native_case = PDO_CASE_UPPER;
ret = 1;
stmt->driver_data = S;
stmt->methods = &odbc_stmt_methods;
+ stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL;
return 1;
}
dbh->methods = &odbc_methods;
dbh->alloc_own_columns = 1;
- dbh->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL;
return 1;
}
S->H = H;
stmt->driver_data = S;
stmt->methods = &pgsql_stmt_methods;
+ stmt->supports_placeholders = PDO_PLACEHOLDER_NONE;
scrollable = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR,
PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL;
dbh->methods = &pgsql_methods;
dbh->alloc_own_columns = 1;
- dbh->supports_placeholders = PDO_PLACEHOLDER_NONE;
dbh->max_escaped_char_length = 2;
ret = 1;
S->H = H;
stmt->driver_data = S;
stmt->methods = &sqlite_stmt_methods;
+ stmt->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL;
if (PDO_CURSOR_FWDONLY != pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) {
H->einfo.errcode = SQLITE_ERROR;
sqlite3_busy_timeout(H->db, timeout * 1000);
dbh->alloc_own_columns = 1;
- dbh->supports_placeholders = PDO_PLACEHOLDER_POSITIONAL;
dbh->max_escaped_char_length = 2;
ret = 1;