|
|
@ -4,6 +4,11 @@ var Harness = require('./support'); |
|
|
|
var post = Harness.definePostTable(); |
|
|
|
var user = Harness.defineUserTable(); |
|
|
|
|
|
|
|
var arrayTable = require('../../lib/table').define({ |
|
|
|
name: 'arraytest', |
|
|
|
columns: ['id', 'numbers'] |
|
|
|
}); |
|
|
|
|
|
|
|
Harness.test({ |
|
|
|
query: post.insert(post.content.value('test'), post.userId.value(1)), |
|
|
|
pg: { |
|
|
@ -630,3 +635,43 @@ Harness.test({ |
|
|
|
}, |
|
|
|
params: [] |
|
|
|
}); |
|
|
|
|
|
|
|
Harness.test({ |
|
|
|
query: arrayTable.insert(arrayTable.id.value(1), arrayTable.numbers.value([2, 3, 4])), |
|
|
|
pg: { |
|
|
|
text : 'INSERT INTO "arraytest" ("id", "numbers") VALUES ($1, $2)', |
|
|
|
string: 'INSERT INTO "arraytest" ("id", "numbers") VALUES (1, \'{2,3,4}\')' |
|
|
|
}, |
|
|
|
sqlite: { |
|
|
|
text : 'INSERT INTO "arraytest" ("id", "numbers") VALUES ($1, $2)', |
|
|
|
string: 'INSERT INTO "arraytest" ("id", "numbers") VALUES (1, \'[2,3,4]\')' |
|
|
|
}, |
|
|
|
mysql: { |
|
|
|
text : 'INSERT INTO `arraytest` (`id`, `numbers`) VALUES (?, ?)', |
|
|
|
string: 'INSERT INTO `arraytest` (`id`, `numbers`) VALUES (1, (2, 3, 4))' |
|
|
|
}, |
|
|
|
oracle: { |
|
|
|
text : 'INSERT INTO "arraytest" ("id", "numbers") VALUES (:1, :2)', |
|
|
|
string: 'INSERT INTO "arraytest" ("id", "numbers") VALUES (1, (2, 3, 4))' |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
Harness.test({ |
|
|
|
query: arrayTable.insert(arrayTable.id.value(1), arrayTable.numbers.value(["one", "two", "three"])), |
|
|
|
pg: { |
|
|
|
text : 'INSERT INTO "arraytest" ("id", "numbers") VALUES ($1, $2)', |
|
|
|
string: 'INSERT INTO "arraytest" ("id", "numbers") VALUES (1, \'{"one","two","three"}\')' |
|
|
|
}, |
|
|
|
sqlite: { |
|
|
|
text : 'INSERT INTO "arraytest" ("id", "numbers") VALUES ($1, $2)', |
|
|
|
string: 'INSERT INTO "arraytest" ("id", "numbers") VALUES (1, \'["one","two","three"]\')' |
|
|
|
}, |
|
|
|
mysql: { |
|
|
|
text : 'INSERT INTO `arraytest` (`id`, `numbers`) VALUES (?, ?)', |
|
|
|
string: 'INSERT INTO `arraytest` (`id`, `numbers`) VALUES (1, (\'one\', \'two\', \'three\'))' |
|
|
|
}, |
|
|
|
oracle: { |
|
|
|
text : 'INSERT INTO "arraytest" ("id", "numbers") VALUES (:1, :2)', |
|
|
|
string: 'INSERT INTO "arraytest" ("id", "numbers") VALUES (1, (\'one\', \'two\', \'three\'))' |
|
|
|
} |
|
|
|
}); |
|
|
|