Permalink
Browse files

Fix tests if sql_mode include STRICT_(TRANS|ALL)_TABLES

  • Loading branch information...
1 parent 61d998c commit b2901d3a3f11e2790d6218dcedcadb377f619bf4 @Sannis committed Sep 9, 2012
View
@@ -12,3 +12,6 @@ before_script:
- "mysql -uroot -e \"CREATE DATABASE IF NOT EXISTS test_allowed DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;\""
- "mysql -uroot -e \"GRANT ALL PRIVILEGES ON test_allowed.* TO 'test_user'@'localhost' IDENTIFIED BY '1234';\""
- "mysql -uroot -e \"CREATE DATABASE IF NOT EXISTS test_denied DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;\""
+ # Some extras for Travis-CI only
+ - "mysql -uroot -e \"DELETE FROM mysql.user WHERE User = 'travis';\""
+ - "mysql -uroot -e \"FLUSH PRIVILEGES;\""
@@ -25,8 +25,8 @@ exports.createTestTableSimple = function (test) {
conn.querySync("DROP TABLE IF EXISTS " + cfg.test_table + ";");
conn.querySync("CREATE TABLE " + cfg.test_table +
" (id INT(8) NOT NULL AUTO_INCREMENT, " +
- "random_number INT(8) NOT NULL, " +
- "random_boolean BOOLEAN NOT NULL, " +
+ "random_number INT(8) NOT NULL DEFAULT 10, " +
+ "random_boolean BOOLEAN NOT NULL DEFAULT 1, " +
"PRIMARY KEY(id)) " + cfg.store_engine + ";");
res = conn.querySync("SHOW TABLES");
test.ok(res.fieldCount === 1, "SHOW TABLES result field count === 1");
@@ -95,18 +95,18 @@ var testBindParamsAndExecuteSync = function (test) {
res = conn.querySync("DELETE FROM " + cfg.test_table + ";");
test.strictEqual(res, true);
- res = conn.querySync("ALTER TABLE " + cfg.test_table + " ADD title VARCHAR(255), ADD number DOUBLE, ADD for_null INT;");
+ res = conn.querySync("ALTER TABLE " + cfg.test_table + " ADD title VARCHAR(255), ADD number DOUBLE, ADD for_null INT NULL;");
test.strictEqual(res, true);
stmt2 = conn.initStatementSync();
test.ok(stmt2);
test.ok(stmt2.prepareSync("INSERT INTO " + cfg.test_table + " (title, number, for_null) VALUES (?, ?, ?);"));
- test.equals(stmt2.paramCount, 3, "Param count in INSERT INTO test_table (title, number, for_null) VALUES (?, ?, ?) query");
+ test.equals(stmt2.paramCount, 3);
test.ok(stmt2.bindParamsSync([test_string, test_double, null]), "stmt.bindParamSync([test_string, test_double, null])");
test.ok(stmt2.executeSync(), "stmt.bindParamSync([test_string, test_double, null]).executeSync()");
-
+
res = conn.querySync("SELECT title, number, for_null from " + cfg.test_table + ";");
rows = res.fetchAllSync();
test.same(rows, [{title: test_string, number: test_double, for_null: null}], "conn.querySync('SELECT title, number, for_null ... ').fetchAllSync()");
@@ -132,7 +132,7 @@ var testBindParamsAndExecuteSync = function (test) {
test.ok(stmt3.bindParamsSync([date, time_in, datetime, timestamp]), "stmt.bindParamSync([date, time_in, datetime, timestamp])");
test.ok(stmt3.executeSync(), "stmt.bindParamSync([date, time_in, datetime, timestamp]).executeSync()");
-
+
res = conn.querySync("SELECT date, time, datetime, timestamp from " + cfg.test_table + ";");
rows = res.fetchAllSync();

0 comments on commit b2901d3

Please sign in to comment.