|
'Prepared' SQL Functions | wb_psql_prepare |
Parameters in a SQL statement are marked with a question mark ? (unlike the parameters in SQL statements executed by the wb_exec function). Parameters can be IN, OUT and INOUT. You can pass the parameter list to the wb_psql_execute function. The IN and INOUT parameter values are passed to the SQL Server, the SQL statement is executed and the OUT and INOUT parameter values are read and written to the specified PHP variables.
The SQL statement parameters can be passed either as parameters in the wb_psql_execute function, or you can pass the IN parameter values with the wb_psql_send_param function and read the OUT parameter values with the wb_psql_get_out_param function.
The value of the INOUT parameter must be passed to the SQL statement (as the IN parameters) and must be read (as the OUT parameters).
If the NULL value is passed for any IN parameter type, the SQL Server will receive the NULL value of the corresponding database type.
IN parameter type (db type) | allowed PHP values |
BOOLEAN | boolean type values, or values that can be converted to this PHP type |
TINYINT, SMALLINT, INTEGER, BIGINT | int type values, or values that can be converted to this PHP type; if the value exceeds the specified database type range, an error will occur |
NUMERIC, DECIMAL, REAL | float type values, or values that can be converted to this PHP type; if the value exceeds the specified database type range, an error will occur |
CHAR(N), CLOB | string type values, or values that can be converted to this PHP type |
NCHAR(N), NCLOB |
string type values, or that can be converted to this PHP type; moreover:
The passed value will be sent to the SQL Server after it is converted to UCS-2 coding, however the original PHP value is unaffected. |
DATE |
|
TIME |
Value of the string type, or value that can be converted to this type; the string must be a valid notation of a TIME type constant according to the 602SQL API Str2time function. |
TIMESTAMP |
|
The NULL value will always return the PHP value NULL.
OUT parameter type (database type) | PHP value |
BOOLEAN | PHP type boolean |
Integer types up to 32-bits (e.g. TINYINT, SMALLINT and INTEGER) | PHP type int |
BIGINT | If this value can be converted to a 32-bit int type, then it will be returned as a value of this type, otherwise it will return float (however in this case, number accuracy will be affected). |
NUMERIC, DECIMAL, REAL | PHP type float |
CHAR(N), CLOB | PHP type string |
NCHAR(N), NCLOB | PHP type string; the return string will be in UTF-8 |
DATE | PHP type int; the return number is the time of the first second (e.g. 00:00) of that day, that is represented by the DATE type value |
TIME | PHP type string; the return string will contain the given time notation |
TIMESTAMP | PHP type int; the return string will be the Unix time of the time instant represented by the given TIMESTAMP type value |
BINARY(N), BLOB |
PHP type string; each byte of the binary value will be represented with two characters, that represent the hexadecimal notation of the given byte (e.g. the byte with ASCII code 32 (decadic) will be represented with the "20" substring; the byte with ASCII code 13 (decadic) will be represented with the substring "0d" |
'Prepared' SQL Functions | wb_psql_prepare |