foxhound 2.0.0 → 2.0.1
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.
- package/dist/foxhound.js +2713 -2723
- package/dist/foxhound.min.js +3 -6
- package/dist/foxhound.min.js.map +1 -1
- package/package.json +2 -3
- package/source/FoxHound.js +12 -24
- package/source/Foxhound-Dialects.js +15 -0
- package/source/dialects/ALASQL/FoxHound-Dialect-ALASQL.js +9 -5
- package/source/dialects/English/FoxHound-Dialect-English.js +1 -1
- package/source/dialects/MeadowEndpoints/FoxHound-Dialect-MeadowEndpoints.js +1 -2
- package/source/dialects/MySQL/FoxHound-Dialect-MySQL.js +6 -5
- package/test/FoxHound-Dialect-ALASQL_tests.js +77 -76
- package/test/FoxHound-Dialect-English_tests.js +15 -14
- package/test/FoxHound-Dialect-MeadowEndpoints_tests.js +51 -50
- package/test/FoxHound-Dialect-MySQL_tests.js +81 -80
- package/test/FoxHound_tests.js +24 -23
|
@@ -10,7 +10,8 @@ var Chai = require('chai');
|
|
|
10
10
|
var Expect = Chai.expect;
|
|
11
11
|
var Assert = Chai.assert;
|
|
12
12
|
|
|
13
|
-
var libFable =
|
|
13
|
+
var libFable = require('fable');
|
|
14
|
+
const _Fable = new libFable({Product:'FoxhoundTestsALASQL'});
|
|
14
15
|
var libFoxHound = require('../source/FoxHound.js');
|
|
15
16
|
|
|
16
17
|
var _AnimalSchema = (
|
|
@@ -58,7 +59,7 @@ suite
|
|
|
58
59
|
'initialize should build a happy little object',
|
|
59
60
|
function()
|
|
60
61
|
{
|
|
61
|
-
var testFoxHound = libFoxHound.new(
|
|
62
|
+
var testFoxHound = libFoxHound.new(_Fable).setDialect('ALASQL');
|
|
62
63
|
Expect(testFoxHound.dialect.name)
|
|
63
64
|
.to.equal('ALASQL');
|
|
64
65
|
Expect(testFoxHound)
|
|
@@ -78,7 +79,7 @@ suite
|
|
|
78
79
|
'Create Query',
|
|
79
80
|
function()
|
|
80
81
|
{
|
|
81
|
-
var tmpQuery = libFoxHound.new(
|
|
82
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
82
83
|
.setLogLevel(5)
|
|
83
84
|
.setDialect('ALASQL')
|
|
84
85
|
.setScope('Animal')
|
|
@@ -86,7 +87,7 @@ suite
|
|
|
86
87
|
// Build the query
|
|
87
88
|
tmpQuery.buildCreateQuery();
|
|
88
89
|
// This is the query generated by the ALASQL dialect
|
|
89
|
-
|
|
90
|
+
_Fable.log.trace('Create Query', tmpQuery.query);
|
|
90
91
|
Expect(tmpQuery.query.body)
|
|
91
92
|
.to.equal("INSERT INTO Animal ( `IDAnimal`, `Name`, `Age`) VALUES ( :IDAnimal_0, :Name_1, :Age_2);");
|
|
92
93
|
}
|
|
@@ -96,13 +97,13 @@ suite
|
|
|
96
97
|
'Bad Create Query',
|
|
97
98
|
function()
|
|
98
99
|
{
|
|
99
|
-
var tmpQuery = libFoxHound.new(
|
|
100
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL');
|
|
100
101
|
// Build the query
|
|
101
102
|
tmpQuery.buildCreateQuery();
|
|
102
103
|
tmpQuery.addRecord({});
|
|
103
104
|
tmpQuery.buildCreateQuery();
|
|
104
105
|
// This is the query generated by the ALASQL dialect
|
|
105
|
-
|
|
106
|
+
_Fable.log.trace('Create Query', tmpQuery.query);
|
|
106
107
|
Expect(tmpQuery.query.body)
|
|
107
108
|
.to.equal(false);
|
|
108
109
|
}
|
|
@@ -112,12 +113,12 @@ suite
|
|
|
112
113
|
'Read Query',
|
|
113
114
|
function()
|
|
114
115
|
{
|
|
115
|
-
var tmpQuery = libFoxHound.new(
|
|
116
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL').setScope('Animal');
|
|
116
117
|
tmpQuery.addSort({Column:'Cost',Direction:'Descending'});
|
|
117
118
|
// Build the query
|
|
118
119
|
tmpQuery.buildReadQuery();
|
|
119
120
|
// This is the query generated by the ALASQL dialect
|
|
120
|
-
|
|
121
|
+
_Fable.log.trace('Simple Select Query', tmpQuery.query);
|
|
121
122
|
Expect(tmpQuery.query.body)
|
|
122
123
|
.to.equal('SELECT * FROM Animal ORDER BY `Cost` DESC;');
|
|
123
124
|
}
|
|
@@ -127,13 +128,13 @@ suite
|
|
|
127
128
|
'Read Query with Distinct',
|
|
128
129
|
function()
|
|
129
130
|
{
|
|
130
|
-
var tmpQuery = libFoxHound.new(
|
|
131
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL').setScope('Animal');
|
|
131
132
|
tmpQuery.addSort({Column:'Cost',Direction:'Descending'})
|
|
132
133
|
.setDistinct(true);
|
|
133
134
|
// Build the query
|
|
134
135
|
tmpQuery.buildReadQuery();
|
|
135
136
|
// This is the query generated by the ALASQL dialect
|
|
136
|
-
|
|
137
|
+
_Fable.log.trace('Simple Select Query', tmpQuery.query);
|
|
137
138
|
Expect(tmpQuery.query.body)
|
|
138
139
|
.to.equal('SELECT DISTINCT * FROM Animal ORDER BY `Cost` DESC;');
|
|
139
140
|
}
|
|
@@ -143,7 +144,7 @@ suite
|
|
|
143
144
|
'Complex Read Query',
|
|
144
145
|
function()
|
|
145
146
|
{
|
|
146
|
-
var tmpQuery = libFoxHound.new(
|
|
147
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
147
148
|
.setDialect('ALASQL')
|
|
148
149
|
.setScope('Animal')
|
|
149
150
|
.setCap(10)
|
|
@@ -155,7 +156,7 @@ suite
|
|
|
155
156
|
// Build the query
|
|
156
157
|
tmpQuery.buildReadQuery();
|
|
157
158
|
// This is the query generated by the ALASQL dialect
|
|
158
|
-
|
|
159
|
+
_Fable.log.trace('Select Query', tmpQuery.query);
|
|
159
160
|
Expect(tmpQuery.query.body)
|
|
160
161
|
.to.equal('SELECT `Name`, `Age`, `Cost` FROM Animal WHERE `Age` = :Age_w0 ORDER BY `Age`, `Cost` LIMIT 10 FETCH 0;');
|
|
161
162
|
}
|
|
@@ -165,7 +166,7 @@ suite
|
|
|
165
166
|
'Complex Read Query with Distinct',
|
|
166
167
|
function()
|
|
167
168
|
{
|
|
168
|
-
var tmpQuery = libFoxHound.new(
|
|
169
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
169
170
|
.setDialect('ALASQL')
|
|
170
171
|
.setScope('Animal')
|
|
171
172
|
.setCap(10)
|
|
@@ -178,7 +179,7 @@ suite
|
|
|
178
179
|
// Build the query
|
|
179
180
|
tmpQuery.buildReadQuery();
|
|
180
181
|
// This is the query generated by the ALASQL dialect
|
|
181
|
-
|
|
182
|
+
_Fable.log.trace('Select Query', tmpQuery.query);
|
|
182
183
|
Expect(tmpQuery.query.body)
|
|
183
184
|
.to.equal('SELECT DISTINCT `Name`, `Age`, `Cost` FROM Animal WHERE `Age` = :Age_w0 ORDER BY `Age`, `Cost` LIMIT 10 FETCH 0;');
|
|
184
185
|
}
|
|
@@ -188,7 +189,7 @@ suite
|
|
|
188
189
|
'Complex Read Query 2',
|
|
189
190
|
function()
|
|
190
191
|
{
|
|
191
|
-
var tmpQuery = libFoxHound.new(
|
|
192
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
192
193
|
.setDialect('ALASQL')
|
|
193
194
|
.setScope('Animal')
|
|
194
195
|
.setDataElements(['Name', 'Age', 'Cost'])
|
|
@@ -204,7 +205,7 @@ suite
|
|
|
204
205
|
// Build the query
|
|
205
206
|
tmpQuery.buildReadQuery();
|
|
206
207
|
// This is the query generated by the ALASQL dialect
|
|
207
|
-
|
|
208
|
+
_Fable.log.trace('Select Query', tmpQuery.query);
|
|
208
209
|
Expect(tmpQuery.query.body)
|
|
209
210
|
.to.equal('SELECT `Name`, `Age`, `Cost` FROM Animal WHERE `Age` = :Age_w0 AND ( `Color` = :Color_w2 OR `Color` = :Color_w3 ) AND `Description` IS NOT NULL AND `IDOffice` IN ( :IDOffice_w6 ) ORDER BY `Age` LIMIT 100;');
|
|
210
211
|
}
|
|
@@ -214,7 +215,7 @@ suite
|
|
|
214
215
|
'Custom Read Query',
|
|
215
216
|
function()
|
|
216
217
|
{
|
|
217
|
-
var tmpQuery = libFoxHound.new(
|
|
218
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
218
219
|
.setDialect('ALASQL')
|
|
219
220
|
.setScope('Animal')
|
|
220
221
|
.setCap(10)
|
|
@@ -226,7 +227,7 @@ suite
|
|
|
226
227
|
// Build the query
|
|
227
228
|
tmpQuery.buildReadQuery();
|
|
228
229
|
// This is the query generated by the ALASQL dialect
|
|
229
|
-
|
|
230
|
+
_Fable.log.trace('Custom Select Query', tmpQuery.query);
|
|
230
231
|
Expect(tmpQuery.query.body)
|
|
231
232
|
.to.equal('SELECT `Name`, `Age` * 5, `Cost` FROM Animal WHERE `Age` = :Age_w0 LIMIT 10 FETCH 0;');
|
|
232
233
|
}
|
|
@@ -236,7 +237,7 @@ suite
|
|
|
236
237
|
'Custom Read Query with Custom Parameters',
|
|
237
238
|
function()
|
|
238
239
|
{
|
|
239
|
-
var tmpQuery = libFoxHound.new(
|
|
240
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
240
241
|
.setDialect('ALASQL')
|
|
241
242
|
.setScope('Animal')
|
|
242
243
|
.setCap(10)
|
|
@@ -249,7 +250,7 @@ suite
|
|
|
249
250
|
// Build the query
|
|
250
251
|
tmpQuery.buildReadQuery();
|
|
251
252
|
// This is the query generated by the ALASQL dialect
|
|
252
|
-
|
|
253
|
+
_Fable.log.trace('Custom Select Query', tmpQuery.query);
|
|
253
254
|
Expect(tmpQuery.query.body)
|
|
254
255
|
.to.equal('SELECT `Name`, `Age` * 5, `Cost` FROM Animal WHERE `Age` = :Age_w0 LIMIT 10 FETCH 0;');
|
|
255
256
|
}
|
|
@@ -259,7 +260,7 @@ suite
|
|
|
259
260
|
'Bad Custom Read Query',
|
|
260
261
|
function()
|
|
261
262
|
{
|
|
262
|
-
var tmpQuery = libFoxHound.new(
|
|
263
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
263
264
|
.setDialect('ALASQL')
|
|
264
265
|
.setScope('Animal')
|
|
265
266
|
.setCap(10)
|
|
@@ -271,7 +272,7 @@ suite
|
|
|
271
272
|
// Build the query
|
|
272
273
|
tmpQuery.buildReadQuery();
|
|
273
274
|
// This is the query generated by the ALASQL dialect
|
|
274
|
-
|
|
275
|
+
_Fable.log.trace('Custom Select Query', tmpQuery.query);
|
|
275
276
|
Expect(tmpQuery.query.body)
|
|
276
277
|
.to.equal(false);
|
|
277
278
|
}
|
|
@@ -281,7 +282,7 @@ suite
|
|
|
281
282
|
'Bad Custom Count Query',
|
|
282
283
|
function()
|
|
283
284
|
{
|
|
284
|
-
var tmpQuery = libFoxHound.new(
|
|
285
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
285
286
|
.setDialect('ALASQL')
|
|
286
287
|
.setScope('Animal')
|
|
287
288
|
.setFilter({Column:'Age',Operator:'=',Value:'15',Connector:'AND',Parameter:'Age'});
|
|
@@ -289,7 +290,7 @@ suite
|
|
|
289
290
|
// Build the query
|
|
290
291
|
tmpQuery.buildCountQuery();
|
|
291
292
|
// This is the query generated by the ALASQL dialect
|
|
292
|
-
|
|
293
|
+
_Fable.log.trace('Custom Count Query', tmpQuery.query);
|
|
293
294
|
Expect(tmpQuery.query.body)
|
|
294
295
|
.to.equal(false);
|
|
295
296
|
}
|
|
@@ -299,7 +300,7 @@ suite
|
|
|
299
300
|
'Custom Count Query',
|
|
300
301
|
function()
|
|
301
302
|
{
|
|
302
|
-
var tmpQuery = libFoxHound.new(
|
|
303
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
303
304
|
.setDialect('ALASQL')
|
|
304
305
|
.setScope('Animal')
|
|
305
306
|
.setFilter({Column:'Age',Operator:'=',Value:'15',Connector:'AND',Parameter:'Age'});
|
|
@@ -307,7 +308,7 @@ suite
|
|
|
307
308
|
// Build the query
|
|
308
309
|
tmpQuery.buildCountQuery();
|
|
309
310
|
// This is the query generated by the ALASQL dialect
|
|
310
|
-
|
|
311
|
+
_Fable.log.trace('Custom Count Query', tmpQuery.query);
|
|
311
312
|
Expect(tmpQuery.query.body)
|
|
312
313
|
.to.equal('SELECT COUNT(*) AS RowCount FROM Animal WHERE `Age` = :Age_w0;');
|
|
313
314
|
}
|
|
@@ -317,7 +318,7 @@ suite
|
|
|
317
318
|
'Custom Count Query with Custom Parameters',
|
|
318
319
|
function()
|
|
319
320
|
{
|
|
320
|
-
var tmpQuery = libFoxHound.new(
|
|
321
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
321
322
|
.setDialect('ALASQL')
|
|
322
323
|
.setScope('Animal')
|
|
323
324
|
.setFilter({Column:'Age',Operator:'=',Value:'15',Connector:'AND',Parameter:'Age'});
|
|
@@ -326,7 +327,7 @@ suite
|
|
|
326
327
|
// Build the query
|
|
327
328
|
tmpQuery.buildCountQuery();
|
|
328
329
|
// This is the query generated by the ALASQL dialect
|
|
329
|
-
|
|
330
|
+
_Fable.log.trace('Custom Count Query', tmpQuery.query);
|
|
330
331
|
Expect(tmpQuery.query.body)
|
|
331
332
|
.to.equal('SELECT COUNT(*) AS RowCount FROM Animal WHERE `Age` = :Age_w0;');
|
|
332
333
|
}
|
|
@@ -336,7 +337,7 @@ suite
|
|
|
336
337
|
'Count Query with Field Overrides',
|
|
337
338
|
function()
|
|
338
339
|
{
|
|
339
|
-
var tmpQuery = libFoxHound.new(
|
|
340
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
340
341
|
.setDialect('ALASQL')
|
|
341
342
|
.setScope('Animal')
|
|
342
343
|
.setCap(10)
|
|
@@ -347,7 +348,7 @@ suite
|
|
|
347
348
|
// Build the query
|
|
348
349
|
tmpQuery.buildCountQuery();
|
|
349
350
|
// This is the query generated by the ALASQL dialect
|
|
350
|
-
|
|
351
|
+
_Fable.log.trace('Custom Select Query', tmpQuery.query);
|
|
351
352
|
Expect(tmpQuery.query.body)
|
|
352
353
|
.to.equal('SELECT COUNT(*) AS RowCount FROM Animal WHERE `Age` = :Age_w0;');
|
|
353
354
|
}
|
|
@@ -357,7 +358,7 @@ suite
|
|
|
357
358
|
'Count Query with Field Overrides and Distinct',
|
|
358
359
|
function()
|
|
359
360
|
{
|
|
360
|
-
var tmpQuery = libFoxHound.new(
|
|
361
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
361
362
|
.setDialect('ALASQL')
|
|
362
363
|
.setScope('Animal')
|
|
363
364
|
.setCap(10)
|
|
@@ -369,7 +370,7 @@ suite
|
|
|
369
370
|
// Build the query
|
|
370
371
|
tmpQuery.buildCountQuery();
|
|
371
372
|
// This is the query generated by the ALASQL dialect
|
|
372
|
-
|
|
373
|
+
_Fable.log.trace('Custom Select Query', tmpQuery.query);
|
|
373
374
|
Expect(tmpQuery.query.body)
|
|
374
375
|
.to.equal('SELECT COUNT(DISTINCT `Name`, `Age`, `Cost`) AS RowCount FROM Animal WHERE `Age` = :Age_w0;');
|
|
375
376
|
}
|
|
@@ -379,7 +380,7 @@ suite
|
|
|
379
380
|
'Custom Count Query with Distinct',
|
|
380
381
|
function()
|
|
381
382
|
{
|
|
382
|
-
var tmpQuery = libFoxHound.new(
|
|
383
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
383
384
|
.setDialect('ALASQL')
|
|
384
385
|
.setScope('Animal')
|
|
385
386
|
.setFilter({Column:'Age',Operator:'=',Value:'15',Connector:'AND',Parameter:'Age'})
|
|
@@ -387,7 +388,7 @@ suite
|
|
|
387
388
|
// Build the query
|
|
388
389
|
tmpQuery.buildCountQuery();
|
|
389
390
|
// This is the query generated by the ALASQL dialect
|
|
390
|
-
|
|
391
|
+
_Fable.log.trace('Custom Count Query', tmpQuery.query);
|
|
391
392
|
Expect(tmpQuery.query.body)
|
|
392
393
|
.to.equal('SELECT COUNT(*) AS RowCount FROM Animal WHERE `Age` = :Age_w0;');
|
|
393
394
|
}
|
|
@@ -397,7 +398,7 @@ suite
|
|
|
397
398
|
'Update Query',
|
|
398
399
|
function()
|
|
399
400
|
{
|
|
400
|
-
var tmpQuery = libFoxHound.new(
|
|
401
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
401
402
|
.setLogLevel(5)
|
|
402
403
|
.setScope('Animal')
|
|
403
404
|
.addFilter('IDAnimal', 9)
|
|
@@ -406,7 +407,7 @@ suite
|
|
|
406
407
|
// Build the query
|
|
407
408
|
tmpQuery.buildUpdateQuery();
|
|
408
409
|
// This is the query generated by the ALASQL dialect
|
|
409
|
-
|
|
410
|
+
_Fable.log.trace('Update Query', tmpQuery.query);
|
|
410
411
|
Expect(tmpQuery.query.body)
|
|
411
412
|
.to.equal('UPDATE Animal SET `Age` = :Age_0, `Color` = :Color_1 WHERE `IDAnimal` = :IDAnimal_w0;');
|
|
412
413
|
}
|
|
@@ -416,14 +417,14 @@ suite
|
|
|
416
417
|
'Bad Update Query',
|
|
417
418
|
function()
|
|
418
419
|
{
|
|
419
|
-
var tmpQuery = libFoxHound.new(
|
|
420
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL');
|
|
420
421
|
|
|
421
422
|
// Build the query
|
|
422
423
|
tmpQuery.buildUpdateQuery();
|
|
423
424
|
tmpQuery.addRecord({});
|
|
424
425
|
tmpQuery.buildUpdateQuery();
|
|
425
426
|
// This is the query generated by the ALASQL dialect
|
|
426
|
-
|
|
427
|
+
_Fable.log.trace('Update Query', tmpQuery.query);
|
|
427
428
|
Expect(tmpQuery.query.body)
|
|
428
429
|
.to.equal(false);
|
|
429
430
|
}
|
|
@@ -433,14 +434,14 @@ suite
|
|
|
433
434
|
'Delete Query',
|
|
434
435
|
function()
|
|
435
436
|
{
|
|
436
|
-
var tmpQuery = libFoxHound.new(
|
|
437
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
437
438
|
.setScope('Animal')
|
|
438
439
|
.addFilter('IDAnimal', 10);
|
|
439
440
|
|
|
440
441
|
// Build the query
|
|
441
442
|
tmpQuery.buildDeleteQuery();
|
|
442
443
|
// This is the query generated by the ALASQL dialect
|
|
443
|
-
|
|
444
|
+
_Fable.log.trace('Delete Query', tmpQuery.query);
|
|
444
445
|
Expect(tmpQuery.query.body)
|
|
445
446
|
.to.equal('DELETE FROM Animal WHERE `IDAnimal` = :IDAnimal_w0;');
|
|
446
447
|
}
|
|
@@ -450,14 +451,14 @@ suite
|
|
|
450
451
|
'Count Query',
|
|
451
452
|
function()
|
|
452
453
|
{
|
|
453
|
-
var tmpQuery = libFoxHound.new(
|
|
454
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
454
455
|
.setDialect('ALASQL')
|
|
455
456
|
.setScope('Animal');
|
|
456
457
|
|
|
457
458
|
// Build the query
|
|
458
459
|
tmpQuery.buildCountQuery();
|
|
459
460
|
// This is the query generated by the ALASQL dialect
|
|
460
|
-
|
|
461
|
+
_Fable.log.trace('Count Query', tmpQuery.query);
|
|
461
462
|
Expect(tmpQuery.query.body)
|
|
462
463
|
.to.equal('SELECT COUNT(*) AS RowCount FROM Animal;');
|
|
463
464
|
}
|
|
@@ -467,7 +468,7 @@ suite
|
|
|
467
468
|
'Count Query with Distinct',
|
|
468
469
|
function()
|
|
469
470
|
{
|
|
470
|
-
var tmpQuery = libFoxHound.new(
|
|
471
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
471
472
|
.setDialect('ALASQL')
|
|
472
473
|
.setScope('Animal')
|
|
473
474
|
.setDistinct(true);
|
|
@@ -475,7 +476,7 @@ suite
|
|
|
475
476
|
// Build the query
|
|
476
477
|
tmpQuery.buildCountQuery();
|
|
477
478
|
// This is the query generated by the ALASQL dialect
|
|
478
|
-
|
|
479
|
+
_Fable.log.trace('Count Query', tmpQuery.query);
|
|
479
480
|
Expect(tmpQuery.query.body)
|
|
480
481
|
.to.equal('SELECT COUNT(*) AS RowCount FROM Animal;');
|
|
481
482
|
}
|
|
@@ -485,7 +486,7 @@ suite
|
|
|
485
486
|
'Count Query with Schema and Distinct',
|
|
486
487
|
function()
|
|
487
488
|
{
|
|
488
|
-
var tmpQuery = libFoxHound.new(
|
|
489
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
489
490
|
.setDialect('ALASQL')
|
|
490
491
|
.setScope('Animal')
|
|
491
492
|
.setDistinct(true);
|
|
@@ -494,7 +495,7 @@ suite
|
|
|
494
495
|
// Build the query
|
|
495
496
|
tmpQuery.buildCountQuery();
|
|
496
497
|
// This is the query generated by the ALASQL dialect
|
|
497
|
-
|
|
498
|
+
_Fable.log.trace('Count Query', tmpQuery.query);
|
|
498
499
|
Expect(tmpQuery.query.body)
|
|
499
500
|
.to.equal('SELECT COUNT(DISTINCT IDAnimal) AS RowCount FROM Animal WHERE `Deleted` = :Deleted_w0;');
|
|
500
501
|
}
|
|
@@ -512,7 +513,7 @@ suite
|
|
|
512
513
|
'Create Query',
|
|
513
514
|
function()
|
|
514
515
|
{
|
|
515
|
-
var tmpQuery = libFoxHound.new(
|
|
516
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
516
517
|
.setLogLevel(5)
|
|
517
518
|
.setDialect('ALASQL')
|
|
518
519
|
.setScope('Animal')
|
|
@@ -534,7 +535,7 @@ suite
|
|
|
534
535
|
// Build the query
|
|
535
536
|
tmpQuery.buildCreateQuery();
|
|
536
537
|
// This is the query generated by the ALASQL dialect
|
|
537
|
-
|
|
538
|
+
_Fable.log.trace('Create Query', tmpQuery.query);
|
|
538
539
|
Expect(tmpQuery.query.body)
|
|
539
540
|
.to.equal("INSERT INTO Animal ( `IDAnimal`, `GUIDAnimal`, `CreateDate`, `CreatingIDUser`, `UpdateDate`, `UpdatingIDUser`, `Deleted`, `Name`, `Age`) VALUES ( NULL, :GUIDAnimal_1, NOW(), :CreatingIDUser_3, NOW(), :UpdatingIDUser_5, :Deleted_6, :Name_7, :Age_8);");
|
|
540
541
|
}
|
|
@@ -544,7 +545,7 @@ suite
|
|
|
544
545
|
'Create Query -- with GUID specified',
|
|
545
546
|
function()
|
|
546
547
|
{
|
|
547
|
-
var tmpQuery = libFoxHound.new(
|
|
548
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
548
549
|
.setLogLevel(5)
|
|
549
550
|
.setDialect('ALASQL')
|
|
550
551
|
.setScope('Animal')
|
|
@@ -566,7 +567,7 @@ suite
|
|
|
566
567
|
// Build the query
|
|
567
568
|
tmpQuery.buildCreateQuery();
|
|
568
569
|
// This is the query generated by the ALASQL dialect
|
|
569
|
-
|
|
570
|
+
_Fable.log.trace('Create Query', tmpQuery.query);
|
|
570
571
|
Expect(tmpQuery.query.body)
|
|
571
572
|
.to.equal("INSERT INTO Animal ( `IDAnimal`, `GUIDAnimal`, `CreateDate`, `CreatingIDUser`, `UpdateDate`, `UpdatingIDUser`, `Deleted`, `Name`, `Age`) VALUES ( NULL, :GUIDAnimal_1, NOW(), :CreatingIDUser_3, NOW(), :UpdatingIDUser_5, :Deleted_6, :Name_7, :Age_8);");
|
|
572
573
|
}
|
|
@@ -576,7 +577,7 @@ suite
|
|
|
576
577
|
'Create Query - with AutoIdentity disabled',
|
|
577
578
|
function()
|
|
578
579
|
{
|
|
579
|
-
var tmpQuery = libFoxHound.new(
|
|
580
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
580
581
|
.setLogLevel(5)
|
|
581
582
|
.setDialect('ALASQL')
|
|
582
583
|
.setScope('Animal')
|
|
@@ -602,7 +603,7 @@ suite
|
|
|
602
603
|
// Build the query
|
|
603
604
|
tmpQuery.buildCreateQuery();
|
|
604
605
|
// This is the query generated by the ALASQL dialect
|
|
605
|
-
|
|
606
|
+
_Fable.log.trace('Create Query (AutoIdentity disabled)', tmpQuery.query);
|
|
606
607
|
Expect(tmpQuery.query.body)
|
|
607
608
|
.to.equal("INSERT INTO Animal ( `IDAnimal`, `GUIDAnimal`, `CreateDate`, `CreatingIDUser`, `UpdateDate`, `UpdatingIDUser`, `Deleted`, `DeletingIDUser`, `DeleteDate`, `Name`, `Age`) VALUES ( :IDAnimal_0, :GUIDAnimal_1, :CreateDate_2, :CreatingIDUser_3, :UpdateDate_4, :UpdatingIDUser_5, :Deleted_6, :DeletingIDUser_7, :DeleteDate_8, :Name_9, :Age_10);");
|
|
608
609
|
}
|
|
@@ -612,7 +613,7 @@ suite
|
|
|
612
613
|
'Complex Read Query 2, verify checking Deleted bit with no filters',
|
|
613
614
|
function()
|
|
614
615
|
{
|
|
615
|
-
var tmpQuery = libFoxHound.new(
|
|
616
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
616
617
|
.setDialect('ALASQL')
|
|
617
618
|
.setScope('Animal')
|
|
618
619
|
.setDataElements(['Name', 'Age', 'Cost'])
|
|
@@ -623,7 +624,7 @@ suite
|
|
|
623
624
|
// Build the query
|
|
624
625
|
tmpQuery.buildReadQuery();
|
|
625
626
|
// This is the query generated by the ALASQL dialect
|
|
626
|
-
|
|
627
|
+
_Fable.log.trace('Select Query', tmpQuery.query);
|
|
627
628
|
Expect(tmpQuery.query.body)
|
|
628
629
|
.to.equal('SELECT `Name`, `Age`, `Cost` FROM Animal WHERE `Deleted` = :Deleted_w0 LIMIT 100;');
|
|
629
630
|
}
|
|
@@ -633,7 +634,7 @@ suite
|
|
|
633
634
|
'Complex Read Query 2, manually checking Deleted bit with Schema that has one',
|
|
634
635
|
function()
|
|
635
636
|
{
|
|
636
|
-
var tmpQuery = libFoxHound.new(
|
|
637
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
637
638
|
.setDialect('ALASQL')
|
|
638
639
|
.setScope('Animal')
|
|
639
640
|
.setDataElements(['Name', 'Age', 'Cost'])
|
|
@@ -652,7 +653,7 @@ suite
|
|
|
652
653
|
// Build the query
|
|
653
654
|
tmpQuery.buildReadQuery();
|
|
654
655
|
// This is the query generated by the ALASQL dialect
|
|
655
|
-
|
|
656
|
+
_Fable.log.trace('Select Query', tmpQuery.query);
|
|
656
657
|
Expect(tmpQuery.query.body)
|
|
657
658
|
.to.equal('SELECT `Name`, `Age`, `Cost` FROM Animal WHERE `Age` = :Age_w0 AND ( `Color` = :Color_w2 OR `Color` = :Color_w3 ) AND `Description` IS NOT NULL AND `IDOffice` IN ( :IDOffice_w6 ) AND `Deleted` = :Deleted_w7 LIMIT 100;');
|
|
658
659
|
}
|
|
@@ -662,7 +663,7 @@ suite
|
|
|
662
663
|
'Complex Read Query 2, delete tracking disabled',
|
|
663
664
|
function()
|
|
664
665
|
{
|
|
665
|
-
var tmpQuery = libFoxHound.new(
|
|
666
|
+
var tmpQuery = libFoxHound.new(_Fable)
|
|
666
667
|
.setDialect('ALASQL')
|
|
667
668
|
.setScope('Animal')
|
|
668
669
|
.setDisableDeleteTracking(true)
|
|
@@ -674,7 +675,7 @@ suite
|
|
|
674
675
|
// Build the query
|
|
675
676
|
tmpQuery.buildReadQuery();
|
|
676
677
|
// This is the query generated by the ALASQL dialect
|
|
677
|
-
|
|
678
|
+
_Fable.log.trace('Select Query', tmpQuery.query);
|
|
678
679
|
Expect(tmpQuery.query.body)
|
|
679
680
|
.to.equal('SELECT `Name`, `Age`, `Cost` FROM Animal LIMIT 100;');
|
|
680
681
|
}
|
|
@@ -684,7 +685,7 @@ suite
|
|
|
684
685
|
'Delete Query with Filters',
|
|
685
686
|
function()
|
|
686
687
|
{
|
|
687
|
-
var tmpQuery = libFoxHound.new(
|
|
688
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
688
689
|
.setScope('Animal')
|
|
689
690
|
.addFilter('IDAnimal', 10);
|
|
690
691
|
//Perform delete with no record specified, but has a Deleted bit in the schema
|
|
@@ -695,7 +696,7 @@ suite
|
|
|
695
696
|
// Build the query
|
|
696
697
|
tmpQuery.buildDeleteQuery();
|
|
697
698
|
// This is the query generated by the ALASQL dialect
|
|
698
|
-
|
|
699
|
+
_Fable.log.trace('Delete Query', tmpQuery.query);
|
|
699
700
|
Expect(tmpQuery.query.body)
|
|
700
701
|
.to.equal('UPDATE Animal SET `UpdateDate` = NOW(), `Deleted` = 1, `DeletingIDUser` = :DeletingIDUser_2, `DeleteDate` = NOW() WHERE `IDAnimal` = :IDAnimal_w0 AND `Deleted` = :Deleted_w1;');
|
|
701
702
|
}
|
|
@@ -705,7 +706,7 @@ suite
|
|
|
705
706
|
'Undelete Query with Deleted Bit',
|
|
706
707
|
function()
|
|
707
708
|
{
|
|
708
|
-
var tmpQuery = libFoxHound.new(
|
|
709
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
709
710
|
.setScope('Animal')
|
|
710
711
|
.addFilter('IDAnimal', 10);
|
|
711
712
|
|
|
@@ -715,7 +716,7 @@ suite
|
|
|
715
716
|
// Build the query
|
|
716
717
|
tmpQuery.buildUndeleteQuery();
|
|
717
718
|
// This is the query generated by the ALASQL dialect
|
|
718
|
-
|
|
719
|
+
_Fable.log.trace('Undelete Query', tmpQuery.query);
|
|
719
720
|
Expect(tmpQuery.query.body)
|
|
720
721
|
.to.equal('UPDATE Animal SET `UpdateDate` = NOW(), `UpdatingIDUser` = :UpdatingIDUser_1, `Deleted` = 0 WHERE `IDAnimal` = :IDAnimal_w0;');
|
|
721
722
|
}
|
|
@@ -725,14 +726,14 @@ suite
|
|
|
725
726
|
'Undelete Query without Deleted Bit',
|
|
726
727
|
function()
|
|
727
728
|
{
|
|
728
|
-
var tmpQuery = libFoxHound.new(
|
|
729
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
729
730
|
.setScope('Animal')
|
|
730
731
|
.addFilter('IDAnimal', 10);
|
|
731
732
|
|
|
732
733
|
// Build the query
|
|
733
734
|
tmpQuery.buildUndeleteQuery();
|
|
734
735
|
// This is the query generated by the ALASQL dialect
|
|
735
|
-
|
|
736
|
+
_Fable.log.trace('Undelete Query', tmpQuery.query);
|
|
736
737
|
Expect(tmpQuery.query.body)
|
|
737
738
|
.to.equal('SELECT NULL;');
|
|
738
739
|
}
|
|
@@ -742,7 +743,7 @@ suite
|
|
|
742
743
|
'Update Query -- without Deleted',
|
|
743
744
|
function()
|
|
744
745
|
{
|
|
745
|
-
var tmpQuery = libFoxHound.new(
|
|
746
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
746
747
|
.setLogLevel(5)
|
|
747
748
|
.setScope('Animal')
|
|
748
749
|
.addFilter('IDAnimal', 9)
|
|
@@ -760,7 +761,7 @@ suite
|
|
|
760
761
|
// Build the query
|
|
761
762
|
tmpQuery.buildUpdateQuery();
|
|
762
763
|
// This is the query generated by the ALASQL dialect
|
|
763
|
-
|
|
764
|
+
_Fable.log.trace('Update Query', tmpQuery.query);
|
|
764
765
|
Expect(tmpQuery.query.body)
|
|
765
766
|
.to.equal('UPDATE Animal SET `GUIDAnimal` = :GUIDAnimal_0, `UpdateDate` = NOW(), `UpdatingIDUser` = :UpdatingIDUser_2, `Name` = :Name_3, `Age` = :Age_4 WHERE `IDAnimal` = :IDAnimal_w0;');
|
|
766
767
|
}
|
|
@@ -770,7 +771,7 @@ suite
|
|
|
770
771
|
'Update Query -- without Deleted, UpdateDate and UpdatingIDUser',
|
|
771
772
|
function()
|
|
772
773
|
{
|
|
773
|
-
var tmpQuery = libFoxHound.new(
|
|
774
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
774
775
|
.setLogLevel(5)
|
|
775
776
|
.setScope('Animal')
|
|
776
777
|
.addFilter('IDAnimal', 9)
|
|
@@ -790,7 +791,7 @@ suite
|
|
|
790
791
|
// Build the query
|
|
791
792
|
tmpQuery.buildUpdateQuery();
|
|
792
793
|
// This is the query generated by the ALASQL dialect
|
|
793
|
-
|
|
794
|
+
_Fable.log.trace('Update Query', tmpQuery.query);
|
|
794
795
|
Expect(tmpQuery.query.body)
|
|
795
796
|
.to.equal('UPDATE Animal SET `GUIDAnimal` = :GUIDAnimal_0, `Name` = :Name_1, `Age` = :Age_2 WHERE `IDAnimal` = :IDAnimal_w0;');
|
|
796
797
|
}
|
|
@@ -800,7 +801,7 @@ suite
|
|
|
800
801
|
'Delete Query -- without Deleted',
|
|
801
802
|
function()
|
|
802
803
|
{
|
|
803
|
-
var tmpQuery = libFoxHound.new(
|
|
804
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
804
805
|
.setLogLevel(5)
|
|
805
806
|
.setScope('Animal')
|
|
806
807
|
.addFilter('IDAnimal', 9)
|
|
@@ -812,7 +813,7 @@ suite
|
|
|
812
813
|
// Build the query
|
|
813
814
|
tmpQuery.buildDeleteQuery();
|
|
814
815
|
// This is the query generated by the ALASQL dialect
|
|
815
|
-
|
|
816
|
+
_Fable.log.trace('Delete Query', tmpQuery.query);
|
|
816
817
|
Expect(tmpQuery.query.body)
|
|
817
818
|
.to.equal('DELETE FROM Animal WHERE `IDAnimal` = :IDAnimal_w0;');
|
|
818
819
|
}
|
|
@@ -822,7 +823,7 @@ suite
|
|
|
822
823
|
'Update Query',
|
|
823
824
|
function()
|
|
824
825
|
{
|
|
825
|
-
var tmpQuery = libFoxHound.new(
|
|
826
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
826
827
|
.setLogLevel(5)
|
|
827
828
|
.setScope('Animal')
|
|
828
829
|
.addFilter('IDAnimal', 9)
|
|
@@ -844,7 +845,7 @@ suite
|
|
|
844
845
|
// Build the query
|
|
845
846
|
tmpQuery.buildUpdateQuery();
|
|
846
847
|
// This is the query generated by the ALASQL dialect
|
|
847
|
-
|
|
848
|
+
_Fable.log.trace('Update Query', tmpQuery.query);
|
|
848
849
|
Expect(tmpQuery.query.body)
|
|
849
850
|
.to.equal('UPDATE Animal SET `GUIDAnimal` = :GUIDAnimal_0, `UpdateDate` = NOW(), `UpdatingIDUser` = :UpdatingIDUser_2, `Deleted` = :Deleted_3, `Name` = :Name_4, `Age` = :Age_5 WHERE `IDAnimal` = :IDAnimal_w0 AND `Deleted` = :Deleted_w1;');
|
|
850
851
|
}
|
|
@@ -854,7 +855,7 @@ suite
|
|
|
854
855
|
'Delete Query',
|
|
855
856
|
function()
|
|
856
857
|
{
|
|
857
|
-
var tmpQuery = libFoxHound.new(
|
|
858
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
858
859
|
.setLogLevel(5)
|
|
859
860
|
.setScope('Animal')
|
|
860
861
|
.addFilter('IDAnimal', 9)
|
|
@@ -866,7 +867,7 @@ suite
|
|
|
866
867
|
// Build the query
|
|
867
868
|
tmpQuery.buildDeleteQuery();
|
|
868
869
|
// This is the query generated by the ALASQL dialect
|
|
869
|
-
|
|
870
|
+
_Fable.log.trace('Delete Query', tmpQuery.query);
|
|
870
871
|
Expect(tmpQuery.query.body)
|
|
871
872
|
.to.equal('UPDATE Animal SET `UpdateDate` = NOW(), `Deleted` = 1, `DeletingIDUser` = :DeletingIDUser_2, `DeleteDate` = NOW() WHERE `IDAnimal` = :IDAnimal_w0 AND `Deleted` = :Deleted_w1;');
|
|
872
873
|
}
|
|
@@ -876,7 +877,7 @@ suite
|
|
|
876
877
|
'Delete Query with Delete Tracking Disabled',
|
|
877
878
|
function()
|
|
878
879
|
{
|
|
879
|
-
var tmpQuery = libFoxHound.new(
|
|
880
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('ALASQL')
|
|
880
881
|
.setLogLevel(5)
|
|
881
882
|
.setScope('Animal')
|
|
882
883
|
.setDisableDeleteTracking(true)
|
|
@@ -889,7 +890,7 @@ suite
|
|
|
889
890
|
// Build the query
|
|
890
891
|
tmpQuery.buildDeleteQuery();
|
|
891
892
|
// This is the query generated by the ALASQL dialect
|
|
892
|
-
|
|
893
|
+
_Fable.log.trace('Delete Query', tmpQuery.query);
|
|
893
894
|
Expect(tmpQuery.query.body)
|
|
894
895
|
.to.equal('DELETE FROM Animal WHERE `IDAnimal` = :IDAnimal_w0;');
|
|
895
896
|
}
|