浏览代码

Fix issue with NO_AUTO_CREATE_USER option in sql_mode

Luiz Paulo 10 年之前
父节点
当前提交
7ec062f236
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      driver_test.go

+ 3 - 3
driver_test.go

@@ -1018,7 +1018,7 @@ func TestFoundRows(t *testing.T) {
 
 
 func TestStrict(t *testing.T) {
 func TestStrict(t *testing.T) {
 	// ALLOW_INVALID_DATES to get rid of stricter modes - we want to test for warnings, not errors
 	// ALLOW_INVALID_DATES to get rid of stricter modes - we want to test for warnings, not errors
-	relaxedDsn := dsn + "&sql_mode=ALLOW_INVALID_DATES"
+	relaxedDsn := dsn + "&sql_mode='ALLOW_INVALID_DATES,NO_AUTO_CREATE_USER'"
 	// make sure the MySQL version is recent enough with a separate connection
 	// make sure the MySQL version is recent enough with a separate connection
 	// before running the test
 	// before running the test
 	conn, err := MySQLDriver{}.Open(relaxedDsn)
 	conn, err := MySQLDriver{}.Open(relaxedDsn)
@@ -1643,7 +1643,7 @@ func TestSqlInjection(t *testing.T) {
 
 
 	dsns := []string{
 	dsns := []string{
 		dsn,
 		dsn,
-		dsn + "&sql_mode=NO_BACKSLASH_ESCAPES",
+		dsn + "&sql_mode='NO_BACKSLASH_ESCAPES,NO_AUTO_CREATE_USER'",
 	}
 	}
 	for _, testdsn := range dsns {
 	for _, testdsn := range dsns {
 		runTests(t, testdsn, createTest("1 OR 1=1"))
 		runTests(t, testdsn, createTest("1 OR 1=1"))
@@ -1673,7 +1673,7 @@ func TestInsertRetrieveEscapedData(t *testing.T) {
 
 
 	dsns := []string{
 	dsns := []string{
 		dsn,
 		dsn,
-		dsn + "&sql_mode=NO_BACKSLASH_ESCAPES",
+		dsn + "&sql_mode='NO_BACKSLASH_ESCAPES,NO_AUTO_CREATE_USER'",
 	}
 	}
 	for _, testdsn := range dsns {
 	for _, testdsn := range dsns {
 		runTests(t, testdsn, testData)
 		runTests(t, testdsn, testData)