aboutsummaryrefslogtreecommitdiff
path: root/qlite/src/table.vala
diff options
context:
space:
mode:
authorbobufa <bobufa@users.noreply.github.com>2018-06-27 16:58:10 +0200
committerbobufa <bobufa@users.noreply.github.com>2018-08-13 22:25:34 +0200
commitbabfc3bd36e0cfa50f06648224f33a6a96eb27ea (patch)
tree75eefa7656ba90cf8592ac8d757a4f18d6ef294a /qlite/src/table.vala
parent760fd4cb26340165fb85c2e3aee8390e46dc8b63 (diff)
downloaddino-babfc3bd36e0cfa50f06648224f33a6a96eb27ea.tar.gz
dino-babfc3bd36e0cfa50f06648224f33a6a96eb27ea.zip
qlite: add basic (outer) join functionality
Diffstat (limited to 'qlite/src/table.vala')
-rw-r--r--qlite/src/table.vala10
1 files changed, 7 insertions, 3 deletions
diff --git a/qlite/src/table.vala b/qlite/src/table.vala
index 8725c4c9..607a396c 100644
--- a/qlite/src/table.vala
+++ b/qlite/src/table.vala
@@ -19,6 +19,10 @@ public class Table {
public void init(Column[] columns, string constraints = "") {
this.columns = columns;
this.constraints = constraints;
+
+ foreach(Column c in columns) {
+ c.table = this;
+ }
}
public void fts(Column[] columns) {
@@ -28,7 +32,7 @@ public class Table {
string cnames = "";
string cnews = "";
foreach (Column c in columns) {
- cs += @", $c";
+ cs += @", $(c.to_column_definition())";
cnames += @", $(c.name)";
cnews += @", new.$(c.name)";
}
@@ -140,7 +144,7 @@ public class Table {
for (int i = 0; i < columns.length; i++) {
Column c = columns[i];
if (c.min_version <= version && c.max_version >= version) {
- sql += @"$(i > 0 ? "," : "") $c";
+ sql += @"$(i > 0 ? "," : "") $(c.to_column_definition())";
}
}
sql += @"$constraints)";
@@ -163,7 +167,7 @@ public class Table {
foreach (Column c in columns) {
if (c.min_version <= new_version && c.max_version >= new_version && c.min_version > old_version) {
try {
- db.exec(@"ALTER TABLE $name ADD COLUMN $c");
+ db.exec(@"ALTER TABLE $name ADD COLUMN $(c.to_column_definition())");
} catch (Error e) {
error("Qlite Error: Add columns for version");
}