Sqlite   发布时间:2022-05-22  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Sqlite3封装类:easysqlite大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

感谢Piotr.Zagawa大神,现在可以很简单地连接上sqlite3数据库了:

传送门:http://code.google.com/p/easysqlite/

使用example:(用VS2010直接有解决方案,更快捷:)

@H_403_9@//@R_404_5552@ table structureFIEld deFinition_tbPerson[] = { FIEld(FIELD_KEY),FIEld("fname",type_text,flag_not_null),FIEld("lname",FIEld("birthdate",type_timE),FIEld(DEFinitioN_END),};//@R_404_5552@ database objectsql::Database db;try{ //open database file db.open("test.db"); //@R_404_5552@ table object table tbPerson(db.getHandle(),"person",deFinition_tbPerson); //remove table from database if exists if (tbPerson.exists()) tbPerson.remove(); //create new table tbPerson.create(); //@R_404_5552@ new record Record record(tbPerson.fIElds()); //set record data record.setString("fname","Jan"); record.setString("lname","Kowalski"); record.setTime("birthdate",time::Now()); //add 10 records for (int index = 0; index < 10; index++) tbPerson.addRecord(&record); //SELEct record to update if (Record* record = tbperson.getRecordByKeyID(7)) { record->setString("fname","Frank"); record->setString("lname","Sinatra"); record->setNull("birthdate"); tbPerson.updateRecord(record); } //load all records tbPerson.open(); //List loaded records for (int index = 0; index < tbPerson.recordCount(); index++) if (Record* record = tbperson.getRecord(indeX)) sql::log(record->toString()); sql::log(""); sql::log("ALL OK");} catch (Exception E) { printf("ERROR: %s\r\n",e.msg().c_str());}

大佬总结

以上是大佬教程为你收集整理的Sqlite3封装类:easysqlite全部内容,希望文章能够帮你解决Sqlite3封装类:easysqlite所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: