You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mysql_test.go
+143Lines changed: 143 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,10 @@
6
6
package mysql
7
7
8
8
import (
9
+
"fmt"
9
10
"os"
11
+
"rand"
12
+
"strconv"
10
13
"testing"
11
14
)
12
15
@@ -18,6 +21,8 @@ const (
18
21
// create user gomysql_test@localhost identified by 'abc123';
19
22
// grant all privileges on gomysql_test.* to gomysql_test@localhost;
20
23
// grant all privileges on gomysql_test2.* to gomysql_test@localhost;
24
+
25
+
// Testing settings
21
26
TEST_HOST="localhost"
22
27
TEST_PORT="3306"
23
28
TEST_SOCK="/var/run/mysqld/mysqld.sock"
@@ -28,6 +33,17 @@ const (
28
33
TEST_DBNAME2="gomysql_test2"// This is a privileged database used to test changedb etc
29
34
TEST_DBNAMEUP="gomysql_test3"// This is an unprivileged database
30
35
TEST_DBNAMEBAD="gomysql_bad"// This is a nonexistant database
36
+
37
+
// Simple table queries
38
+
CREATE_SIMPLE="CREATE TABLE `simple` (`id` SERIAL NOT NULL, `number` BIGINT NOT NULL, `string` VARCHAR(32) NOT NULL, `text` TEXT NOT NULL, `datetime` DATETIME NOT NULL) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci COMMENT = 'GoMySQL Test Suite Simple Table';"
39
+
SELECT_SIMPLE="SELECT * FROM simple"
40
+
INSERT_SIMPLE="INSERT INTO simple VALUES (null, %d, '%s', '%s', NOW())"
41
+
UPDATE_SIMPLE="UPDATE simple SET `text` = '%s', `datetime` = NOW() WHERE id = %d"
42
+
DROP_SIMPLE="DROP TABLE `simple`"
43
+
44
+
// All types table queries
45
+
CREATE_ALLTYPES="CREATE TABLE `all_types` (`id` SERIAL NOT NULL, `tiny_int` TINYINT NOT NULL, `tiny_uint` TINYINT UNSIGNED NOT NULL, `small_int` SMALLINT NOT NULL, `small_uint` SMALLINT UNSIGNED NOT NULL, `medium_int` MEDIUMINT NOT NULL, `medium_uint` MEDIUMINT UNSIGNED NOT NULL, `int` INT NOT NULL, `uint` INT UNSIGNED NOT NULL, `big_int` BIGINT NOT NULL, `big_uint` BIGINT UNSIGNED NOT NULL, `decimal` DECIMAL(10,4) NOT NULL, `float` FLOAT NOT NULL, `double` DOUBLE NOT NULL, `real` REAL NOT NULL, `bit` BIT(32) NOT NULL, `boolean` BOOLEAN NOT NULL, `date` DATE NOT NULL, `datetime` DATETIME NOT NULL, `timestamp` TIMESTAMP NOT NULL, `time` TIME NOT NULL, `year` YEAR NOT NULL, `char` CHAR(32) NOT NULL, `varchar` VARCHAR(32) NOT NULL, `tiny_text` TINYTEXT NOT NULL, `text` TEXT NOT NULL, `medium_text` MEDIUMTEXT NOT NULL, `long_text` LONGTEXT NOT NULL, `binary` BINARY(32) NOT NULL, `var_binary` VARBINARY(32) NOT NULL, `tiny_blob` TINYBLOB NOT NULL, `medium_blob` MEDIUMBLOB NOT NULL, `blob` BLOB NOT NULL, `long_blob` LONGBLOB NOT NULL, `enum` ENUM('a','b','c','d','e') NOT NULL, `set` SET('a','b','c','d','e') NOT NULL, `geometry` GEOMETRY NOT NULL) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci COMMENT = 'GoMySQL Test Suite All Types Table'"
0 commit comments