不要怂,就是干,撸起袖子干!

Commit 65cc93eb by Steffen Persch

added tests for postgres and sqlite

1 parent 48e3b6b9
...@@ -410,6 +410,16 @@ if (dialect.match(/^postgres/)) { ...@@ -410,6 +410,16 @@ if (dialect.match(/^postgres/)) {
arguments: ['mySchema.myTable', {where: {name: "foo';DROP TABLE mySchema.myTable;"}}], arguments: ['mySchema.myTable', {where: {name: "foo';DROP TABLE mySchema.myTable;"}}],
expectation: "SELECT * FROM mySchema.myTable WHERE mySchema.myTable.name='foo'';DROP TABLE mySchema.myTable;';", expectation: "SELECT * FROM mySchema.myTable WHERE mySchema.myTable.name='foo'';DROP TABLE mySchema.myTable;';",
context: {options: {quoteIdentifiers: false}} context: {options: {quoteIdentifiers: false}}
}, {
title: 'use != if ne !== null',
arguments: ['myTable', {where: {field: {ne: 0}}}],
expectation: "SELECT * FROM myTable WHERE myTable.field != 0;",
context: QueryGenerator
}, {
title: 'use IS NOT if ne === null',
arguments: ['myTable', {where: {field: {ne: null}}}],
expectation: "SELECT * FROM myTable WHERE myTable.field IS NOT NULL;",
context: QueryGenerator
} }
], ],
......
...@@ -260,6 +260,16 @@ if (dialect === 'sqlite') { ...@@ -260,6 +260,16 @@ if (dialect === 'sqlite') {
arguments: ['myTable', {where: { field: new Buffer("Sequelize")}}], arguments: ['myTable', {where: { field: new Buffer("Sequelize")}}],
expectation: "SELECT * FROM `myTable` WHERE `myTable`.`field`=X'53657175656c697a65';", expectation: "SELECT * FROM `myTable` WHERE `myTable`.`field`=X'53657175656c697a65';",
context: QueryGenerator context: QueryGenerator
}, {
title: 'use != if ne !== null',
arguments: ['myTable', {where: {field: {ne: 0}}}],
expectation: "SELECT * FROM `myTable` WHERE `myTable`.`field` != 0;",
context: QueryGenerator
}, {
title: 'use IS NOT if ne === null',
arguments: ['myTable', {where: {field: {ne: null}}}],
expectation: "SELECT * FROM `myTable` WHERE `myTable`.`field` IS NOT NULL;",
context: QueryGenerator
} }
], ],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!