SQLite C++ Wrapper

程序名称:SQLite C++ Wrapper

授权协议: 未知

操作系统: 跨平台

开发语言: C/C++

SQLite C++ Wrapper 介绍

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

示例代码1:

#include <string>  
#include <iostream>  
#include <stdexcept>  
using namespace std;

#include "sqlite3x.hpp"  
using namespace sqlite3x;

int main(void) {  
   try {  
      sqlite3_connection con("test.db");

      int count = con.executeint(  
        "select count(*) "  
        "from sqlite_master "  
        "where name='t_test';");

      if(count == 0) {  
         con.executenonquery(  
            "create table t_test(number,string);");  
      }

      sqlite3_transaction trans(con);  
      {  
         sqlite3_command cmd(con,  
            "insert into t_test values(?,?);");  
         cmd.bind(2, "foobar", 6);

         for(int i = 0; i < 10000; ++i) {  
            cmd.bind(1, i);  
            cmd.executenonquery();  
         }  
      }

      // if trans goes out of scope (due to an exception or  
      // anything else) before calling commit(), it will  
      // automatically rollback()  
      trans.commit();  
   }  
   catch(exception &ex) {  
      cerr << "Exception Occured: " << ex.what() << endl;  
   }

   return 0;  
}

示例代码2:

#include <iostream>  
#include <stdexcept>  
using namespace std;

#include "sqlite3x.hpp"  
using namespace sqlite3x;

int main(void) {  
   try {  
      sqlite3_connection con("test.db");

       sqlite3_command cmd(con, "select * from t_test;");  
       sqlite3_reader reader = cmd.executereader();

       while(reader.read()) {  
          cout << reader.getcolname(0) << ": "  
               << reader.getint(0) << endl;  
       }  
   }  
   catch(exception &ex) {  
      cerr << "Exception Occured: " << ex.what() << endl;  
   }

   return 0;  
}

SQLite C++ Wrapper 官网

http://int64.org/projects/sqlite-c-wrapper

相关编程语言

SchemaCrawler提供一组用于增强标准JDBC Metadata的...
ER Master 是一个用于设计ER模型图的Eclipse插件。提...
Eclipse下用于画数据库ER图的插件,主要特性如下: ...
PowerDesigner 是Sybase的企业建模和设计解决方案,...
Mogwai ERDesigner NG是一个实体关系建模工具类似于...
Power*Architect 是一个数据建模工具,主要用在数据...