| Extracted from Pike v7.8 release 866 at 2016-04-05.

[Top]
Sql
Sql.pgsql

# Method Sql.pgsql()->big_query()

Method big_query

  `Sql.pgsql_util.pgsql_result big_query(string query)`
  `Sql.pgsql_util.pgsql_result big_query(string query, mapping bindings)`

Description

  This is the only provided interface which allows you to query the database. If you wish to use the simpler Sql.Sql()->query() function, you need to use the Sql.Sql generic SQL-object.

  Bindings are supported natively straight across the network. Special bindings supported are:

  `":_cache" : int` | Forces caching on or off for the query at hand.
  `":_text" : int` | Forces text mode in communication with the database for queries on or off for the query at hand. Potentially more efficient than the default binary method for simple queries with small or no result sets. Note that this mode causes all but the first query result of a list of semicolon separated statements to be discarded.

Returns

  A Sql.pgsql_util.pgsql_result object (which conforms to the Sql.sql_result standard interface for accessing data). It is recommended to use Sql.Sql()->query() for simpler queries (because it is easier to handle, but stores all the result in memory), and Sql.Sql()->big_query() for queries you expect to return huge amounts of data (it's harder to handle, but fetches results on demand).

Note

  This function can raise exceptions.

Note

  This function supports multiple simultaneous queries (portals) on a single database connection. This is a feature not commonly supported by other database backends.

Note

  This function, by default, does not support multiple queries in one querystring. I.e. it allows for but does not require a trailing semicolon, but it simply ignores any commands after the first unquoted semicolon. This can be viewed as a limited protection against SQL-injection attacks. To make it support multiple queries in one querystring, use the :_text option.

See also

  big_typed_query() , Sql.Sql , Sql.sql_result , Sql.Sql()->query() , Sql.pgsql_util.pgsql_result