aboutsummaryrefslogtreecommitdiff
path: root/qlite/src/row.vala
diff options
context:
space:
mode:
Diffstat (limited to 'qlite/src/row.vala')
-rw-r--r--qlite/src/row.vala12
1 files changed, 7 insertions, 5 deletions
diff --git a/qlite/src/row.vala b/qlite/src/row.vala
index de10751f..ed0552a0 100644
--- a/qlite/src/row.vala
+++ b/qlite/src/row.vala
@@ -53,6 +53,7 @@ public class Row {
}
public class RowIterator {
+ private Database db;
private Statement stmt;
public RowIterator.from_query_builder(QueryBuilder query) throws DatabaseError {
@@ -60,6 +61,7 @@ public class RowIterator {
}
public RowIterator(Database db, string sql, string[]? args = null) throws DatabaseError {
+ this.db = db;
this.stmt = db.prepare(sql);
if (args != null) {
for (int i = 0; i < args.length; i++) {
@@ -68,11 +70,11 @@ public class RowIterator {
}
}
- public Row? next_value() {
- if (stmt.step() == Sqlite.ROW) {
- return new Row(stmt);
- }
- return null;
+ public Row? next_value() throws DatabaseError {
+ int r = stmt.step();
+ if (r == Sqlite.ROW) return new Row(stmt);
+ if (r == Sqlite.DONE) return null;
+ throw new DatabaseError.EXEC_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())");
}
}