doix-db 1.0.35 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,27 +62,35 @@ class DbQueryTable {
62
62
  }
63
63
 
64
64
  this.filters = []
65
+ this.unknownColumnComparisons = []
65
66
 
66
- if (o.filters) for (const [name, op, value] of o.filters)
67
-
68
- this.addColumnComparison (name, op, value)
67
+ if (o.filters) for (const [name, op, value] of o.filters) this.addColumnComparison (name, op, value)
69
68
 
70
69
  query.tables.push (this)
71
70
 
72
71
  }
73
-
74
- get qName () {
75
-
76
- return this.lang.quoteName (this.alias)
77
-
78
- }
79
72
 
80
73
  addColumnComparison (name, op, value) {
81
-
74
+
82
75
  if (value == null && !this.lang.isUnaryOperator (op)) return
83
76
 
84
- new DbQueryTableColumnComparison (this, name, op, value)
77
+ if (!this.relation || name in this.relation.columns) {
78
+
79
+ this.filters.push (new DbQueryTableColumnComparison (this, name, op, value))
80
+
81
+ }
82
+ else {
83
+
84
+ this.unknownColumnComparisons.push ([name, op, value])
85
85
 
86
+ }
87
+
88
+ }
89
+
90
+ get qName () {
91
+
92
+ return this.lang.quoteName (this.alias)
93
+
86
94
  }
87
95
 
88
96
  adjustJoinCondition () {
@@ -2,8 +2,8 @@ class DbQueryTableColumnComparison {
2
2
 
3
3
  constructor (table, name, op, value) {
4
4
 
5
- const {relation} = table, {columns} = relation; if (!(name in columns)) throw Error (`Column not found: ${relation.name}.${name}`)
6
-
5
+ const {relation} = table, {columns} = relation
6
+
7
7
  this.table = table
8
8
 
9
9
  this.column = relation.columns [name]
@@ -14,8 +14,6 @@ class DbQueryTableColumnComparison {
14
14
 
15
15
  this.setParams (value)
16
16
 
17
- table.filters.push (this)
18
-
19
17
  }
20
18
 
21
19
  get debugName () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doix-db",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "Shared database related code for doix",
5
5
  "main": "index.js",
6
6
  "files": [