This is in the Public Domain.
- Wrapper classes of SQLite
- Use SQLite with STL
sqliteDatabase db;
db.open(filename);
sqliteDatabase db(filename);
execute
andquery
functions are separated.execute
is used forINSERT
orUPDATE
, etc...query
is used forSELECT
, etc...
if (db.execute("INSERT INTO sqlitemp_table (name, age) VALUES ('Dylan Kim', 30)"))
std::cout << "Succeeded" << std::endl;
else
std::cout << "Failed" << std::endl;
sqliteDatabase::rowset_ptr prs = db.query("SELECT * FROM sqlitemp_table");
if (prs.get() && db.good())
{
sqliteColumnSet cs = prs->column();
int nSize = cs.size();
for (int i = 0; i < nSize; i++)
std::cout << cs.at(i).name() << "\t";
std::cout << std::endl;
do
{
cs = prs->column();
for (int i = 0; i < nSize; i++)
std::cout << cs.at(i) << "\t";
std::cout << std::endl;
} while (prs->to_next());
}