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

[Top]
Sql
Sql.Sql

# Class Sql.Sql

Description

  This class encapsulates a connection to an SQL server. It is a generic interface on top of the DB server specific implementations. That doesn't mean that there aren't plenty of server specific characteristics that still shine through, though.

  This class also serves as an interface guideline for the DB server specific connection classes.

  ## Untyped and typed mode

  The query results are returned in different ways depending on the query functions used: The `..typed_query` functions select typed mode, while the other query functions uses the older untyped mode.

  In untyped mode, all values except SQL NULL are returned as strings in their display representation, and SQL NULL is returned as zero.

  In typed mode, values are returned in pike native form where it works well. That means at least that SQL integer fields are returned as pike integers, floats as floats, SQL NULL as Val.null , and of course strings still as strings. The representation of other SQL types depend on the capabilities of the server specific backends. It's also possible that floats in some cases are represented in other ways if too much precision is lost in the conversion to pike floats.

Note

  For historical reasons, there may be server specific backends that operate differently from what is described here, e.g. some that return a bit of typed data in untyped mode.

Note

  Typed operation was not supported at all prior to Pike 7.8.363, and may not be supported for all databases.

Variable master_sql

  `object Sql.Sql.master_sql`

Description

  Server specific connection object used for the actual SQL queries.

Variable case_convert

  `int(0..1) Sql.Sql.case_convert`

Description

  Convert all field names in mappings to lower_case. Only relevant to databases which only implement big_query(), and use upper/mixed-case fieldnames (eg Oracle).

  `0` | No (default)
  `1` | Yes

Variable zero

  `protected ZeroWrapper Sql.Sql.zero`

Description

  Instance of Zerowrapper used by handle_extraargs() .