aboutsummaryrefslogtreecommitdiff
path: root/qlite/src/delete_builder.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-10-28 23:48:07 +0200
committerfiaxh <git@mx.ax.lt>2017-10-31 15:41:45 +0100
commitb9df78e4494879752e9e68dcc5d54e03fffe9467 (patch)
treed1c74fde4aedea42773bc411c557f2184003defa /qlite/src/delete_builder.vala
parentd9b91206c0291fa8aa58df572292784a4f8ff878 (diff)
downloaddino-b9df78e4494879752e9e68dcc5d54e03fffe9467.tar.gz
dino-b9df78e4494879752e9e68dcc5d54e03fffe9467.zip
Move DatabaseError handling into Qlite
Diffstat (limited to 'qlite/src/delete_builder.vala')
-rw-r--r--qlite/src/delete_builder.vala16
1 files changed, 8 insertions, 8 deletions
diff --git a/qlite/src/delete_builder.vala b/qlite/src/delete_builder.vala
index 5483b652..e7e3b784 100644
--- a/qlite/src/delete_builder.vala
+++ b/qlite/src/delete_builder.vala
@@ -16,8 +16,8 @@ public class DeleteBuilder : StatementBuilder {
base(db);
}
- public DeleteBuilder from(Table table) throws DatabaseError {
- if (this.table != null) throw new DatabaseError.ILLEGAL_QUERY("cannot use from() multiple times.");
+ public DeleteBuilder from(Table table) {
+ if (this.table != null) error("Qlite Error: ILLEGAL QUERY: cannot use from() multiple times.");
this.table = table;
this.table_name = table.name;
return this;
@@ -28,8 +28,8 @@ public class DeleteBuilder : StatementBuilder {
return this;
}
- public DeleteBuilder where(string selection, string[]? selection_args = null) throws DatabaseError {
- if (this.selection != "1") throw new DatabaseError.ILLEGAL_QUERY("selection was already done, but where() was called.");
+ public DeleteBuilder where(string selection, string[]? selection_args = null) {
+ if (this.selection != "1") error("selection was already done, but where() was called.");
this.selection = selection;
foreach (string arg in selection_args) {
this.selection_args += new StatementBuilder.StringField(arg);
@@ -43,7 +43,7 @@ public class DeleteBuilder : StatementBuilder {
return this;
}
- internal override Statement prepare() throws DatabaseError {
+ internal override Statement prepare() {
Statement stmt = db.prepare(@"DELETE FROM $table_name WHERE $selection");
for (int i = 0; i < selection_args.length; i++) {
selection_args[i].bind(stmt, i+1);
@@ -51,12 +51,12 @@ public class DeleteBuilder : StatementBuilder {
return stmt;
}
- public void perform() throws DatabaseError {
+ public void perform() {
if (prepare().step() != DONE) {
- throw new DatabaseError.EXEC_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())");
+ error(@"SQLite error: %d - %s", db.errcode(), db.errmsg());
}
}
}
-} \ No newline at end of file
+}