Method __builtin.Sql.Connection()->big_query()


Method big_query

variant .Result big_query(object|string q)

Description

Send an SQL query synchronously to the SQL-server and return the results in untyped mode.

Parameter q

Query to send to the SQL-server. This can either be a string with the query, or a previously compiled query (see compile_query()).

Returns

An Sql.Result object in untyped mode. This allows for having some more info about the result as well as processing the result in a streaming fashion, although the result itself wasn't obtained streamingly from the server.

Throws

Might throw an exception if the query fails. In some cases, the exception is delayed, because the database reports the error a (little) while after the query has already been started.

This prototype function is the base variant and is intended to be overloaded by actual drivers.

Note

Despite the name, this function is not only useful for "big" queries. It typically has less overhead than query also for ones that return only a few rows.

See also

query, streaming_query, big_typed_query, streaming_typed_query


Method big_query

variant .Result big_query(object|string q, mapping(string|int:mixed) bindings, void|__deprecated__(string) charset)

Description

Send an SQL query synchronously to the SQL-server and return the results in untyped mode.

Parameter q

Query to send to the SQL-server. This can either be a string with the query, or a previously compiled query (see compile_query()).

Parameter bindings

A mapping containing bindings of variables used in the query. A variable is identified by a colon (':') followed by a name or number. Each index in the mapping corresponds to one such variable, and the value for that index is substituted (quoted) into the query wherever the variable is used.

res = big_query("SELECT foo FROM bar WHERE gazonk=:baz",
                ([":baz":"value"]));

Binary values (BLOBs) may need to be placed in multisets.

Mapping entries prefixed with an asterisk ('*') are reserved for for database-specific query options (like eg QUERY_OPTION_CHARSET).

Returns

An Sql.Result object in untyped mode. This allows for having some more info about the result as well as processing the result in a streaming fashion, although the result itself wasn't obtained streamingly from the server.

Throws

Might throw an exception if the query fails. In some cases, the exception is delayed, because the database reports the error a (little) while after the query has already been started.

Calls the base variant of big_query() after having inserted the bindings into the query (using emulate_bindings()).

Drivers that actually support bindings should overload this variant in addition to the base variant.

Note

Despite the name, this function is not only useful for "big" queries. It typically has less overhead than query also for ones that return only a few rows.

Note

Support for database-specific query options was added in Pike 9.0.

See also

query, emulate_bindings, streaming_query, big_typed_query, streaming_typed_query


Method big_query

variant .Result big_query(object|string q, string|multiset|int|float|object extraarg, string|multiset|int|float|object|mapping ... extraargs)

Description

Send an SQL query synchronously to the SQL-server and return the results in untyped mode.

Parameter q

Query to send to the SQL-server. This can either be a string with the query, or a previously compiled query (see compile_query()).

Parameter extraarg
Parameter extraargs

Arguments as you would use in sprintf. They are automatically quoted. After the sprintf-style options a mapping with options may be specified.

res = query("select foo from bar where gazonk=%s","value");
Returns

An Sql.Result object in untyped mode. This allows for having some more info about the result as well as processing the result in a streaming fashion, although the result itself wasn't obtained streamingly from the server.

The default implementation normalizes q and extraargs to use the bindings mapping (via handle_extraargs()), and calls one of the other variants of big_query() with the result.

Note

Despite the name, this function is not only useful for "big" queries. It typically has less overhead than query also for ones that return only a few rows.

Note

Support for specifying an options mapping was added in Pike 9.0.

See also

query, handle_extraargs, streaming_query