OTL 4.0,无量纲SQL指令(2010.4.24更新)
来源:互联网 发布:吉林省水利造价软件 编辑:程序博客网 时间:2024/05/04 07:48
原文地址:http://otl.sourceforge.net/otl3_const_sql.htm
无量纲SQL指令
一个SQL指令/PL/SQL块/存储过程调用,如果没有绑定任何变量,则被认为是无量纲的。OTL4.0有一个用于执行无量纲指令的静态(在类中)函数。
示例
// 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 block
otl_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 block
otl_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是OTL4.0的一个内部类。除了direct_exec()这个特例,我们不推荐使用OTL4.0中低层次的类集和函数,因为在以后的版本将不会被支持。
函数direct_exec()可能会返回类型为long int的值:
· -1,数据库API返回一个错误并且otl_exceptions异常被禁止(在第二个参数设置为otl_exception::disabled)
· >=0,在SQL命令成功执行后.事实上只有在执行INSERT, UPDATE或者DELETE指令后,才会返回ROWS PROCESSED COUNT(RPC)。
下面是direct_exec()函数的一个例子,返回处理过的行数:
// static otl_cursor::direct_exec
long rpc=otl_cursor::direct_exec
(db, // connect object
"delete from test_tab where f1>=95"
);
cout<<"Rows deleted: "<<rpc<<endl;
// or otl_connect:direct_exec
long rpc=db.direct_exec // connect object
("delete from test_tab where f1>=95"
);
cout<<"Rows deleted: "<<rpc<<endl;
- OTL 4.0,无量纲SQL指令(2010.4.24更新)
- OTL 4.0, OTL类集(2010.4.23更新)
- OTL 4.0, OTL 数据流概念(2010.4.23更新)
- OTL 4.0绪论(2010.4.11更新)
- OTL 4.0, OTL 类
- OTL(4.0) Frequently Asked Questions经典问答(2010.4.10更新)
- OTL 4.0, OTL缓冲池
- OTL 4.0, OTL stream class
- OTL 4.0, OTL defined exceptions
- 传热学相关的无量纲数的物理意义
- OTL 4.0之OTL流的概念
- C++/OTL 4.0, OTL connect类
- OTL 4.0, Introduction
- OTL 4.0, Examples
- OTL 4.0介绍
- OTL 4.0,otl_exception类
- OTL 4.0, Introduction
- OTL 4.0 example
- 基于nalfs.note笔记之上. nALFS配置相关笔记(位于CD可引导Linux)
- net2.0中对config文件的操作方法总结
- 类与结构
- RHEL的系统服务
- DLL调用异常
- OTL 4.0,无量纲SQL指令(2010.4.24更新)
- WALMART 即将关闭其 DRM 服务器
- 对"继承和初始化"的思考
- web窗口打印
- 查找有多少个串口
- 衰落的摩托罗拉:中国的IT黄埔
- 操作DataGridView中的DataTable
- linux 下TFTP 配置
- 天学会Project 2007 当当网链接地址