Lines Matching refs:H
70 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in _pdo_pgsql_error() local
72 pdo_pgsql_error_info *einfo = &H->einfo; in _pdo_pgsql_error()
73 char *errmsg = PQerrorMessage(H->server); in _pdo_pgsql_error()
121 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_fetch_error_func() local
122 pdo_pgsql_error_info *einfo = &H->einfo; in pdo_pgsql_fetch_error_func()
136 void pdo_pgsql_cleanup_notice_callback(pdo_pgsql_db_handle *H) /* {{{ */ in pdo_pgsql_cleanup_notice_callback() argument
138 if (H->notice_callback) { in pdo_pgsql_cleanup_notice_callback()
139 zend_fcc_dtor(H->notice_callback); in pdo_pgsql_cleanup_notice_callback()
140 efree(H->notice_callback); in pdo_pgsql_cleanup_notice_callback()
141 H->notice_callback = NULL; in pdo_pgsql_cleanup_notice_callback()
162 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)(Z_PDO_DBH_P(&self->dbh))->driver_data; in pgsql_lob_close() local
167 zend_hash_index_del(H->lob_streams, php_stream_get_resource_id(stream)); in pgsql_lob_close()
207 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)(Z_PDO_DBH_P(dbh))->driver_data; in pdo_pgsql_create_lob_stream() local
212 self->conn = H->server; in pdo_pgsql_create_lob_stream()
218 zend_hash_index_add_ptr(H->lob_streams, php_stream_get_resource_id(stm), stm->res); in pdo_pgsql_create_lob_stream()
230 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_close_lob_streams() local
231 if (H->lob_streams) { in pdo_pgsql_close_lob_streams()
232 ZEND_HASH_REVERSE_FOREACH_PTR(H->lob_streams, res) { in pdo_pgsql_close_lob_streams()
242 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_closer() local
243 if (H) { in pgsql_handle_closer()
244 if (H->lob_streams) { in pgsql_handle_closer()
246 zend_hash_destroy(H->lob_streams); in pgsql_handle_closer()
247 pefree(H->lob_streams, dbh->is_persistent); in pgsql_handle_closer()
248 H->lob_streams = NULL; in pgsql_handle_closer()
250 pdo_pgsql_cleanup_notice_callback(H); in pgsql_handle_closer()
251 if (H->server) { in pgsql_handle_closer()
252 PQfinish(H->server); in pgsql_handle_closer()
253 H->server = NULL; in pgsql_handle_closer()
255 if (H->einfo.errmsg) { in pgsql_handle_closer()
256 pefree(H->einfo.errmsg, dbh->is_persistent); in pgsql_handle_closer()
257 H->einfo.errmsg = NULL; in pgsql_handle_closer()
259 pefree(H, dbh->is_persistent); in pgsql_handle_closer()
267 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_preparer() local
277 S->H = H; in pgsql_handle_preparer()
288 spprintf(&S->cursor_name, 0, "pdo_crsr_%08x", ++H->stmt_counter); in pgsql_handle_preparer()
291 if (pdo_attr_lval(driver_options, PDO_ATTR_EMULATE_PREPARES, H->emulate_prepares) == 1) { in pgsql_handle_preparer()
294 if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_PREPARES, H->disable_prepares) == 1) { in pgsql_handle_preparer()
298 emulate = H->emulate_prepares; in pgsql_handle_preparer()
299 execute_only = H->disable_prepares; in pgsql_handle_preparer()
314 : H->default_fetching_laziness in pgsql_handle_preparer()
333 spprintf(&S->stmt_name, 0, "pdo_stmt_%08x", ++H->stmt_counter); in pgsql_handle_preparer()
341 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_doer() local
348 if (!(res = PQexec(H->server, ZSTR_VAL(sql)))) { in pgsql_handle_doer()
359 H->pgoid = PQoidValue(res); in pgsql_handle_doer()
379 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_quoter() local
385 …escaped = PQescapeByteaConn(H->server, (unsigned char *)ZSTR_VAL(unquoted), ZSTR_LEN(unquoted), &t… in pgsql_handle_quoter()
397 …quotedlen = PQescapeStringConn(H->server, quoted + 1, ZSTR_VAL(unquoted), ZSTR_LEN(unquoted), NULL… in pgsql_handle_quoter()
410 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_last_insert_id() local
416 res = PQexec(H->server, "SELECT LASTVAL()"); in pdo_pgsql_last_insert_id()
421 res = PQexecParams(H->server, "SELECT CURRVAL($1)", 1, NULL, q, NULL, NULL, 0); in pdo_pgsql_last_insert_id()
454 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_get_attribute() local
458 ZVAL_BOOL(return_value, H->emulate_prepares); in pdo_pgsql_get_attribute()
462 ZVAL_BOOL(return_value, H->disable_prepares); in pdo_pgsql_get_attribute()
473 ZVAL_STRING(return_value, (char*)PQparameterStatus(H->server, "server_version")); in pdo_pgsql_get_attribute()
477 switch (PQstatus(H->server)) { in pdo_pgsql_get_attribute()
531 int spid = PQbackendPID(H->server); in pdo_pgsql_get_attribute()
538 (char*)PQparameterStatus(H->server, "client_encoding"), in pdo_pgsql_get_attribute()
539 (char*)PQparameterStatus(H->server, "is_superuser"), in pdo_pgsql_get_attribute()
540 (char*)PQparameterStatus(H->server, "session_authorization"), in pdo_pgsql_get_attribute()
541 (char*)PQparameterStatus(H->server, "DateStyle")); in pdo_pgsql_get_attribute()
557 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_check_liveness() local
558 if (!PQconsumeInput(H->server) || PQstatus(H->server) == CONNECTION_BAD) { in pdo_pgsql_check_liveness()
559 PQreset(H->server); in pdo_pgsql_check_liveness()
561 return (PQstatus(H->server) == CONNECTION_OK) ? SUCCESS : FAILURE; in pdo_pgsql_check_liveness()
567 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsql_handle_in_transaction() local
569 return PQtransactionStatus(H->server) > PQTRANS_IDLE; in pgsql_handle_in_transaction()
574 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_transaction_cmd() local
578 res = PQexec(H->server, cmd); in pdo_pgsql_transaction_cmd()
620 static bool _pdo_pgsql_send_copy_data(pdo_pgsql_db_handle *H, zval *line) { in _pdo_pgsql_send_copy_data() argument
637 if (PQputCopyData(H->server, query, query_len) != 1) { in _pdo_pgsql_send_copy_data()
649 pdo_pgsql_db_handle *H; in pgsqlCopyFromArray_internal() local
681 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsqlCopyFromArray_internal()
683 while ((pgsql_result = PQgetResult(H->server))) { in pgsqlCopyFromArray_internal()
686 pgsql_result = PQexec(H->server, query); in pgsqlCopyFromArray_internal()
694 status = (ExecStatusType) PQstatus(H->server); in pgsqlCopyFromArray_internal()
706 if (!_pdo_pgsql_send_copy_data(H, tmp)) { in pgsqlCopyFromArray_internal()
727 if (!_pdo_pgsql_send_copy_data(H, tmp)) { in pgsqlCopyFromArray_internal()
737 if (PQputCopyEnd(H->server, NULL) != 1) { in pgsqlCopyFromArray_internal()
743 while ((pgsql_result = PQgetResult(H->server))) { in pgsqlCopyFromArray_internal()
771 pdo_pgsql_db_handle *H; in pgsqlCopyFromFile_internal() local
805 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsqlCopyFromFile_internal()
807 while ((pgsql_result = PQgetResult(H->server))) { in pgsqlCopyFromFile_internal()
810 pgsql_result = PQexec(H->server, query); in pgsqlCopyFromFile_internal()
817 status = (ExecStatusType) PQstatus(H->server); in pgsqlCopyFromFile_internal()
827 if (PQputCopyData(H->server, buf, line_len) != 1) { in pgsqlCopyFromFile_internal()
838 if (PQputCopyEnd(H->server, NULL) != 1) { in pgsqlCopyFromFile_internal()
844 while ((pgsql_result = PQgetResult(H->server))) { in pgsqlCopyFromFile_internal()
873 pdo_pgsql_db_handle *H; in pgsqlCopyToFile_internal() local
894 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsqlCopyToFile_internal()
903 while ((pgsql_result = PQgetResult(H->server))) { in pgsqlCopyToFile_internal()
913 pgsql_result = PQexec(H->server, query); in pgsqlCopyToFile_internal()
919 status = (ExecStatusType) PQstatus(H->server); in pgsqlCopyToFile_internal()
926 int ret = PQgetCopyData(H->server, &csv, 0); in pgsqlCopyToFile_internal()
949 while ((pgsql_result = PQgetResult(H->server))) { in pgsqlCopyToFile_internal()
973 pdo_pgsql_db_handle *H; in pgsqlCopyToArray_internal() local
992 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsqlCopyToArray_internal()
994 while ((pgsql_result = PQgetResult(H->server))) { in pgsqlCopyToArray_internal()
1004 pgsql_result = PQexec(H->server, query); in pgsqlCopyToArray_internal()
1010 status = (ExecStatusType) PQstatus(H->server); in pgsqlCopyToArray_internal()
1019 int ret = PQgetCopyData(H->server, &csv, 0); in pgsqlCopyToArray_internal()
1032 while ((pgsql_result = PQgetResult(H->server))) { in pgsqlCopyToArray_internal()
1053 pdo_pgsql_db_handle *H; in pgsqlLOBCreate_internal() local
1062 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsqlLOBCreate_internal()
1063 lfd = lo_creat(H->server, INV_READ|INV_WRITE); in pgsqlLOBCreate_internal()
1086 pdo_pgsql_db_handle *H; in pgsqlLOBOpen_internal() local
1114 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsqlLOBOpen_internal()
1116 lfd = lo_open(H->server, oid, mode); in pgsqlLOBOpen_internal()
1142 pdo_pgsql_db_handle *H; in pgsqlLOBUnlink_internal() local
1161 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsqlLOBUnlink_internal()
1163 if (1 == lo_unlink(H->server, oid)) { in pgsqlLOBUnlink_internal()
1182 pdo_pgsql_db_handle *H; in pgsqlGetNotify_internal() local
1214 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsqlGetNotify_internal()
1216 if (!PQconsumeInput(H->server)) { in pgsqlGetNotify_internal()
1221 pgsql_notify = PQnotifies(H->server); in pgsqlGetNotify_internal()
1224 php_pollfd_for_ms(PQsocket(H->server), PHP_POLLREADABLE, (int)ms_timeout); in pgsqlGetNotify_internal()
1226 if (!PQconsumeInput(H->server)) { in pgsqlGetNotify_internal()
1231 pgsql_notify = PQnotifies(H->server); in pgsqlGetNotify_internal()
1267 pdo_pgsql_db_handle *H; in pgsqlGetPid_internal() local
1274 H = (pdo_pgsql_db_handle *)dbh->driver_data; in pgsqlGetPid_internal()
1276 RETURN_LONG(PQbackendPID(H->server)); in pgsqlGetPid_internal()
1298 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in PHP_METHOD() local
1300 pdo_pgsql_cleanup_notice_callback(H); in PHP_METHOD()
1303 H->notice_callback = emalloc(sizeof(zend_fcall_info_cache)); in PHP_METHOD()
1304 zend_fcc_dup(H->notice_callback, &fcc); in PHP_METHOD()
1330 pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; in pdo_pgsql_set_attr() local
1337 H->emulate_prepares = bval; in pdo_pgsql_set_attr()
1343 H->disable_prepares = bval; in pdo_pgsql_set_attr()
1349 H->default_fetching_laziness = !bval; in pdo_pgsql_set_attr()
1378 pdo_pgsql_db_handle *H; in pdo_pgsql_handle_factory() local
1385 H = pecalloc(1, sizeof(pdo_pgsql_db_handle), dbh->is_persistent); in pdo_pgsql_handle_factory()
1386 dbh->driver_data = H; in pdo_pgsql_handle_factory()
1393 H->einfo.errcode = 0; in pdo_pgsql_handle_factory()
1394 H->einfo.errmsg = NULL; in pdo_pgsql_handle_factory()
1426 H->server = PQconnectdb(ZSTR_VAL(conn_str.s)); in pdo_pgsql_handle_factory()
1427 H->lob_streams = (HashTable *) pemalloc(sizeof(HashTable), dbh->is_persistent); in pdo_pgsql_handle_factory()
1428 zend_hash_init(H->lob_streams, 0, NULL, NULL, 1); in pdo_pgsql_handle_factory()
1439 if (PQstatus(H->server) != CONNECTION_OK) { in pdo_pgsql_handle_factory()
1444 PQsetNoticeProcessor(H->server, _pdo_pgsql_notice, (void *)dbh); in pdo_pgsql_handle_factory()
1446 H->attached = 1; in pdo_pgsql_handle_factory()
1447 H->pgoid = -1; in pdo_pgsql_handle_factory()