aboutsummaryrefslogtreecommitdiff
path: root/qlite/src/column.vala
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-03-09 21:46:16 +0100
committerMarvin W <git@larma.de>2017-03-10 17:33:27 +0100
commit93fd134a92fb50cc6e8a9b5db3d6f25e84e6fa10 (patch)
tree760dffada9b7d3515df5be306fe3a2ae9d848a64 /qlite/src/column.vala
parent9b8cf706d6b0ff83472af53c31b96c4c2f55f6b7 (diff)
downloaddino-93fd134a92fb50cc6e8a9b5db3d6f25e84e6fa10.tar.gz
dino-93fd134a92fb50cc6e8a9b5db3d6f25e84e6fa10.zip
Fix bugs and warnings in qlite
Diffstat (limited to 'qlite/src/column.vala')
-rw-r--r--qlite/src/column.vala29
1 files changed, 1 insertions, 28 deletions
diff --git a/qlite/src/column.vala b/qlite/src/column.vala
index f7b3114f..105b4bbb 100644
--- a/qlite/src/column.vala
+++ b/qlite/src/column.vala
@@ -19,9 +19,7 @@ public abstract class Column<T> {
return false;
}
- public virtual void bind(Statement stmt, int index, T value) {
- throw new DatabaseError.NOT_SUPPORTED(@"bind() was not implemented for field $name");
- }
+ public abstract void bind(Statement stmt, int index, T value);
public string to_string() {
string res = name;
@@ -158,31 +156,6 @@ public abstract class Column<T> {
stmt.bind_int(index, value ? 1 : 0);
}
}
-
- public class RowReference : Column<Row?> {
- private Table table;
- private Column<int> id_column;
-
- public RowReference(string name, Table table, Column<int> id_column) throws DatabaseError {
- base(name, INTEGER);
- if (!table.is_known_column(id_column.name)) throw new DatabaseError.ILLEGAL_REFERENCE(@"$(id_column.name) is not a column in $(table.name)");
- if (!id_column.primary_key && !id_column.unique) throw new DatabaseError.NON_UNIQUE(@"$(id_column.name) is not suited to identify a row, but used with RowReference");
- this.table = table;
- this.id_column = id_column;
- }
-
- public override Row? get(Row row) {
- return table.row_with(id_column, (int)row.get_integer(name));
- }
-
- public override void bind(Statement stmt, int index, Row? value) {
- if (value != null) {
- stmt.bind_int(index, id_column.get(value));
- } else {
- stmt.bind_null(index);
- }
- }
- }
}
} \ No newline at end of file