Lines Matching refs:dbh
463 void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, zend_long line) /* {{{ */ in _firebird_error() argument
465 pdo_error_type *const error_code = stmt ? &stmt->error_code : &dbh->error_code; in _firebird_error()
471 #define RECORD_ERROR(dbh) _firebird_error(dbh, NULL, __FILE__, __LINE__) argument
474 static void firebird_handle_closer(pdo_dbh_t *dbh) /* {{{ */ in firebird_handle_closer() argument
476 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_closer()
478 if (dbh->in_txn) { in firebird_handle_closer()
479 if (dbh->auto_commit) { in firebird_handle_closer()
481 RECORD_ERROR(dbh); in firebird_handle_closer()
485 RECORD_ERROR(dbh); in firebird_handle_closer()
491 RECORD_ERROR(dbh); in firebird_handle_closer()
504 pefree(H, dbh->is_persistent); in firebird_handle_closer()
509 static bool firebird_handle_preparer(pdo_dbh_t *dbh, zend_string *sql, /* {{{ */ in firebird_handle_preparer() argument
512 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_preparer()
529 if (!firebird_alloc_prepare_stmt(dbh, sql, &num_sqlda, &s, np)) { in firebird_handle_preparer()
550 RECORD_ERROR(dbh); in firebird_handle_preparer()
577 RECORD_ERROR(dbh); in firebird_handle_preparer()
594 static zend_long firebird_handle_doer(pdo_dbh_t *dbh, const zend_string *sql) /* {{{ */ in firebird_handle_doer() argument
596 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_doer()
609 if (!firebird_alloc_prepare_stmt(dbh, sql, &out_sqlda, &stmt, 0)) { in firebird_handle_doer()
615 RECORD_ERROR(dbh); in firebird_handle_doer()
623 RECORD_ERROR(dbh); in firebird_handle_doer()
650 if (dbh->auto_commit && isc_commit_retaining(H->isc_status, &H->tr)) { in firebird_handle_doer()
651 RECORD_ERROR(dbh); in firebird_handle_doer()
657 RECORD_ERROR(dbh); in firebird_handle_doer()
665 static zend_string* firebird_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquoted, enum pdo_pa… in firebird_handle_quoter() argument
704 static bool firebird_handle_begin(pdo_dbh_t *dbh) /* {{{ */ in firebird_handle_begin() argument
706 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_begin()
709 if (dbh->transaction_flags & PDO_TRANS_ISOLATION_LEVEL) { in firebird_handle_begin()
710 if (dbh->transaction_flags & PDO_TRANS_READ_UNCOMMITTED) { in firebird_handle_begin()
714 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_READ_UNCOMMITTED); in firebird_handle_begin()
715 } else if (dbh->transaction_flags & PDO_TRANS_READ_COMMITTED) { in firebird_handle_begin()
718 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_READ_COMMITTED); in firebird_handle_begin()
719 } else if (dbh->transaction_flags & PDO_TRANS_REPEATABLE_READ) { in firebird_handle_begin()
721 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_REPEATABLE_READ); in firebird_handle_begin()
724 dbh->transaction_flags &= ~(PDO_TRANS_ISOLATION_LEVEL^PDO_TRANS_SERIALIZABLE); in firebird_handle_begin()
728 if (dbh->transaction_flags & PDO_TRANS_ACCESS_MODE) { in firebird_handle_begin()
729 if (dbh->transaction_flags & PDO_TRANS_READONLY) { in firebird_handle_begin()
731 dbh->transaction_flags &= ~(PDO_TRANS_ACCESS_MODE^PDO_TRANS_READONLY); in firebird_handle_begin()
734 dbh->transaction_flags &= ~(PDO_TRANS_ACCESS_MODE^PDO_TRANS_READWRITE); in firebird_handle_begin()
738 if (dbh->transaction_flags & PDO_TRANS_CONFLICT_RESOLUTION) { in firebird_handle_begin()
739 if (dbh->transaction_flags & PDO_TRANS_RETRY) { in firebird_handle_begin()
741 dbh->transaction_flags &= ~(PDO_TRANS_CONFLICT_RESOLUTION^PDO_TRANS_RETRY); in firebird_handle_begin()
744 dbh->transaction_flags &= ~(PDO_TRANS_CONFLICT_RESOLUTION^PDO_TRANS_ABORT); in firebird_handle_begin()
749 RECORD_ERROR(dbh); in firebird_handle_begin()
757 static bool firebird_handle_commit(pdo_dbh_t *dbh) /* {{{ */ in firebird_handle_commit() argument
759 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_commit()
762 RECORD_ERROR(dbh); in firebird_handle_commit()
770 static bool firebird_handle_rollback(pdo_dbh_t *dbh) /* {{{ */ in firebird_handle_rollback() argument
772 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_rollback()
775 RECORD_ERROR(dbh); in firebird_handle_rollback()
783 static int firebird_alloc_prepare_stmt(pdo_dbh_t *dbh, const zend_string *sql, in firebird_alloc_prepare_stmt() argument
786 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_alloc_prepare_stmt()
791 strcpy(dbh->error_code, "01004"); in firebird_alloc_prepare_stmt()
796 if (dbh->auto_commit && !dbh->in_txn) { in firebird_alloc_prepare_stmt()
799 if (!firebird_handle_begin(dbh)) { in firebird_alloc_prepare_stmt()
802 dbh->in_txn = true; in firebird_alloc_prepare_stmt()
807 RECORD_ERROR(dbh); in firebird_alloc_prepare_stmt()
816 strcpy(dbh->error_code, "07000"); in firebird_alloc_prepare_stmt()
823 RECORD_ERROR(dbh); in firebird_alloc_prepare_stmt()
833 static bool firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val) /* {{{ */ in firebird_handle_set_attribute() argument
835 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_set_attribute()
846 if (dbh->auto_commit ^ bval) { in firebird_handle_set_attribute()
847 if (dbh->in_txn) { in firebird_handle_set_attribute()
855 if (!firebird_handle_commit(dbh)) { in firebird_handle_set_attribute()
858 dbh->in_txn = false; in firebird_handle_set_attribute()
861 dbh->auto_commit = bval; in firebird_handle_set_attribute()
934 static int firebird_handle_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val) /* {{{ */ in firebird_handle_get_attribute() argument
936 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in firebird_handle_get_attribute()
942 ZVAL_LONG(val,dbh->auto_commit); in firebird_handle_get_attribute()
991 static void pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) /* {{{ */ in pdo_firebird_fetch_error_func() argument
993 pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data; in pdo_firebird_fetch_error_func()
1034 static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ */ in pdo_firebird_handle_factory() argument
1047 pdo_firebird_db_handle *H = dbh->driver_data = pecalloc(1,sizeof(*H),dbh->is_persistent); in pdo_firebird_handle_factory()
1049 php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, 6); in pdo_firebird_handle_factory()
1051 if (!dbh->username && vars[4].optval) { in pdo_firebird_handle_factory()
1052 dbh->username = pestrdup(vars[4].optval, dbh->is_persistent); in pdo_firebird_handle_factory()
1055 if (!dbh->password && vars[5].optval) { in pdo_firebird_handle_factory()
1056 dbh->password = pestrdup(vars[5].optval, dbh->is_persistent); in pdo_firebird_handle_factory()
1062 char const *dpb_values[] = { dbh->username, dbh->password, vars[1].optval, vars[2].optval }; in pdo_firebird_handle_factory()
1087 dbh->methods = &firebird_methods; in pdo_firebird_handle_factory()
1088 dbh->native_case = PDO_CASE_UPPER; in pdo_firebird_handle_factory()
1089 dbh->alloc_own_columns = 1; in pdo_firebird_handle_factory()
1101 if (!dbh->methods) { in pdo_firebird_handle_factory()
1110 firebird_handle_closer(dbh); in pdo_firebird_handle_factory()