Skip to content

Instantly share code, notes, and snippets.

@kisom
Created January 30, 2020 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kisom/676f325603c4337b1ccdc8038b5fed23 to your computer and use it in GitHub Desktop.
Save kisom/676f325603c4337b1ccdc8038b5fed23 to your computer and use it in GitHub Desktop.
sqlitec++ example
bool
Tag(SQLite::Database &db, kortex::store::Tag tag)
{
if (!Metadata(db, tag.Meta)) {
return false;
}
SQLite::Statement q(db, "INSERT INTO tags (id, name, metadata) VALUES (?, ?, ?)");
q.bind(1, tag.ID());
q.bind(2, tag.Name());
q.bind(3, tag.Meta.ID());
try {
q.exec();
} catch (SQLite::Exception &) {
return false;
}
for (auto cell : tag.Cells) {
if (!Cell(db, cell, tag.ID())) {
return false;
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment