aboutsummaryrefslogtreecommitdiff
path: root/qlite/src/database.vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-08-26 00:05:36 +0200
committerMarvin W <git@larma.de>2017-08-27 14:52:10 +0200
commitad033beea82a4ba20da71220966b80d5f674428f (patch)
tree91d18a157b78f09ffb0c502c431a7de720d925c6 /qlite/src/database.vala
parent8533ba645046e03378d7b9fd3048f15c05f332f7 (diff)
downloaddino-ad033beea82a4ba20da71220966b80d5f674428f.tar.gz
dino-ad033beea82a4ba20da71220966b80d5f674428f.zip
qlite: add upsert support
Diffstat (limited to 'qlite/src/database.vala')
-rw-r--r--qlite/src/database.vala7
1 files changed, 6 insertions, 1 deletions
diff --git a/qlite/src/database.vala b/qlite/src/database.vala
index cc46ee21..ac53d51c 100644
--- a/qlite/src/database.vala
+++ b/qlite/src/database.vala
@@ -41,6 +41,7 @@ public class Database {
}
this.tables = tables;
start_migration();
+ if (debug) db.trace((message) => print(@"Qlite trace: $message\n"));
}
public void ensure_init() throws DatabaseError {
@@ -114,6 +115,11 @@ public class Database {
return new UpdateBuilder(this, table);
}
+ public UpsertBuilder upsert(Table table) throws DatabaseError {
+ ensure_init();
+ return new UpsertBuilder(this, table);
+ }
+
public UpdateBuilder update_named(string table) throws DatabaseError {
ensure_init();
return new UpdateBuilder.for_name(this, table);
@@ -131,7 +137,6 @@ public class Database {
internal Statement prepare(string sql) throws DatabaseError {
ensure_init();
- if (debug) print(@"prepare: $sql\n");
Sqlite.Statement statement;
if (db.prepare_v2(sql, sql.length, out statement) != OK) {
throw new DatabaseError.PREPARE_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())");