diff options
author | fiaxh <git@mx.ax.lt> | 2017-10-28 23:48:07 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-10-31 15:41:45 +0100 |
commit | b9df78e4494879752e9e68dcc5d54e03fffe9467 (patch) | |
tree | d1c74fde4aedea42773bc411c557f2184003defa /qlite/src/insert_builder.vala | |
parent | d9b91206c0291fa8aa58df572292784a4f8ff878 (diff) | |
download | dino-b9df78e4494879752e9e68dcc5d54e03fffe9467.tar.gz dino-b9df78e4494879752e9e68dcc5d54e03fffe9467.zip |
Move DatabaseError handling into Qlite
Diffstat (limited to 'qlite/src/insert_builder.vala')
-rw-r--r-- | qlite/src/insert_builder.vala | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/qlite/src/insert_builder.vala b/qlite/src/insert_builder.vala index 91388f69..b66464a6 100644 --- a/qlite/src/insert_builder.vala +++ b/qlite/src/insert_builder.vala @@ -45,13 +45,13 @@ public class InsertBuilder : StatementBuilder { return this; } - public InsertBuilder value_null<T>(Column<T> column) throws DatabaseError { - if (column.not_null) throw new DatabaseError.ILLEGAL_QUERY(@"Can't set non-null column $(column.name) to null"); + public InsertBuilder value_null<T>(Column<T> column) { + if (column.not_null) error("Qlite Error: ILLEGAL QUERY: Can't set non-null column %s to null", column.name); fields += new NullField<T>(column); return this; } - internal override Statement prepare() throws DatabaseError { + internal override Statement prepare() { string fields_text = ""; string value_qs = ""; for (int i = 0; i < fields.length; i++) { @@ -72,13 +72,13 @@ public class InsertBuilder : StatementBuilder { return stmt; } - public int64 perform() throws DatabaseError { + public int64 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()); } return db.last_insert_rowid(); } } -}
\ No newline at end of file +} |