OTL翻译(9) --常量的SQL语句
生活随笔
收集整理的這篇文章主要介紹了
OTL翻译(9) --常量的SQL语句
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
常量的SQL語句
一個沒有綁定變量的SQL語句、SQL語句塊或是存儲過程就被稱為常量的SQL語句。OTL通過一個靜態的函數來執行這樣的SQL語句。
例如:
// static otl_cursor::direct_exec()
otl_cursor::direct_exec(db, // connect object"create table test_tab(f1 int, f2 varchar(30))"); // create table
otl_cursor::direct_exec(db, // connect object"drop table test_tab", // SQL statement or PL/SQL blockotl_exception::disabled // disable OTL exceptions,// in other words, ignore any// database error); // drop table// or otl_connect::direct_exec()
db.direct_exec // connect object ("create table test_tab(f1 int, f2 varchar(30))"); // create table
db.direct_exec // connect object ("drop table test_tab", // SQL statement or PL/SQL blockotl_exception::disabled // disable OTL exceptions,// in other words, ignore any// database error); // drop table// or otl_connect::operator<<(const char*)
db<<"create table test_tab(f1 number, f2 varchar2(30))";try{db<<"drop table test_tab""; // SQL statement or PL/SQL block }catch(otl_exception&){// ignore a database error
}
otl_cursor是OTL的一個內部類。它是對direct_exec()函數的一個底層類。因為以后版本該類可能不再對外提供,所以不建議使用。
下面這個例子為direct_exe()返回結果值的例子:
// static otl_cursor::direct_execlong rpc=otl_cursor::direct_exec(db, // connect object"delete from test_tab where f1>=95");cout<<"Rows deleted: "<<rpc<<endl;// or otl_connect:direct_execlong rpc=db.direct_exec // connect object("delete from test_tab where f1>=95");cout<<"Rows deleted: "<<rpc<<endl;
?
轉載于:https://www.cnblogs.com/fnlingnzb-learner/p/5903315.html
總結
以上是生活随笔為你收集整理的OTL翻译(9) --常量的SQL语句的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: webBroser获取cookie
- 下一篇: css text-align-last设