UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

SQLBindCol Syntax status = SQLBindCol (statement.env, col#, data.type, column) Note: This function is case-sensitive. If you want it to be case-insensitive, you must compile your programs using the BASIC command with the -i option. Description Use this function to tell UniData BCI where to return the results of an SQLFetch call. SQLBindCol defines the name of the variable (column) to contain column results retrieved by SQLFetch, and specifies the data conversion (data.type) on the fetched data. SQLBindCol has no effect until SQLFetch is used. Normally you call SQLBindCol once for each column of data in the result set. When SQLFetch is issued, data is moved from the result set at the data source and put into the variables specified in the SQLBindCol call, overwriting existing variable contents. Data is converted from the SQL data type at the data source to the UniBasic data type requested by the SQLBindCol call, if possible. If data cannot be converted to data.type, an error occurs. Values are returned only for bound columns. Unbound columns are ignored and are not accessible. For example, if a SELECT command returns three columns, but SQLBindCol was called for only two columns, data from the third column is not accessible to your program. If you bind more variables than there are columns in the result set, an error is returned. If you bind no columns and an SQLFetch is issued, the cursor advances to the next row of results. You need not use SQLBindCol with SQL statements that do not produce result sets. 1-786 UniBasic Commands Reference

Parameters The following table describes each parameter of the syntax. Parameter Description statement.env SQL statement environment of the executed SQL statement. col# Column number of result data, starting at 1. This value must be from 1 to the number of columns returned in an operation. data.type BASIC data type into which to convert the incoming data. Possible values are the following: SQL.B.CHAR – Character string data. SQL.B.BINARY – Bit string (raw) data. SQL.B.NUMBER – Numeric data (integer or double). SQL.B.DEFAULT – SQL data type determines the BASIC data type. SQL.B.INTDATE – UniData date in internal format. SQL.B.INTTIME – UniData time in internal format. column Variable that will contain column results obtained with SQLFetch. SQLBindCol Parameters Return Values The following table describes the return values of the SQLBindCol function. Return Value Description 0 SQL.SUCCESS −1 SQL.ERROR −2 SQL.INVALID.HANDLE SQLBindCol Return Values SQLBindCol 1-787

Parameters<br />

The following table describes each parameter of the syntax.<br />

Parameter Description<br />

statement.env SQL statement environment of the executed SQL statement.<br />

col# Column number of result data, starting at 1. This value must be from 1<br />

to the number of columns returned in an operation.<br />

data.type BASIC data type into which to convert the incoming data. Possible<br />

values are the following:<br />

SQL.B.CHAR – Character string data.<br />

SQL.B.BINARY – Bit string (raw) data.<br />

SQL.B.NUMBER – Numeric data (integer or double).<br />

SQL.B.DEFAULT – SQL data type determines the BASIC data type.<br />

SQL.B.INTDATE – UniData date in internal format.<br />

SQL.B.INTTIME – UniData time in internal format.<br />

column Variable that will contain column results obtained with SQLFetch.<br />

SQLBindCol Parameters<br />

Return Values<br />

The following table describes the return values of the SQLBindCol function.<br />

Return Value Description<br />

0 SQL.SUCCESS<br />

−1 SQL.ERROR<br />

−2 SQL.INVALID.HANDLE<br />

SQLBindCol Return Values<br />

SQLBindCol 1-787

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!