From 93fd134a92fb50cc6e8a9b5db3d6f25e84e6fa10 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Thu, 9 Mar 2017 21:46:16 +0100 Subject: Fix bugs and warnings in qlite --- qlite/src/delete_builder.vala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'qlite/src/delete_builder.vala') diff --git a/qlite/src/delete_builder.vala b/qlite/src/delete_builder.vala index 5999dc40..679c8284 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) { - if (table != null) throw new DatabaseError.ILLEGAL_QUERY("cannot use from() multiple times."); + public DeleteBuilder from(Table table) throws DatabaseError { + if (this.table != null) throw new DatabaseError.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) { - if (selection != null) throw new DatabaseError.ILLEGAL_QUERY("selection was already done, but where() was called."); + public DeleteBuilder where(string selection, string[]? selection_args = null) throws DatabaseError { + if (this.selection != null) throw new DatabaseError.ILLEGAL_QUERY("selection was already done, but where() was called."); this.selection = selection; if (selection_args != null) { this.selection_args = new StatementBuilder.Field[selection_args.length]; @@ -56,7 +56,7 @@ public class DeleteBuilder : StatementBuilder { return this; } - public override Statement prepare() { + public override Statement prepare() throws DatabaseError { Statement stmt = db.prepare(@"DELETE FROM $table_name $(selection != null ? @"WHERE $selection": "")"); for (int i = 0; i < selection_args.length; i++) { selection_args[i].bind(stmt, i+1); @@ -64,7 +64,7 @@ public class DeleteBuilder : StatementBuilder { return stmt; } - public void perform() { + public void perform() throws DatabaseError { if (prepare().step() != DONE) { throw new DatabaseError.EXEC_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())"); } -- cgit v1.2.3-54-g00ecf