Created
January 30, 2020 15:33
-
-
Save kisom/676f325603c4337b1ccdc8038b5fed23 to your computer and use it in GitHub Desktop.
sqlitec++ example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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