Lines Matching refs:querystr

1634 	smart_str querystr = {0};  in PHP_FUNCTION()  local
1635 smart_str_appends(&querystr, "select relname from pg_class where oid="); in PHP_FUNCTION()
1636 smart_str_append_unsigned(&querystr, oid); in PHP_FUNCTION()
1637 smart_str_0(&querystr); in PHP_FUNCTION()
1639 PGresult *tmp_res = PQexec(pg_result->conn, ZSTR_VAL(querystr.s)); in PHP_FUNCTION()
1640 smart_str_free(&querystr); in PHP_FUNCTION()
4258 smart_str querystr = {0}; in php_pgsql_meta_data() local
4280 smart_str_appends(&querystr, in php_pgsql_meta_data()
4290 smart_str_appends(&querystr, in php_pgsql_meta_data()
4301 smart_str_appendl(&querystr, escaped, new_len); in php_pgsql_meta_data()
4305 smart_str_appends(&querystr, "' AND n.nspname = '"); in php_pgsql_meta_data()
4309 smart_str_appendl(&querystr, escaped, new_len); in php_pgsql_meta_data()
4313 smart_str_appends(&querystr, "' ORDER BY a.attnum;"); in php_pgsql_meta_data()
4314 smart_str_0(&querystr); in php_pgsql_meta_data()
4317 pg_result = PQexec(pg_link, ZSTR_VAL(querystr.s)); in php_pgsql_meta_data()
4320 smart_str_free(&querystr); in php_pgsql_meta_data()
4324 smart_str_free(&querystr); in php_pgsql_meta_data()
5249 static bool do_exec(smart_str *querystr, ExecStatusType expect, PGconn *pg_link, zend_ulong opt) /*… in do_exec() argument
5252 if (PQsendQuery(pg_link, ZSTR_VAL(querystr->s))) { in do_exec()
5258 pg_result = PQexec(pg_link, ZSTR_VAL(querystr->s)); in do_exec()
5272 static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const zend_string *table) … in build_tablename() argument
5279 smart_str_appendl(querystr, ZSTR_VAL(table), len); in build_tablename()
5282 smart_str_appends(querystr, escaped); in build_tablename()
5290 smart_str_appendc(querystr, '.'); in build_tablename()
5291 smart_str_appendl(querystr, after_dot, len); in build_tablename()
5294 smart_str_appendc(querystr, '.'); in build_tablename()
5295 smart_str_appends(querystr, escaped); in build_tablename()
5308 smart_str querystr = {0}; in php_pgsql_insert() local
5318 smart_str_appends(&querystr, "INSERT INTO "); in php_pgsql_insert()
5319 build_tablename(&querystr, pg_link, table); in php_pgsql_insert()
5320 smart_str_appends(&querystr, " DEFAULT VALUES"); in php_pgsql_insert()
5334 smart_str_appends(&querystr, "INSERT INTO "); in php_pgsql_insert()
5335 build_tablename(&querystr, pg_link, table); in php_pgsql_insert()
5336 smart_str_appends(&querystr, " ("); in php_pgsql_insert()
5345 smart_str_appends(&querystr, tmp); in php_pgsql_insert()
5348 smart_str_append(&querystr, fld); in php_pgsql_insert()
5350 smart_str_appendc(&querystr, ','); in php_pgsql_insert()
5352 ZSTR_LEN(querystr.s)--; in php_pgsql_insert()
5353 smart_str_appends(&querystr, ") VALUES ("); in php_pgsql_insert()
5365 smart_str_appendc(&querystr, '\''); in php_pgsql_insert()
5366 smart_str_appendl(&querystr, tmp, new_len); in php_pgsql_insert()
5367 smart_str_appendc(&querystr, '\''); in php_pgsql_insert()
5370 smart_str_append(&querystr, Z_STR_P(val)); in php_pgsql_insert()
5374 smart_str_append_long(&querystr, Z_LVAL_P(val)); in php_pgsql_insert()
5377 smart_str_appendl(&querystr, buf, snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val))); in php_pgsql_insert()
5380 smart_str_appendl(&querystr, "NULL", sizeof("NULL")-1); in php_pgsql_insert()
5386 smart_str_appendc(&querystr, ','); in php_pgsql_insert()
5389 ZSTR_LEN(querystr.s)--; in php_pgsql_insert()
5390 smart_str_appends(&querystr, ");"); in php_pgsql_insert()
5394 smart_str_0(&querystr); in php_pgsql_insert()
5397 do_exec(&querystr, PGRES_COMMAND_OK, pg_link, (opt & PGSQL_CONV_OPTS))) { in php_pgsql_insert()
5407 *sql = querystr.s; in php_pgsql_insert()
5410 smart_str_free(&querystr); in php_pgsql_insert()
5508 static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, HashTable *ht, int … in build_assignment_string() argument
5520 smart_str_appends(querystr, tmp); in build_assignment_string()
5523 smart_str_append(querystr, fld); in build_assignment_string()
5527 smart_str_appends(querystr, " IS "); in build_assignment_string()
5529 smart_str_appendc(querystr, '='); in build_assignment_string()
5537 smart_str_appendc(querystr, '\''); in build_assignment_string()
5538 smart_str_appendl(querystr, tmp, new_len); in build_assignment_string()
5539 smart_str_appendc(querystr, '\''); in build_assignment_string()
5542 smart_str_append(querystr, Z_STR_P(val)); in build_assignment_string()
5546 smart_str_append_long(querystr, Z_LVAL_P(val)); in build_assignment_string()
5550 …smart_str_appendl(querystr, buf, MIN(snprintf(buf, sizeof(buf), "%F", Z_DVAL_P(val)), sizeof(buf) … in build_assignment_string()
5554 smart_str_appendl(querystr, "NULL", sizeof("NULL")-1); in build_assignment_string()
5560 smart_str_appendl(querystr, pad, pad_len); in build_assignment_string()
5562 if (querystr->s) { in build_assignment_string()
5563 ZSTR_LEN(querystr->s) -= pad_len; in build_assignment_string()
5574 smart_str querystr = {0}; in php_pgsql_update() local
5603 smart_str_appends(&querystr, "UPDATE "); in php_pgsql_update()
5604 build_tablename(&querystr, pg_link, table); in php_pgsql_update()
5605 smart_str_appends(&querystr, " SET "); in php_pgsql_update()
5607 if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(var_array), 0, ",", 1, opt)) in php_pgsql_update()
5610 smart_str_appends(&querystr, " WHERE "); in php_pgsql_update()
5612 …if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")… in php_pgsql_update()
5615 smart_str_appendc(&querystr, ';'); in php_pgsql_update()
5616 smart_str_0(&querystr); in php_pgsql_update()
5618 if ((opt & PGSQL_DML_EXEC) && do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt)) { in php_pgsql_update()
5628 *sql = querystr.s; in php_pgsql_update()
5631 smart_str_free(&querystr); in php_pgsql_update()
5685 smart_str querystr = {0}; in php_pgsql_delete() local
5706 smart_str_appends(&querystr, "DELETE FROM "); in php_pgsql_delete()
5707 build_tablename(&querystr, pg_link, table); in php_pgsql_delete()
5708 smart_str_appends(&querystr, " WHERE "); in php_pgsql_delete()
5710 …if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")… in php_pgsql_delete()
5713 smart_str_appendc(&querystr, ';'); in php_pgsql_delete()
5714 smart_str_0(&querystr); in php_pgsql_delete()
5716 if ((opt & PGSQL_DML_EXEC) && do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt)) { in php_pgsql_delete()
5725 *sql = querystr.s; in php_pgsql_delete()
5728 smart_str_free(&querystr); in php_pgsql_delete()
5823 smart_str querystr = {0}; in php_pgsql_select() local
5846 smart_str_appends(&querystr, "SELECT * FROM "); in php_pgsql_select()
5847 build_tablename(&querystr, pg_link, table); in php_pgsql_select()
5848 smart_str_appends(&querystr, " WHERE "); in php_pgsql_select()
5850 …if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")… in php_pgsql_select()
5853 smart_str_appendc(&querystr, ';'); in php_pgsql_select()
5854 smart_str_0(&querystr); in php_pgsql_select()
5856 pg_result = PQexec(pg_link, ZSTR_VAL(querystr.s)); in php_pgsql_select()
5861 php_error_docref(NULL, E_NOTICE, "Failed to execute '%s'", ZSTR_VAL(querystr.s)); in php_pgsql_select()
5868 *sql = querystr.s; in php_pgsql_select()
5871 smart_str_free(&querystr); in php_pgsql_select()