Chinaunix首页 | 论坛 | 博客
  • 博客访问: 818679
  • 博文数量: 756
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 4980
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-13 14:40
文章分类

全部博文(756)

文章存档

2011年(1)

2008年(755)

我的朋友

分类:

2008-10-13 16:11:14

SOCI is a very simple library for C++ programmers that makes the illusion of embedding SQL queries in regular C++ code, staying entirely within the Standard C++.
The idea is to provide C++ programmers (including those who are learning) a way to access SQL databases in the most natural and intuitive way. If you find existing libraries too difficult for your needs or just distracting, SOCI can be a good choice.

The motivating code example for the SQL query that is supposed to retrieve a single row is:

int id = ...;
string name;
int salary;

sql << "select name, salary "
    << "from person "
    << "where id = " << id,
    into(name), into(salary);


(No, there is no magic. Yes, it works.)

At the beginning, the SOCI library supported only Oracle databases through the OCI interface (hence the name).
This is also what you can already use (), tested with g++ (various versions) and MS Visual C++ 7.1.

Now, the intent of this project is to create the whole collection of free libraries for different databases, reusing the syntax ideas developed in the original SOCI library. The set of features is also extending.

If you know how to access other database servers using their native libraries (PostgreSQL, MySQL, etc.), you can take part in the SOCI project by porting existing code. In the majority of cases it should be enough to just replace existing OCI calls with what is required by other target servers.

If you are interested in participating, please contact the .
The latest and experimental version of the code is always available via .

To meet other users, please consider subscribing to the .

Feel invited!

--------------------next---------------------

阅读(596) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~