Qore pgsql Module: PostgreSQL Functions

| Qore pgsql Module 3.1.1

Modules | Namespaces | Functions
PostgreSQL Functions
Collaboration diagram for PostgreSQL Functions:

## Modules
| Option Constangs for the pgsql Module
| Type Constants for pgsql_bind()

## Namespaces
namespace | Qore::Pgsql
| Pgsql namespace.

## Functions
hash | Qore::Pgsql::pgsql_bind (softint type, auto value)
| Creates a hash data structure understood by the pgsql DBI driver when binding values in SQL queries that allows programmers to directly specify the PostgreSQL data type for the bind. More...
hash | Qore::Pgsql::pgsql_bind_array (*softlist< auto > value)
| Creates a data structure understood by the pgsql DBI driver when binding array values in SQL queries. More...

## Detailed Description

## Function Documentation

## ◆ pgsql_bind()

hash Qore::Pgsql::pgsql_bind | ( | softint | type,
|  | auto | value
| ) |  |

Creates a hash data structure understood by the pgsql DBI driver when binding values in SQL queries that allows programmers to directly specify the PostgreSQL data type for the bind.

Use the Type Constants for pgsql_bind() to specify the PostgreSQL data type for the bind. If the value to bind is `NOTHING` or `NULL`, a `NULL` will be bound as the value, regardless of the PostgreSQL type code provided as the first argument.

Code Flags:
  RET_VALUE_ONLY

Parameters

  type | the type code for the PostgreSQL type to bind
  value | the value to bind

Returns
  The hash returned by the function encodes the desired PostgreSQL type for the bind and the value for binding in the `"^pgtype^"` and `"^value^"` keys

Example:
  # we use pgsql_bind() to bind a money type by value, otherwise the server would raise an error
  my float $amount = 400.56;
  my *hash $results = $db.select("select * from table where amount > %v", pgsql_bind(PG_TYPE_CASH, $amount));
  Qore::Pgsql::PG_TYPE_CASH
  const PG_TYPE_CASH
  defines a bind for the CASHOID type
  Definition: ql_pgsql.dox.h:108
  Qore::Pgsql::pgsql_bind
  hash pgsql_bind(softint type, auto value)
  Creates a hash data structure understood by the pgsql DBI driver when binding values in SQL queries t...

Exceptions

  PGSQL-BIND-ERROR | if the type argument is 0 this exception is raised

## ◆ pgsql_bind_array()

hash Qore::Pgsql::pgsql_bind_array | ( | *softlist< auto > | value | ) |

Creates a data structure understood by the pgsql DBI driver when binding array values in SQL queries.

Code Flags:
  CONSTANT

Parameters

  value | the list to bind as an array

Returns
  A hash that allows the value to be bound as an array

Since
  pgsql 2.4