Lines Matching refs:dbh
40 void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC) /* {{… in _firebird_error() argument
44 : (pdo_firebird_db_handle *)dbh->driver_data; in _firebird_error()
46 pdo_error_type *const error_code = stmt ? &stmt->error_code : &dbh->error_code; in _firebird_error()
95 #define RECORD_ERROR(dbh) _firebird_error(dbh, NULL, __FILE__, __LINE__ TSRMLS_CC) argument
98 static int firebird_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ in firebird_handle_closer()
100 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_closer()
102 if (dbh->in_txn) { in firebird_handle_closer()
103 if (dbh->auto_commit) { in firebird_handle_closer()
105 RECORD_ERROR(dbh); in firebird_handle_closer()
109 RECORD_ERROR(dbh); in firebird_handle_closer()
115 RECORD_ERROR(dbh); in firebird_handle_closer()
128 pefree(H, dbh->is_persistent); in firebird_handle_closer()
135 static int firebird_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, /* {{{ */ in firebird_handle_preparer() argument
138 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_preparer()
155 if (!firebird_alloc_prepare_stmt(dbh, sql, sql_len, &num_sqlda, &s, np TSRMLS_CC)) { in firebird_handle_preparer()
177 RECORD_ERROR(dbh); in firebird_handle_preparer()
204 RECORD_ERROR(dbh); in firebird_handle_preparer()
221 static long firebird_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) /* {{{ */ in firebird_handle_doer() argument
223 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_doer()
236 if (!firebird_alloc_prepare_stmt(dbh, sql, sql_len, &out_sqlda, &stmt, 0 TSRMLS_CC)) { in firebird_handle_doer()
242 RECORD_ERROR(dbh); in firebird_handle_doer()
249 RECORD_ERROR(dbh); in firebird_handle_doer()
266 if (dbh->auto_commit && isc_commit_retaining(H->isc_status, &H->tr)) { in firebird_handle_doer()
267 RECORD_ERROR(dbh); in firebird_handle_doer()
275 static int firebird_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, /* {{{ */ in firebird_handle_quoter() argument
315 static int firebird_handle_begin(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ in firebird_handle_begin()
317 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_begin()
320 if (dbh->transaction_flags & PDO_TRANS_ISOLATION_LEVEL) { in firebird_handle_begin()
321 if (dbh->transaction_flags & PDO_TRANS_READ_UNCOMMITTED) { in firebird_handle_begin()
325 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_READ_UNCOMMITTED); in firebird_handle_begin()
326 } else if (dbh->transaction_flags & PDO_TRANS_READ_COMMITTED) { in firebird_handle_begin()
329 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_READ_COMMITTED); in firebird_handle_begin()
330 } else if (dbh->transaction_flags & PDO_TRANS_REPEATABLE_READ) { in firebird_handle_begin()
332 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_REPEATABLE_READ); in firebird_handle_begin()
335 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_SERIALIZABLE); in firebird_handle_begin()
339 if (dbh->transaction_flags & PDO_TRANS_ACCESS_MODE) { in firebird_handle_begin()
340 if (dbh->transaction_flags & PDO_TRANS_READONLY) { in firebird_handle_begin()
342 dbh->transaction_flags &= ~(PDO_TRANS_ACCESS_MODE^PDO_TRANS_READONLY); in firebird_handle_begin()
345 dbh->transaction_flags &= ~(PDO_TRANS_ACCESS_MODE^PDO_TRANS_READWRITE); in firebird_handle_begin()
349 if (dbh->transaction_flags & PDO_TRANS_CONFLICT_RESOLUTION) { in firebird_handle_begin()
350 if (dbh->transaction_flags & PDO_TRANS_RETRY) { in firebird_handle_begin()
352 dbh->transaction_flags &= ~(PDO_TRANS_CONFLICT_RESOLUTION^PDO_TRANS_RETRY); in firebird_handle_begin()
355 dbh->transaction_flags &= ~(PDO_TRANS_CONFLICT_RESOLUTION^PDO_TRANS_ABORT); in firebird_handle_begin()
360 RECORD_ERROR(dbh); in firebird_handle_begin()
368 static int firebird_handle_commit(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ in firebird_handle_commit()
370 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_commit()
373 RECORD_ERROR(dbh); in firebird_handle_commit()
381 static int firebird_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ in firebird_handle_rollback()
383 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_rollback()
386 RECORD_ERROR(dbh); in firebird_handle_rollback()
394 static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const char *sql, long sql_len, /* {{{ */ in firebird_alloc_prepare_stmt() argument
397 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_alloc_prepare_stmt()
403 strcpy(dbh->error_code, "01004"); in firebird_alloc_prepare_stmt()
408 if (dbh->auto_commit && !dbh->in_txn) { in firebird_alloc_prepare_stmt()
411 if (!firebird_handle_begin(dbh TSRMLS_CC)) { in firebird_alloc_prepare_stmt()
414 dbh->in_txn = 1; in firebird_alloc_prepare_stmt()
419 RECORD_ERROR(dbh); in firebird_alloc_prepare_stmt()
461 RECORD_ERROR(dbh); in firebird_alloc_prepare_stmt()
472 static int firebird_handle_set_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) /* {{{ */ in firebird_handle_set_attribute() argument
474 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_set_attribute()
482 if (dbh->auto_commit ^ Z_BVAL_P(val)) { in firebird_handle_set_attribute()
483 if (dbh->in_txn) { in firebird_handle_set_attribute()
491 if (!firebird_handle_commit(dbh TSRMLS_CC)) { in firebird_handle_set_attribute()
494 dbh->in_txn = 0; in firebird_handle_set_attribute()
497 dbh->auto_commit = Z_BVAL_P(val); in firebird_handle_set_attribute()
547 static int firebird_handle_get_attribute(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) /* {{{ */ in firebird_handle_get_attribute() argument
549 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_get_attribute()
555 ZVAL_LONG(val,dbh->auto_commit); in firebird_handle_get_attribute()
603 static int pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC) /*… in pdo_firebird_fetch_error_func() argument
605 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in pdo_firebird_fetch_error_func()
643 static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) /* {{{ */ in pdo_firebird_handle_factory() argument
653 pdo_firebird_db_handle *H = dbh->driver_data = pecalloc(1,sizeof(*H),dbh->is_persistent); in pdo_firebird_handle_factory()
655 php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 3); 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()
680 dbh->methods = &firebird_methods; in pdo_firebird_handle_factory()
681 dbh->native_case = PDO_CASE_UPPER; in pdo_firebird_handle_factory()
682 dbh->alloc_own_columns = 1; in pdo_firebird_handle_factory()
694 if (!dbh->methods) { in pdo_firebird_handle_factory()
703 firebird_handle_closer(dbh TSRMLS_CC); in pdo_firebird_handle_factory()