OTL执行SQL语句的两种方式
发布日期:2021-11-15 14:58:02 浏览次数:38 分类:技术文章

本文共 770 字,大约阅读时间需要 2 分钟。

OTL执行SQL语句的两种方式

1、使用otl_cursor::direct_exec(...)函数直接执行sql语句

例如otl_cursor::direct_exec(db,"create table ccc(aa int);");

 

2、使用otl_stream流执行sql语句使用步骤如下

otl_stream otlCur(1,(const char*)str,db);//或者otl_stream otlCur;otlCur.open(1,(const char*)str,db);//有点像fstream使用方式

2.1使用otl_stream流查询表以后把数据取出来的例子如下

int OTLSelete(otl_connect &db){    try{            // const char * str = "select aa from ccc where aa < 7 order by aa asc;";            // const char * str = "select * from ccc;";            const char * str = "select aa as ddd from ccc where aa < 7 ";            otl_stream otlCur(1,(const char*)str,db);            cout << " select result begin"<
name<
>aa; // otlCur>>p; cout <<" aa ="<< aa <

有一篇不错的用法  

C++交流群:585225803

转载地址:https://blog.csdn.net/qq_39742146/article/details/87878715 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:OTL中事务处理
下一篇:使用OTL连接数据库

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年03月23日 00时10分51秒