anotherim-desktop/qlite/src/statement_builder.vala
Randy Barlow 48c2e7afa4 Do not mark abstract class contstuctors public
Starting with Vala 0.45.1, it is an error to mark abstract class
constructors public[0,1]. This commit removes three such
declarations.

fixes #609

[0] https://gitlab.gnome.org/GNOME/vala/raw/master/NEWS
[1] https://gitlab.gnome.org/GNOME/vala/issues/766

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
2019-09-01 21:19:09 +02:00

59 lines
1.3 KiB
Vala

using Sqlite;
namespace Qlite {
public abstract class StatementBuilder {
protected Database db;
internal StatementBuilder(Database db) {
this.db = db;
}
internal abstract Statement prepare();
internal abstract class AbstractField<T> {
public T value;
public Column<T>? column;
AbstractField(T value) {
this.value = value;
}
internal abstract void bind(Statement stmt, int index);
}
internal class Field<T> : AbstractField<T> {
public Field(Column<T> column, T value) {
base(value);
this.column = column;
}
internal override void bind(Statement stmt, int index) {
((!)column).bind(stmt, index, value);
}
}
internal class NullField<T> : AbstractField<T> {
public NullField(Column<T> column) {
base(null);
this.column = column;
}
internal override void bind(Statement stmt, int index) {
stmt.bind_null(index);
}
}
internal class StringField : AbstractField<string> {
public StringField(string value) {
base(value);
}
internal override void bind(Statement stmt, int index) {
stmt.bind_text(index, value);
}
}
}
}