C++的数据库持久层框架 LiteSQL

jopen 13年前
     <p>LiteSQL 是一个C++的数据库持久层框架,支持 SQLite3、MySQL和PostgreSQL数据库。</p>    <ul>     <li>SQLite3, PostgreSQL, MySQL and Oracle-backend support</li>     <li>C++ object persistence (store, update, retrieve) </li>     <li>relational operations (filtering, ordering, referencing other objects)</li>     <li>automatic database structure maintenance (creates, updates and drops tables/indices behind the scenes)</li>     <li>C++ template based database API -> no SQL queries by hand</li>    </ul>    <p>示例代码:</p>    <pre class="brush:xml; toolbar: true; auto-links: false;"><?xml version="1.0"?> <!DOCTYPE database SYSTEM "litesql.dtd"> <database name="PersonDatabase">     <object name="Person">         <field name="name" type="string"/>     </object> </database></pre>    <pre class="brush:java; toolbar: true; auto-links: false;">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</pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1328450327655" target="_blank">http://www.open-open.com/lib/view/home/1328450327655</a></p>    <p></p>