Skip to content

Commit c77bd71

Browse files
committed
be aware of scrollable cursors; sqlite doesn't support them
1 parent 4d5c40c commit c77bd71

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ext/pdo_sqlite/sqlite_driver.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len,
123123
stmt->driver_data = S;
124124
stmt->methods = &sqlite_stmt_methods;
125125

126+
if (PDO_CURSOR_FWDONLY != pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, PDO_CURSOR_FWDONLY TSRMLS_CC)) {
127+
H->einfo.errcode = SQLITE_ERROR;
128+
pdo_sqlite_error(dbh);
129+
return 0;
130+
}
131+
126132
i = sqlite3_prepare(H->db, sql, sql_len, &S->stmt, &tail);
127133
if (i == SQLITE_OK) {
128134
return 1;

ext/pdo_sqlite/sqlite_statement.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ static int pdo_sqlite_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_d
122122
return 1;
123123
}
124124

125-
static int pdo_sqlite_stmt_fetch(pdo_stmt_t *stmt TSRMLS_DC)
125+
static int pdo_sqlite_stmt_fetch(pdo_stmt_t *stmt,
126+
enum pdo_fetch_orientation ori, long offset TSRMLS_DC)
126127
{
127128
pdo_sqlite_stmt *S = (pdo_sqlite_stmt*)stmt->driver_data;
128129
int i;

0 commit comments

Comments
 (0)