Lines Matching refs:dbh
47 static int pgsql_handle_in_transaction(pdo_dbh_t *dbh TSRMLS_DC);
79 int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char *sqlstate, const cha… in _pdo_pgsql_error() argument
81 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in _pdo_pgsql_error()
82 pdo_error_type *pdo_err = stmt ? &stmt->error_code : &dbh->error_code; in _pdo_pgsql_error()
91 pefree(einfo->errmsg, dbh->is_persistent); in _pdo_pgsql_error()
106 einfo->errmsg = _pdo_pgsql_trim_message(errmsg, dbh->is_persistent); in _pdo_pgsql_error()
109 if (!dbh->methods) { in _pdo_pgsql_error()
118 static void _pdo_pgsql_notice(pdo_dbh_t *dbh, const char *message) /* {{{ */ in _pdo_pgsql_notice() argument
124 static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info TSRMLS_DC) /* {{… in pdo_pgsql_fetch_error_func() argument
126 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_fetch_error_func()
154 pdo_dbh_t *dbh = self->dbh; in pgsql_lob_close() local
160 php_pdo_dbh_delref(dbh TSRMLS_CC); in pgsql_lob_close()
190 php_stream *pdo_pgsql_create_lob_stream(pdo_dbh_t *dbh, int lfd, Oid oid TSRMLS_DC) in pdo_pgsql_create_lob_stream() argument
194 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_create_lob_stream()
196 self->dbh = dbh; in pdo_pgsql_create_lob_stream()
204 php_pdo_dbh_addref(dbh TSRMLS_CC); in pdo_pgsql_create_lob_stream()
213 static int pgsql_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ in pgsql_handle_closer()
215 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_closer()
222 pefree(H->einfo.errmsg, dbh->is_persistent); in pgsql_handle_closer()
225 pefree(H, dbh->is_persistent); in pgsql_handle_closer()
226 dbh->driver_data = NULL; in pgsql_handle_closer()
232 static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, long sql_len, pdo_stmt_t *stmt, z… in pgsql_handle_preparer() argument
234 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_preparer()
282 strcpy(dbh->error_code, stmt->error_code); in pgsql_handle_preparer()
305 static long pgsql_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSRMLS_DC) in pgsql_handle_doer() argument
307 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_doer()
314 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in pgsql_handle_doer()
319 pdo_pgsql_error(dbh, qs, pdo_pgsql_sqlstate(res)); in pgsql_handle_doer()
330 static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted… in pgsql_handle_quoter() argument
333 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_quoter()
359 static char *pdo_pgsql_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned int *len TSRMLS_DC) in pdo_pgsql_last_insert_id() argument
361 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_last_insert_id()
368 savepoint = pgsql_handle_in_transaction(dbh TSRMLS_CC); in pdo_pgsql_last_insert_id()
390 pdo_pgsql_error(dbh, status, pdo_pgsql_sqlstate(res)); in pdo_pgsql_last_insert_id()
405 static int pdo_pgsql_get_attribute(pdo_dbh_t *dbh, long attr, zval *return_value TSRMLS_DC) in pdo_pgsql_get_attribute() argument
407 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_get_attribute()
499 static int pdo_pgsql_check_liveness(pdo_dbh_t *dbh TSRMLS_DC) in pdo_pgsql_check_liveness()
501 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_check_liveness()
509 static int pgsql_handle_in_transaction(pdo_dbh_t *dbh TSRMLS_DC) in pgsql_handle_in_transaction()
513 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_in_transaction()
518 static int pdo_pgsql_transaction_cmd(const char *cmd, pdo_dbh_t *dbh TSRMLS_DC) in pdo_pgsql_transaction_cmd()
520 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_transaction_cmd()
527 pdo_pgsql_error(dbh, PQresultStatus(res), pdo_pgsql_sqlstate(res)); in pdo_pgsql_transaction_cmd()
535 static int pgsql_handle_begin(pdo_dbh_t *dbh TSRMLS_DC) in pgsql_handle_begin()
537 return pdo_pgsql_transaction_cmd("BEGIN", dbh TSRMLS_CC); in pgsql_handle_begin()
540 static int pgsql_handle_commit(pdo_dbh_t *dbh TSRMLS_DC) in pgsql_handle_commit()
542 int ret = pdo_pgsql_transaction_cmd("COMMIT", dbh TSRMLS_CC); in pgsql_handle_commit()
547 dbh->in_txn = pgsql_handle_in_transaction(dbh TSRMLS_CC); in pgsql_handle_commit()
553 static int pgsql_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC) in pgsql_handle_rollback()
555 return pdo_pgsql_transaction_cmd("ROLLBACK", dbh TSRMLS_CC); in pgsql_handle_rollback()
562 pdo_dbh_t *dbh; in PHP_METHOD() local
585 dbh = zend_object_store_get_object(getThis() TSRMLS_CC); in PHP_METHOD()
597 H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD()
637 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in PHP_METHOD()
648 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in PHP_METHOD()
655 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, pdo_pgsql_sqlstate(pgsql_result)); in PHP_METHOD()
664 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, pdo_pgsql_sqlstate(pgsql_result)); in PHP_METHOD()
676 pdo_dbh_t *dbh; in PHP_METHOD() local
693 dbh = zend_object_store_get_object(getThis() TSRMLS_CC); in PHP_METHOD()
699 pdo_pgsql_error_msg(dbh, PGRES_FATAL_ERROR, "Unable to open the file"); in PHP_METHOD()
711 H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD()
735 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in PHP_METHOD()
745 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in PHP_METHOD()
752 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, pdo_pgsql_sqlstate(pgsql_result)); in PHP_METHOD()
762 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, pdo_pgsql_sqlstate(pgsql_result)); in PHP_METHOD()
775 pdo_dbh_t *dbh; in PHP_METHOD() local
793 dbh = zend_object_store_get_object(getThis() TSRMLS_CC); in PHP_METHOD()
797 H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD()
801 pdo_pgsql_error_msg(dbh, PGRES_FATAL_ERROR, "Unable to open the file for writing"); in PHP_METHOD()
835 pdo_pgsql_error_msg(dbh, PGRES_FATAL_ERROR, "Unable to write to file"); in PHP_METHOD()
844 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in PHP_METHOD()
858 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, pdo_pgsql_sqlstate(pgsql_result)); in PHP_METHOD()
870 pdo_dbh_t *dbh; in PHP_METHOD() local
886 dbh = zend_object_store_get_object(getThis() TSRMLS_CC); in PHP_METHOD()
890 H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD()
924 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in PHP_METHOD()
934 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, pdo_pgsql_sqlstate(pgsql_result)); in PHP_METHOD()
947 pdo_dbh_t *dbh; in PHP_METHOD() local
951 dbh = zend_object_store_get_object(getThis() TSRMLS_CC); in PHP_METHOD()
955 H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD()
964 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in PHP_METHOD()
974 pdo_dbh_t *dbh; in PHP_METHOD() local
999 dbh = zend_object_store_get_object(getThis() TSRMLS_CC); in PHP_METHOD()
1003 H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD()
1008 php_stream *stream = pdo_pgsql_create_lob_stream(dbh, lfd, oid TSRMLS_CC); in PHP_METHOD()
1014 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in PHP_METHOD()
1026 pdo_dbh_t *dbh; in PHP_METHOD() local
1042 dbh = zend_object_store_get_object(getThis() TSRMLS_CC); in PHP_METHOD()
1046 H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD()
1052 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL); in PHP_METHOD()
1062 pdo_dbh_t *dbh; in PHP_METHOD() local
1073 dbh = zend_object_store_get_object(getThis() TSRMLS_CC); in PHP_METHOD()
1077 result_type = dbh->default_fetch_type; in PHP_METHOD()
1090 H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD()
1130 pdo_dbh_t *dbh; in PHP_METHOD() local
1133 dbh = zend_object_store_get_object(getThis() TSRMLS_CC); in PHP_METHOD()
1136 H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD()
1156 static const zend_function_entry *pdo_pgsql_get_driver_methods(pdo_dbh_t *dbh, int kind TSRMLS_DC) in pdo_pgsql_get_driver_methods() argument
1166 static int pdo_pgsql_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC) in pdo_pgsql_set_attr() argument
1168 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_set_attr()
1204 static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) /* {{{ */ in pdo_pgsql_handle_factory() argument
1212 H = pecalloc(1, sizeof(pdo_pgsql_db_handle), dbh->is_persistent); in pdo_pgsql_handle_factory()
1213 dbh->driver_data = H; in pdo_pgsql_handle_factory()
1221 e = (char *) dbh->data_source + strlen(dbh->data_source); in pdo_pgsql_handle_factory()
1222 p = (char *) dbh->data_source; in pdo_pgsql_handle_factory()
1232 tmp_user = _pdo_pgsql_escape_credentials(dbh->username TSRMLS_CC); in pdo_pgsql_handle_factory()
1233 tmp_pass = _pdo_pgsql_escape_credentials(dbh->password TSRMLS_CC); in pdo_pgsql_handle_factory()
1237 …spprintf(&conn_str, 0, "%s user='%s' password='%s' connect_timeout=%ld", dbh->data_source, tmp_use… in pdo_pgsql_handle_factory()
1239 …spprintf(&conn_str, 0, "%s user='%s' connect_timeout=%ld", dbh->data_source, tmp_user, connect_tim… in pdo_pgsql_handle_factory()
1241 …spprintf(&conn_str, 0, "%s password='%s' connect_timeout=%ld", dbh->data_source, tmp_pass, connect… in pdo_pgsql_handle_factory()
1243 spprintf(&conn_str, 0, "%s connect_timeout=%ld", (char *) dbh->data_source, connect_timeout); in pdo_pgsql_handle_factory()
1258 pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, PHP_PDO_PGSQL_CONNECTION_FAILURE_SQLSTATE); in pdo_pgsql_handle_factory()
1262 PQsetNoticeProcessor(H->server, (void(*)(void*,const char*))_pdo_pgsql_notice, (void *)&dbh); in pdo_pgsql_handle_factory()
1267 dbh->methods = &pgsql_methods; in pdo_pgsql_handle_factory()
1268 dbh->alloc_own_columns = 1; in pdo_pgsql_handle_factory()
1269 dbh->max_escaped_char_length = 2; in pdo_pgsql_handle_factory()
1274 dbh->methods = &pgsql_methods; in pdo_pgsql_handle_factory()
1276 pgsql_handle_closer(dbh TSRMLS_CC); in pdo_pgsql_handle_factory()