LiteSQLC++的数据库持久层框架
LiteSQL 是一个C++的数据库持久层框架,支持 SQLite3、MySQL和PostgreSQL数据库。
示例代码:
<?xml version="1.0"?>
<!DOCTYPE database SYSTEM "litesql.dtd">
<database name="PersonDatabase">
<object name="Person">
<field name="name" type="string"/>
</object>
</database>
PersonDatabase db("sqlite3", "database=person.db");Person person(db); // construct Person, does not write anything to database
person.name = "Bob"; // assign values to fields
person.age = 20;
person.update(); // writes a new record to database
person.age = 21; // Bob got just older
person.update(); // updates old record
person.id = 100; // force internal identifier (id) to 100
person.update(); // updates old record
评论