Lines Matching refs:pg_link
84 #define PQ_SETNONBLOCKING(pg_link, flag) PQsetnonblocking(pg_link, flag) argument
86 #define PQ_SETNONBLOCKING(pg_link, flag) 0 argument
2316 PGconn *pg_link; local
2324 …if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_…
5493 PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, zend_boo… argument
5541 new_len = PQescapeStringConn(pg_link, escaped, tmp_name2, strlen(tmp_name2), NULL);
5549 new_len = PQescapeStringConn(pg_link, escaped, tmp_name, strlen(tmp_name), NULL);
5559 pg_result = PQexec(pg_link, ZSTR_VAL(querystr.s));
5806 PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zv… argument
5813 assert(pg_link != NULL);
5824 if (php_pgsql_meta_data(pg_link, table_name, &meta, 0) == FAILURE) {
6055 …ZSTR_LEN(str) = PQescapeStringConn(pg_link, ZSTR_VAL(str), Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
6347 tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_P(val), Z_STRLEN_P(val), &to_len);
6433 escaped = PGSQLescapeIdentifier(pg_link, ZSTR_VAL(field), ZSTR_LEN(field));
6458 PGconn *pg_link; local
6473 …if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_…
6477 if (php_pgsql_flush_query(pg_link)) {
6481 if (php_pgsql_convert(pg_link, table_name, values, return_value, option) == FAILURE) {
6488 static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong opt) /* {{{ */ argument
6491 if (PQsendQuery(pg_link, ZSTR_VAL(querystr->s))) {
6498 pg_result = PQexec(pg_link, ZSTR_VAL(querystr->s));
6512 static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const char *table) /* {{{ … argument
6528 escaped = PGSQLescapeIdentifier(pg_link, token, len);
6539 escaped = PGSQLescapeIdentifier(pg_link, tmp, len);
6551 PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong … argument
6560 assert(pg_link != NULL);
6567 build_tablename(&querystr, pg_link, table);
6576 …if (php_pgsql_convert(pg_link, table, var_array, &converted, (opt & PGSQL_CONV_OPTS)) == FAILURE) {
6583 build_tablename(&querystr, pg_link, table);
6592 tmp = PGSQLescapeIdentifier(pg_link, ZSTR_VAL(fld), ZSTR_LEN(fld) + 1);
6612 new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
6646 do_exec(&querystr, PGRES_COMMAND_OK, pg_link, (opt & PGSQL_CONV_OPTS)) == 0) {
6673 PGconn *pg_link; local
6689 …if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_…
6693 if (php_pgsql_flush_query(pg_link)) {
6700 if (php_pgsql_insert(pg_link, table, values, option|PGSQL_DML_STRING, &sql) == FAILURE) {
6703 pg_result = PQexec(pg_link, ZSTR_VAL(sql));
6704 if ((PGG(auto_reset_persistent) & 2) && PQstatus(pg_link) != CONNECTION_OK) {
6706 PQreset(pg_link);
6707 pg_result = PQexec(pg_link, ZSTR_VAL(sql));
6714 status = (ExecStatusType) PQstatus(pg_link);
6722 PHP_PQ_ERROR("Query failed: %s", pg_link);
6730 pgsql_handle->conn = pg_link;
6740 } else if (php_pgsql_insert(pg_link, table, values, option, &sql) == FAILURE) {
6751 static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, HashTable *ht, int … argument
6764 tmp = PGSQLescapeIdentifier(pg_link, ZSTR_VAL(fld), ZSTR_LEN(fld) + 1);
6781 new_len = PQescapeStringConn(pg_link, tmp, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
6815 PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_a… argument
6821 assert(pg_link != NULL);
6836 …if (php_pgsql_convert(pg_link, table, var_array, &var_converted, (opt & PGSQL_CONV_OPTS)) == FAILU…
6841 …if (php_pgsql_convert(pg_link, table, ids_array, &ids_converted, (opt & PGSQL_CONV_OPTS)) == FAILU…
6848 build_tablename(&querystr, pg_link, table);
6851 if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(var_array), 0, ",", 1, opt))
6856 …if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")…
6862 if ((opt & PGSQL_DML_EXEC) && do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt) == 0) {
6889 PGconn *pg_link; local
6902 …if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_…
6906 if (php_pgsql_flush_query(pg_link)) {
6909 if (php_pgsql_update(pg_link, table, values, ids, option, &sql) == FAILURE) {
6921 PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong … argument
6927 assert(pg_link != NULL);
6939 …if (php_pgsql_convert(pg_link, table, ids_array, &ids_converted, (opt & PGSQL_CONV_OPTS)) == FAILU…
6946 build_tablename(&querystr, pg_link, table);
6949 …if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")…
6955 if ((opt & PGSQL_DML_EXEC) && do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt) == 0) {
6981 PGconn *pg_link; local
6994 …if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_…
6998 if (php_pgsql_flush_query(pg_link)) {
7001 if (php_pgsql_delete(pg_link, table, ids, option, &sql) == FAILURE) {
7049 PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_a… argument
7056 assert(pg_link != NULL);
7069 …if (php_pgsql_convert(pg_link, table, ids_array, &ids_converted, (opt & PGSQL_CONV_OPTS)) == FAILU…
7076 build_tablename(&querystr, pg_link, table);
7079 …if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")…
7085 pg_result = PQexec(pg_link, ZSTR_VAL(querystr.s));
7113 PGconn *pg_link; local
7126 …if ((pg_link = (PGconn *)zend_fetch_resource2(Z_RES_P(pgsql_link), "PostgreSQL link", le_link, le_…
7130 if (php_pgsql_flush_query(pg_link)) {
7134 if (php_pgsql_select(pg_link, table, ids, return_value, option, &sql) == FAILURE) {