A SQL statement / PL/SQL block / stored procedure call is considered to be constant if it does not have any bind variables. OTL 4.0 has a static (in class) function to execute constant statements.
Examples (Oracle)
otl_cursor::direct_exec (db, // connect object "create table test_tab(f1 number, f2 varchar2(30))" ); // create table
otl_cursor::direct_exec (db, // connect object "drop table test_tab", // SQL statement or PL/SQL block otl_exception::disabled // disable OTL exceptions, // in other words, ignore any // database error ); // drop table
Examples (ODBC, DB2-CLI)
otl_cursor::direct_exec (db, // connect object "create table test_tab(f1 numeric, f2 varchar(30))" ); // create table
otl_cursor::direct_exec (db, // connect object "drop table test_tab", // SQL statement or stored procedure call otl_exception::disabled // disable OTL exceptions, // in other words, ignore any // database error ); // drop table
otl_cursor is one of the OTL 4.0 internal classes. It is not recommended to use the OTL 4.0 low level classes and functions except for the direct_exec() because it is a special case and it will not be discontinued in the future releases of the OTL.
The direct_exec() function may return the following values of the long int datatype:
Here is an example of the direct_exec(), returning a row processed count:
long rpc=otl_cursor::direct_exec (db, // connect object "delete from test_tab where f1>=95" ); cout<<"Rows deleted: "<<rpc<<endl;
Copyright © 1996, 2001, Sergei Kuchin, email: [email protected], [email protected].
Permission to use, copy, modify and redistribute this document for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies.