Skip to content

Commit 0ac5c25

Browse files
committed
1 parent f6e8e39 commit 0ac5c25

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

test/driver/base_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ vows.describe('base').addBatch({
6262
},
6363

6464
'escapes single quotes': function(base) {
65-
assert.equal("Bill's Mother's House", base.escape("Bill's Mother's House"));
65+
assert.equal("Bill''s Mother''s House", base.escape("Bill's Mother's House"));
6666
}
6767
}
6868
}).export(module);

test/driver/mysql_test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,27 @@ driver.connect({ driver: 'mysql', database: 'db_migrate_test', user:'root' }, fu
412412
}
413413
}
414414
}).addBatch({
415+
'insertWithSingleQuotes': {
416+
topic: function() {
417+
db.createTable('event', {
418+
id: { type: dataType.INTEGER, primaryKey: true, autoIncrement: true },
419+
title: { type: dataType.STRING }
420+
}, function() {
421+
db.insert('event', ['id','title'], [2,"Bill's Mother's House"], this.callback.bind(this, null));
422+
}.bind(this));
423+
},
424+
425+
teardown: function() {
426+
db.dropTable('event', this.callback);
427+
},
428+
429+
'with additional row' : function() {
430+
db.runSql("SELECT * from event", function(err, data) {
431+
assert.equal(data.length, 1);
432+
});
433+
}
434+
}
435+
}).addBatch({
415436
'removeIndex': {
416437
topic: function() {
417438
db.createTable('event', {

test/driver/pg_test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,27 @@ driver.connect({ driver: 'pg', database: 'db_migrate_test' }, function(err, db)
354354
}
355355
}
356356
}).addBatch({
357+
'insertWithSingleQuotes': {
358+
topic: function() {
359+
db.createTable('event', {
360+
id: { type: dataType.INTEGER, primaryKey: true, autoIncrement: true },
361+
title: { type: dataType.STRING }
362+
}, function(err) {
363+
db.insert('event', ['id','title'], [2,"Bill's Mother's House"], this.callback.bind(this, null));
364+
}.bind(this));
365+
},
366+
367+
'with additional row' : function() {
368+
db.runSql("SELECT * from event", function(err, data) {
369+
assert.equal(data.rowCount, 1);
370+
});
371+
},
372+
373+
teardown: function() {
374+
db.dropTable('event', this.callback);
375+
}
376+
}
377+
}).addBatch({
357378
'removeIndex': {
358379
topic: function() {
359380
db.createTable('event', {

test/driver/sqlite3_test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,31 @@ vows.describe('sqlite3').addBatch({
283283
}
284284
}
285285
}).addBatch({
286+
'insertWithSingleQuotes': {
287+
topic: function () {
288+
driver.connect({ driver: 'sqlite3', filename: 'test.db' }, function (err, db) {
289+
db.createTable('event', {
290+
id: { type: dataType.INTEGER, primaryKey: true, autoIncrement: true },
291+
title: { type: dataType.STRING }
292+
}, function () {
293+
db.insert('event', ['id', 'title'], [2, "Bill's Mother's House"], this.callback.bind(this, null, db));
294+
}.bind(this));
295+
}.bind(this));
296+
},
297+
298+
teardown: function (db) {
299+
db.close(function (err) {
300+
fs.unlink('test.db', this.callback);
301+
});
302+
},
303+
304+
'with additional row': function (db) {
305+
db.all("SELECT * from event;", function (err, data) {
306+
assert.equal(data.length, 1);
307+
});
308+
}
309+
}
310+
}).addBatch({
286311
'removeIndex': {
287312
topic: function () {
288313
driver.connect({ driver: 'sqlite3', filename: 'test.db' }, function (err, db) {

0 commit comments

Comments
 (0)