@@ -7,43 +7,44 @@ module.exports = function(connection) {
7
7
const stPrefix = serverVersion [ 0 ] === '8' ? 'ST_' : '' ;
8
8
9
9
return [
10
- { type : 'decimal(4,3)' , insert : '1.234' } ,
10
+ { type : 'decimal(4,3)' , insert : '1.234' , columnType : 'NEWDECIMAL' } ,
11
11
// {type: 'decimal(3,3)', insert: 0.33},
12
- { type : 'tinyint' , insert : 1 } ,
13
- { type : 'smallint' , insert : 2 } ,
14
- { type : 'int' , insert : 3 } ,
15
- { type : 'float' , insert : 4.5 } ,
16
- { type : 'double' , insert : 5.5 } ,
17
- { type : 'bigint' , insert : '6' , expect : 6 } ,
18
- { type : 'bigint' , insert : 6 } ,
19
- { type : 'mediumint' , insert : 7 } ,
20
- { type : 'year' , insert : 2012 } ,
21
- { type : 'timestamp' , insert : new Date ( '2012-05-12 11:00:23' ) } ,
22
- { type : 'datetime' , insert : new Date ( '2012-05-12 12:00:23' ) } ,
23
- { type : 'date' , insert : new Date ( '2012-05-12 00:00:00' ) } ,
24
- { type : 'time' , insert : '13:13:23' } ,
25
- { type : 'time' , insert : '-13:13:23' } ,
26
- { type : 'time' , insert : '413:13:23' } ,
27
- { type : 'time' , insert : '-413:13:23' } ,
28
- { type : 'binary(4)' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) } ,
29
- { type : 'varbinary(4)' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) } ,
30
- { type : 'tinyblob' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) } ,
31
- { type : 'mediumblob' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) } ,
32
- { type : 'longblob' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) } ,
33
- { type : 'blob' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) } ,
34
- { type : 'bit(32)' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) } ,
35
- { type : 'char(5)' , insert : 'Hello' } ,
36
- { type : 'varchar(5)' , insert : 'Hello' } ,
37
- { type : 'varchar(3) character set utf8 collate utf8_bin' , insert : 'bin' } ,
38
- { type : 'tinytext' , insert : 'Hello World' } ,
39
- { type : 'mediumtext' , insert : 'Hello World' } ,
40
- { type : 'longtext' , insert : 'Hello World' } ,
41
- { type : 'text' , insert : 'Hello World' } ,
12
+ { type : 'tinyint' , insert : 1 , columnType : 'TINY' } ,
13
+ { type : 'smallint' , insert : 2 , columnType : 'SHORT' } ,
14
+ { type : 'int' , insert : 3 , columnType : 'LONG' } ,
15
+ { type : 'float' , insert : 4.5 , columnType : 'FLOAT' } ,
16
+ { type : 'double' , insert : 5.5 , columnType : 'DOUBLE' } ,
17
+ { type : 'bigint' , insert : '6' , expect : 6 , columnType : 'LONGLONG' } ,
18
+ { type : 'bigint' , insert : 6 , columnType : 'LONGLONG' } ,
19
+ { type : 'mediumint' , insert : 7 , columnType : 'INT24' } ,
20
+ { type : 'year' , insert : 2012 , columnType : 'YEAR' } ,
21
+ { type : 'timestamp' , insert : new Date ( '2012-05-12 11:00:23' ) , columnType : 'TIMESTAMP' } ,
22
+ { type : 'datetime' , insert : new Date ( '2012-05-12 12:00:23' ) , columnType : 'DATETIME' } ,
23
+ { type : 'date' , insert : new Date ( '2012-05-12 00:00:00' ) , columnType : 'DATE' } ,
24
+ { type : 'time' , insert : '13:13:23' , columnType : 'TIME' } ,
25
+ { type : 'time' , insert : '-13:13:23' , columnType : 'TIME' } ,
26
+ { type : 'time' , insert : '413:13:23' , columnType : 'TIME' } ,
27
+ { type : 'time' , insert : '-413:13:23' , columnType : 'TIME' } ,
28
+ { type : 'binary(4)' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) , columnType : 'STRING' } ,
29
+ { type : 'varbinary(4)' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) , columnType : 'VAR_STRING' } ,
30
+ { type : 'tinyblob' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) , columnType : 'BLOB' } ,
31
+ { type : 'mediumblob' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) , columnType : 'BLOB' } ,
32
+ { type : 'longblob' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) , columnType : 'BLOB' } ,
33
+ { type : 'blob' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) , columnType : 'BLOB' } ,
34
+ { type : 'bit(32)' , insert : Buffer . from ( [ 0 , 1 , 254 , 255 ] ) , columnType : 'BIT' } ,
35
+ { type : 'char(5)' , insert : 'Hello' , columnType : 'STRING' } ,
36
+ { type : 'varchar(5)' , insert : 'Hello' , columnType : 'VAR_STRING' } ,
37
+ { type : 'varchar(3) character set utf8 collate utf8_bin' , insert : 'bin' , columnType : 'VAR_STRING' } ,
38
+ { type : 'tinytext' , insert : 'Hello World' , columnType : 'BLOB' } ,
39
+ { type : 'mediumtext' , insert : 'Hello World' , columnType : 'BLOB' } ,
40
+ { type : 'longtext' , insert : 'Hello World' , columnType : 'BLOB' } ,
41
+ { type : 'text' , insert : 'Hello World' , columnType : 'BLOB' } ,
42
42
{
43
43
type : 'point' ,
44
44
insertRaw : 'POINT(1.2,-3.4)' ,
45
45
expect : { x : 1.2 , y : - 3.4 } ,
46
- deep : true
46
+ deep : true ,
47
+ columnType : 'GEOMETRY'
47
48
} ,
48
49
{
49
50
type : 'point' ,
@@ -56,14 +57,16 @@ module.exports = function(connection) {
56
57
return `${ stPrefix } GeomFromWKB(${ connection . escape ( buffer ) } )` ;
57
58
} ) ( ) ,
58
59
expect : { x : - 5.6 , y : 10.23 } ,
59
- deep : true
60
+ deep : true ,
61
+ columnType : 'GEOMETRY'
60
62
} ,
61
- { type : 'point' , insertRaw : '' , insert : null , expect : null } ,
63
+ { type : 'point' , insertRaw : '' , insert : null , expect : null , columnType : 'GEOMETRY' } ,
62
64
{
63
65
type : 'linestring' ,
64
66
insertRaw : 'LINESTRING(POINT(1.2,-3.4),POINT(-5.6,10.23),POINT(0.2,0.7))' ,
65
67
expect : [ { x : 1.2 , y : - 3.4 } , { x : - 5.6 , y : 10.23 } , { x : 0.2 , y : 0.7 } ] ,
66
- deep : true
68
+ deep : true ,
69
+ columnType : 'GEOMETRY'
67
70
} ,
68
71
{
69
72
type : 'polygon' ,
@@ -84,19 +87,22 @@ module.exports = function(connection) {
84
87
{ x : 5 , y : 5 }
85
88
]
86
89
] ,
87
- deep : true
90
+ deep : true ,
91
+ columnType : 'GEOMETRY'
88
92
} ,
89
93
{
90
94
type : 'geometry' ,
91
95
insertRaw : 'POINT(1.2,-3.4)' ,
92
96
expect : { x : 1.2 , y : - 3.4 } ,
93
- deep : true
97
+ deep : true ,
98
+ columnType : 'GEOMETRY'
94
99
} ,
95
100
{
96
101
type : 'multipoint' ,
97
102
insertRaw : `${ stPrefix } GeomFromText('MULTIPOINT(0 0, 20 20, 60 60)')` ,
98
103
expect : [ { x : 0 , y : 0 } , { x : 20 , y : 20 } , { x : 60 , y : 60 } ] ,
99
- deep : true
104
+ deep : true ,
105
+ columnType : 'GEOMETRY'
100
106
} ,
101
107
{
102
108
type : 'multilinestring' ,
@@ -105,7 +111,8 @@ module.exports = function(connection) {
105
111
[ { x : 10 , y : 10 } , { x : 20 , y : 20 } ] ,
106
112
[ { x : 15 , y : 15 } , { x : 30 , y : 15 } ]
107
113
] ,
108
- deep : true
114
+ deep : true ,
115
+ columnType : 'GEOMETRY'
109
116
} ,
110
117
{
111
118
type : 'multipolygon' ,
@@ -130,7 +137,8 @@ module.exports = function(connection) {
130
137
]
131
138
]
132
139
] ,
133
- deep : true
140
+ deep : true ,
141
+ columnType : 'GEOMETRY'
134
142
} ,
135
143
{
136
144
type : 'geometrycollection' ,
@@ -140,7 +148,8 @@ module.exports = function(connection) {
140
148
{ x : 31 , y : 30 } ,
141
149
[ { x : 15 , y : 15 } , { x : 20 , y : 20 } ]
142
150
] ,
143
- deep : true
151
+ deep : true ,
152
+ columnType : 'GEOMETRY'
144
153
}
145
154
] ;
146
155
} ;
0 commit comments