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

SQLExecDirect Syntax status = SQLExecDirect (statement.env, statement) 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 SQLExecDirect accepts an SQL statement or procedure call and delivers it to the data source for execution. It uses the current values of any SQL statement parameter markers. SQLExecDirect differs from SQLExecute in that it does not require a call to SQLPrepare. SQLExecDirect prepares the SQL statement or procedure call implicitly. Use SQLExecDirect when you do not need to execute the same SQL statement or procedure repeatedly. You can use parameter markers in the SQL statement or procedure call as long as you have resolved each marker with an SQLBindParameter call. After an SQLExecDirect call you can use SQLNumResultCols, SQLDescribeCol, SQLRowCount, or SQLColAttributes to get information about the resulting columns. You can use SQLNumResultCols to determine if the SQL statement or procedure call created a result set. If the executed SQL statement or procedure produces a set of results, you must use an SQLFreeStmt call with the SQL.CLOSE option before you execute another SQL statement or procedure call using the same SQL statement environment. The SQL.CLOSE option cancels any pending results still waiting at the data source. 1-810 UniBasic Commands Reference

Your application programs should not try to issue transaction control statements directly to the data source (for instance, by issuing a COMMIT statement with SQLExecDirect or SQLPrepare). Programs should use only UniBasic transaction control statements. UniData BCI issues the correct combination of transaction control statements and middleware transaction control function calls that are appropriate for the DBMS you are using. Trying to use SQLExecDirect to execute explicit transaction control statements on ODBC data sources can cause unexpected results and errors. When SQLExecDirect calls a procedure, it does not begin a transaction. If a transaction is active when a procedure is called, the current transaction nesting level is maintained. Note: If you execute a stored procedure or enter a command batch with multiple SELECT statements, the results of only the first SELECT statement are returned. Parameters The following table describes each parameter of the syntax. Parameter Description statement.env SQL statement environment from a previous SQLAllocStmt. SQLExecDirect Input Variables SQLExecDirect 1-811

Your application programs should not try to issue transaction control statements<br />

directly to the data source (for instance, by issuing a COMMIT statement with<br />

SQLExecDirect or SQLPrepare). Programs should use only <strong>UniBasic</strong> transaction<br />

control statements. UniData BCI issues the correct combination of transaction<br />

control statements and middleware transaction control function calls that are appropriate<br />

for the DBMS you are using. Trying to use SQLExecDirect to execute explicit<br />

transaction control statements on ODBC data sources can cause unexpected results<br />

and errors.<br />

When SQLExecDirect calls a procedure, it does not begin a transaction. If a transaction<br />

is active when a procedure is called, the current transaction nesting level is<br />

maintained.<br />

Note: If you execute a stored procedure or enter a command batch with multiple<br />

SELECT statements, the results of only the first SELECT statement are returned.<br />

Parameters<br />

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

Parameter Description<br />

statement.env SQL statement environment from a previous SQLAllocStmt.<br />

SQLExecDirect Input Variables<br />

SQLExecDirect 1-811

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

Saved successfully!

Ooh no, something went wrong!