Qore pgsql Module  2.4.1
PostgreSQL Functions

Functions

hash Qore::Pgsql::pgsql_bind (softint type, any 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 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,
any  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
typethe type code for the PostgreSQL type to bind
valuethe 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));
Exceptions
PGSQL-BIND-ERRORif the type argument is 0 this exception is raised

◆ pgsql_bind_array()

hash Qore::Pgsql::pgsql_bind_array ( *softlist  value)

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

Code Flags:
CONSTANT
Parameters
valuethe list to bind as an array
Returns
A hash that allows the value to be bound as an array
Since
pgsql 2.4