SQLite C++ Wrapper开源项目

我要开发同款
匿名用户2009年07月21日
78阅读

技术信息

开源地址
https://github.com/jtv/libpqxx
授权协议
未知

作品详情

SQLiteC++Wrapper是一个C++语言对SQLite的最小封装包。

示例代码1:

#iclude<strig>#iclude<iostream>#iclude<stdexcept>usigamespacestd;#iclude"sqlite3x.hpp"usigamespacesqlite3x;itmai(void){  try{   sqlite3_coectioco("test.db");   itcout=co.executeit(    "selectcout(*)"    "fromsqlite_master"    "whereame='t_test';");   if(cout==0){     co.executeoquery(      "createtablet_test(umber,strig);");   }   sqlite3_trasactiotras(co);   {     sqlite3_commadcmd(co,      "isertitot_testvalues(?,?);");     cmd.bid(2,"foobar",6);     for(iti=0;i<10000;++i){      cmd.bid(1,i);      cmd.executeoquery();     }   }   //iftrasgoesoutofscope(duetoaexceptioor   //aythigelse)beforecalligcommit(),itwill   //automaticallyrollback()   tras.commit();  }  catch(exceptio&ex){   cerr<<"ExceptioOccured:"<<ex.what()<<edl;  }  retur0;}

示例代码2:

#iclude<iostream>#iclude<stdexcept>usigamespacestd;#iclude"sqlite3x.hpp"usigamespacesqlite3x;itmai(void){  try{   sqlite3_coectioco("test.db");    sqlite3_commadcmd(co,"select*fromt_test;");    sqlite3_readerreader=cmd.executereader();    while(reader.read()){     cout<<reader.getcolame(0)<<":"        <<reader.getit(0)<<edl;    }  }  catch(exceptio&ex){   cerr<<"ExceptioOccured:"<<ex.what()<<edl;  }  retur0;}

功能介绍

SQLite C++ Wrapper 是一个 C++ 语言对 SQLite 的最小封装包。 示例代码1: #include <string> #include <iostream> #inclu...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论