Lines Matching refs:dbh
38 void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, zend_long line) /* {{{ */ in _firebird_error() argument
40 pdo_error_type *const error_code = stmt ? &stmt->error_code : &dbh->error_code; in _firebird_error()
46 #define RECORD_ERROR(dbh) _firebird_error(dbh, NULL, __FILE__, __LINE__) argument
49 static int firebird_handle_closer(pdo_dbh_t *dbh) /* {{{ */ in firebird_handle_closer() argument
51 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_closer()
53 if (dbh->in_txn) { in firebird_handle_closer()
54 if (dbh->auto_commit) { in firebird_handle_closer()
56 RECORD_ERROR(dbh); in firebird_handle_closer()
60 RECORD_ERROR(dbh); in firebird_handle_closer()
66 RECORD_ERROR(dbh); in firebird_handle_closer()
79 pefree(H, dbh->is_persistent); in firebird_handle_closer()
86 static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len, /* {{{ */ in firebird_handle_preparer() argument
89 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_preparer()
106 if (!firebird_alloc_prepare_stmt(dbh, sql, sql_len, &num_sqlda, &s, np)) { in firebird_handle_preparer()
128 RECORD_ERROR(dbh); in firebird_handle_preparer()
155 RECORD_ERROR(dbh); in firebird_handle_preparer()
172 static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, size_t sql_len) /* {{{ */ in firebird_handle_doer() argument
174 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_doer()
187 if (!firebird_alloc_prepare_stmt(dbh, sql, sql_len, &out_sqlda, &stmt, 0)) { in firebird_handle_doer()
193 RECORD_ERROR(dbh); in firebird_handle_doer()
201 RECORD_ERROR(dbh); in firebird_handle_doer()
228 if (dbh->auto_commit && isc_commit_retaining(H->isc_status, &H->tr)) { in firebird_handle_doer()
229 RECORD_ERROR(dbh); in firebird_handle_doer()
235 RECORD_ERROR(dbh); in firebird_handle_doer()
243 static int firebird_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, size_t unquotedlen, /* {{{ … in firebird_handle_quoter() argument
283 static int firebird_handle_begin(pdo_dbh_t *dbh) /* {{{ */ in firebird_handle_begin() argument
285 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_begin()
288 if (dbh->transaction_flags & PDO_TRANS_ISOLATION_LEVEL) { in firebird_handle_begin()
289 if (dbh->transaction_flags & PDO_TRANS_READ_UNCOMMITTED) { in firebird_handle_begin()
293 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_READ_UNCOMMITTED); in firebird_handle_begin()
294 } else if (dbh->transaction_flags & PDO_TRANS_READ_COMMITTED) { in firebird_handle_begin()
297 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_READ_COMMITTED); in firebird_handle_begin()
298 } else if (dbh->transaction_flags & PDO_TRANS_REPEATABLE_READ) { in firebird_handle_begin()
300 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_REPEATABLE_READ); in firebird_handle_begin()
303 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_SERIALIZABLE); in firebird_handle_begin()
307 if (dbh->transaction_flags & PDO_TRANS_ACCESS_MODE) { in firebird_handle_begin()
308 if (dbh->transaction_flags & PDO_TRANS_READONLY) { in firebird_handle_begin()
310 dbh->transaction_flags &= ~(PDO_TRANS_ACCESS_MODE^PDO_TRANS_READONLY); in firebird_handle_begin()
313 dbh->transaction_flags &= ~(PDO_TRANS_ACCESS_MODE^PDO_TRANS_READWRITE); in firebird_handle_begin()
317 if (dbh->transaction_flags & PDO_TRANS_CONFLICT_RESOLUTION) { in firebird_handle_begin()
318 if (dbh->transaction_flags & PDO_TRANS_RETRY) { in firebird_handle_begin()
320 dbh->transaction_flags &= ~(PDO_TRANS_CONFLICT_RESOLUTION^PDO_TRANS_RETRY); in firebird_handle_begin()
323 dbh->transaction_flags &= ~(PDO_TRANS_CONFLICT_RESOLUTION^PDO_TRANS_ABORT); in firebird_handle_begin()
328 RECORD_ERROR(dbh); in firebird_handle_begin()
336 static int firebird_handle_commit(pdo_dbh_t *dbh) /* {{{ */ in firebird_handle_commit() argument
338 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_commit()
341 RECORD_ERROR(dbh); in firebird_handle_commit()
349 static int firebird_handle_rollback(pdo_dbh_t *dbh) /* {{{ */ in firebird_handle_rollback() argument
351 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_rollback()
354 RECORD_ERROR(dbh); in firebird_handle_rollback()
362 static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, size_t sql_len, /* {{{ */ in firebird_alloc_prepare_stmt() argument
365 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_alloc_prepare_stmt()
371 strcpy(dbh->error_code, "01004"); in firebird_alloc_prepare_stmt()
376 if (dbh->auto_commit && !dbh->in_txn) { in firebird_alloc_prepare_stmt()
379 if (!firebird_handle_begin(dbh)) { in firebird_alloc_prepare_stmt()
382 dbh->in_txn = 1; in firebird_alloc_prepare_stmt()
387 RECORD_ERROR(dbh); in firebird_alloc_prepare_stmt()
430 RECORD_ERROR(dbh); in firebird_alloc_prepare_stmt()
441 static int firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val) /* {{{ */ in firebird_handle_set_attribute() argument
443 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_set_attribute()
451 if (dbh->auto_commit ^ bval) { in firebird_handle_set_attribute()
452 if (dbh->in_txn) { in firebird_handle_set_attribute()
460 if (!firebird_handle_commit(dbh)) { in firebird_handle_set_attribute()
463 dbh->in_txn = 0; in firebird_handle_set_attribute()
466 dbh->auto_commit = bval; in firebird_handle_set_attribute()
536 static int firebird_handle_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val) /* {{{ */ in firebird_handle_get_attribute() argument
538 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_get_attribute()
544 ZVAL_LONG(val,dbh->auto_commit); in firebird_handle_get_attribute()
592 static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) /* {{{ */ in pdo_firebird_fetch_error_func() argument
594 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in pdo_firebird_fetch_error_func()
632 static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ */ in pdo_firebird_handle_factory() argument
645 pdo_firebird_db_handle *H = dbh->driver_data = pecalloc(1,sizeof(*H),dbh->is_persistent); in pdo_firebird_handle_factory()
647 php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 6); in pdo_firebird_handle_factory()
649 if (!dbh->username && vars[4].optval) { in pdo_firebird_handle_factory()
650 dbh->username = pestrdup(vars[4].optval, dbh->is_persistent); in pdo_firebird_handle_factory()
653 if (!dbh->password && vars[5].optval) { in pdo_firebird_handle_factory()
654 dbh->password = pestrdup(vars[5].optval, dbh->is_persistent); in pdo_firebird_handle_factory()
660 char const *dpb_values[] = { dbh->username, dbh->password, vars[1].optval, vars[2].optval }; in pdo_firebird_handle_factory()
685 dbh->methods = &firebird_methods; in pdo_firebird_handle_factory()
686 dbh->native_case = PDO_CASE_UPPER; in pdo_firebird_handle_factory()
687 dbh->alloc_own_columns = 1; in pdo_firebird_handle_factory()
699 if (!dbh->methods) { in pdo_firebird_handle_factory()
708 firebird_handle_closer(dbh); in pdo_firebird_handle_factory()