aboutsummaryrefslogtreecommitdiff
path: root/qlite
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-03-20 19:27:39 +0100
committerMarvin W <git@larma.de>2017-03-23 16:48:26 +0100
commitef0483765a0fd567f25b1f0af6df04e8973e5624 (patch)
tree9288c239217496774710542b922cdd264e0838cc /qlite
parentaca6842c490c52b6460b7d9ebd7cc77eec4b97ef (diff)
downloaddino-ef0483765a0fd567f25b1f0af6df04e8973e5624.tar.gz
dino-ef0483765a0fd567f25b1f0af6df04e8973e5624.zip
Small bug fixes and compatibility with Vala 0.36
Diffstat (limited to 'qlite')
-rw-r--r--qlite/src/column.vala14
-rw-r--r--qlite/src/database.vala4
-rw-r--r--qlite/src/delete_builder.vala4
-rw-r--r--qlite/src/insert_builder.vala4
-rw-r--r--qlite/src/query_builder.vala4
-rw-r--r--qlite/src/row.vala2
-rw-r--r--qlite/src/statement_builder.vala16
-rw-r--r--qlite/src/update_builder.vala4
8 files changed, 26 insertions, 26 deletions
diff --git a/qlite/src/column.vala b/qlite/src/column.vala
index 105b4bbb..048446fb 100644
--- a/qlite/src/column.vala
+++ b/qlite/src/column.vala
@@ -19,7 +19,7 @@ public abstract class Column<T> {
return false;
}
- public abstract void bind(Statement stmt, int index, T value);
+ internal abstract void bind(Statement stmt, int index, T value);
public string to_string() {
string res = name;
@@ -66,7 +66,7 @@ public abstract class Column<T> {
return !row.has_integer(name);
}
- public override void bind(Statement stmt, int index, int value) {
+ internal override void bind(Statement stmt, int index, int value) {
stmt.bind_int(index, value);
}
}
@@ -84,7 +84,7 @@ public abstract class Column<T> {
return !row.has_integer(name);
}
- public override void bind(Statement stmt, int index, long value) {
+ internal override void bind(Statement stmt, int index, long value) {
stmt.bind_int64(index, value);
}
}
@@ -102,7 +102,7 @@ public abstract class Column<T> {
return !row.has_real(name);
}
- public override void bind(Statement stmt, int index, double value) {
+ internal override void bind(Statement stmt, int index, double value) {
stmt.bind_double(index, value);
}
}
@@ -120,7 +120,7 @@ public abstract class Column<T> {
return get(row) == null;
}
- public override void bind(Statement stmt, int index, string? value) {
+ internal override void bind(Statement stmt, int index, string? value) {
if (value != null) {
stmt.bind_text(index, value);
} else {
@@ -138,7 +138,7 @@ public abstract class Column<T> {
return row.get_text(name) == "1";
}
- public override void bind(Statement stmt, int index, bool value) {
+ internal override void bind(Statement stmt, int index, bool value) {
stmt.bind_text(index, value ? "1" : "0");
}
}
@@ -152,7 +152,7 @@ public abstract class Column<T> {
return row.get_integer(name) == 1;
}
- public override void bind(Statement stmt, int index, bool value) {
+ internal override void bind(Statement stmt, int index, bool value) {
stmt.bind_int(index, value ? 1 : 0);
}
}
diff --git a/qlite/src/database.vala b/qlite/src/database.vala
index 9fea7708..89eda204 100644
--- a/qlite/src/database.vala
+++ b/qlite/src/database.vala
@@ -126,7 +126,7 @@ public class Database {
return new RowIterator(this, sql, args);
}
- public Statement prepare(string sql) throws DatabaseError {
+ internal Statement prepare(string sql) throws DatabaseError {
ensure_init();
if (debug) print(@"prepare: $sql\n");
Sqlite.Statement statement;
@@ -136,7 +136,7 @@ public class Database {
return statement;
}
- public void exec(string sql) throws DatabaseError {
+ internal void exec(string sql) throws DatabaseError {
ensure_init();
if (db.exec(sql) != OK) {
throw new DatabaseError.EXEC_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())");
diff --git a/qlite/src/delete_builder.vala b/qlite/src/delete_builder.vala
index 679c8284..8e4afb06 100644
--- a/qlite/src/delete_builder.vala
+++ b/qlite/src/delete_builder.vala
@@ -12,7 +12,7 @@ public class DeleteBuilder : StatementBuilder {
private string selection;
private StatementBuilder.Field[] selection_args;
- protected DeleteBuilder(Database db) {
+ internal DeleteBuilder(Database db) {
base(db);
}
@@ -56,7 +56,7 @@ public class DeleteBuilder : StatementBuilder {
return this;
}
- public override Statement prepare() throws DatabaseError {
+ internal override Statement prepare() throws DatabaseError {
Statement stmt = db.prepare(@"DELETE FROM $table_name $(selection != null ? @"WHERE $selection": "")");
for (int i = 0; i < selection_args.length; i++) {
selection_args[i].bind(stmt, i+1);
diff --git a/qlite/src/insert_builder.vala b/qlite/src/insert_builder.vala
index c1c17123..51030294 100644
--- a/qlite/src/insert_builder.vala
+++ b/qlite/src/insert_builder.vala
@@ -15,7 +15,7 @@ public class InsertBuilder : StatementBuilder {
// VALUES [...]
private StatementBuilder.Field[] fields;
- protected InsertBuilder(Database db) {
+ internal InsertBuilder(Database db) {
base(db);
}
@@ -69,7 +69,7 @@ public class InsertBuilder : StatementBuilder {
return this;
}
- public override Statement prepare() throws DatabaseError {
+ internal override Statement prepare() throws DatabaseError {
string fields_text = "";
string value_qs = "";
for (int i = 0; i < fields.length; i++) {
diff --git a/qlite/src/query_builder.vala b/qlite/src/query_builder.vala
index 7259eddf..06232fc1 100644
--- a/qlite/src/query_builder.vala
+++ b/qlite/src/query_builder.vala
@@ -23,7 +23,7 @@ public class QueryBuilder : StatementBuilder {
// LIMIT [...]
private int limit_val;
- protected QueryBuilder(Database db) {
+ internal QueryBuilder(Database db) {
base(db);
}
@@ -147,7 +147,7 @@ public class QueryBuilder : StatementBuilder {
return row()[field];
}
- public override Statement prepare() throws DatabaseError {
+ internal override Statement prepare() throws DatabaseError {
Statement stmt = db.prepare(@"SELECT $column_selector FROM $table_name $(selection != null ? @"WHERE $selection" : "") $(order_by_terms != null ? OrderingTerm.all_to_string(order_by_terms) : "") $(limit_val > 0 ? @" LIMIT $limit_val" : "")");
for (int i = 0; i < selection_args.length; i++) {
selection_args[i].bind(stmt, i+1);
diff --git a/qlite/src/row.vala b/qlite/src/row.vala
index 60c7b666..96762be3 100644
--- a/qlite/src/row.vala
+++ b/qlite/src/row.vala
@@ -8,7 +8,7 @@ public class Row {
private Map<string, long> int_map = new HashMap<string, long>();
private Map<string, double?> real_map = new HashMap<string, double?>();
- public Row(Statement stmt) {
+ internal Row(Statement stmt) {
for (int i = 0; i < stmt.column_count(); i++) {
switch(stmt.column_type(i)) {
case TEXT:
diff --git a/qlite/src/statement_builder.vala b/qlite/src/statement_builder.vala
index e0055e87..11efb0de 100644
--- a/qlite/src/statement_builder.vala
+++ b/qlite/src/statement_builder.vala
@@ -5,13 +5,13 @@ namespace Qlite {
public abstract class StatementBuilder {
protected Database db;
- public StatementBuilder(Database db) {
+ internal StatementBuilder(Database db) {
this.db = db;
}
- public abstract Statement prepare() throws DatabaseError;
+ internal abstract Statement prepare() throws DatabaseError;
- protected class Field<T> {
+ internal class Field<T> {
public T value;
public Column<T>? column;
@@ -20,29 +20,29 @@ public abstract class StatementBuilder {
this.value = value;
}
- public virtual void bind(Statement stmt, int index) {
+ internal virtual void bind(Statement stmt, int index) {
if (column != null) {
column.bind(stmt, index, value);
}
}
}
- protected class NullField<T> : Field<T> {
+ internal class NullField<T> : Field<T> {
public NullField(Column<T>? column) {
base(column, null);
}
- public override void bind(Statement stmt, int index) {
+ internal override void bind(Statement stmt, int index) {
stmt.bind_null(index);
}
}
- protected class StringField : Field<string> {
+ internal class StringField : Field<string> {
public StringField(string value) {
base(null, value);
}
- public override void bind(Statement stmt, int index) {
+ internal override void bind(Statement stmt, int index) {
stmt.bind_text(index, value);
}
}
diff --git a/qlite/src/update_builder.vala b/qlite/src/update_builder.vala
index 41fd28b2..6aad2aa1 100644
--- a/qlite/src/update_builder.vala
+++ b/qlite/src/update_builder.vala
@@ -18,7 +18,7 @@ public class UpdateBuilder : StatementBuilder {
private string selection;
private StatementBuilder.Field[] selection_args;
- protected UpdateBuilder(Database db, Table table) {
+ internal UpdateBuilder(Database db, Table table) {
base(db);
this.table = table;
this.table_name = table.name;
@@ -101,7 +101,7 @@ public class UpdateBuilder : StatementBuilder {
return this;
}
- public override Statement prepare() throws DatabaseError {
+ internal override Statement prepare() throws DatabaseError {
string sql = "UPDATE";
if (or_val != null) sql += @" OR $or_val";
sql += @" $table_name SET ";