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/column.vala | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) (limited to 'qlite/src/column.vala') 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 { 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 { stmt.bind_int(index, value ? 1 : 0); } } - - public class RowReference : Column { - private Table table; - private Column id_column; - - public RowReference(string name, Table table, Column 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 -- cgit v1.2.3-70-g09d2