File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,12 +93,71 @@ function testFloats(){
9393 # REAL[(length,decimals)] [UNSIGNED] [ZEROFILL]
9494 # DOUBLE[(length,decimals)] [UNSIGNED] [ZEROFILL]
9595 # FLOAT[(length,decimals)] [UNSIGNED] [ZEROFILL]
96+
97+ $ tbl = $ this ->get_first_table ("CREATE TABLE foo (bar REAL) " );
98+ $ this ->assertEquals ($ tbl ['fields ' ], [
99+ [
100+ 'name ' => "bar " ,
101+ 'type ' => "REAL " ,
102+ ]
103+ ]);
104+
105+ $ tbl = $ this ->get_first_table ("CREATE TABLE foo (bar double (1,2)) " );
106+ $ this ->assertEquals ($ tbl ['fields ' ], [
107+ [
108+ 'name ' => "bar " ,
109+ 'type ' => "DOUBLE " ,
110+ 'length ' => 1 ,
111+ 'decimals ' => 2 ,
112+ ]
113+ ]);
114+
115+ $ tbl = $ this ->get_first_table ("CREATE TABLE foo (bar Float(3,4) UNSIGNED ZEROFILL) " );
116+ $ this ->assertEquals ($ tbl ['fields ' ], [
117+ [
118+ 'name ' => "bar " ,
119+ 'type ' => "FLOAT " ,
120+ 'length ' => 3 ,
121+ 'decimals ' => 4 ,
122+ 'unsigned ' => true ,
123+ 'zerofill ' => true ,
124+ ]
125+ ]);
96126 }
97127
98128 function testNumerics (){
99129
100130 # DECIMAL[(length[,decimals])] [UNSIGNED] [ZEROFILL]
101131 # NUMERIC[(length[,decimals])] [UNSIGNED] [ZEROFILL]
132+
133+ $ tbl = $ this ->get_first_table ("CREATE TABLE foo (bar Decimal) " );
134+ $ this ->assertEquals ($ tbl ['fields ' ], [
135+ [
136+ 'name ' => "bar " ,
137+ 'type ' => "DECIMAL " ,
138+ ]
139+ ]);
140+
141+ $ tbl = $ this ->get_first_table ("CREATE TABLE foo (bar DECIMAL(1) UNSIGNED) " );
142+ $ this ->assertEquals ($ tbl ['fields ' ], [
143+ [
144+ 'name ' => "bar " ,
145+ 'type ' => "DECIMAL " ,
146+ 'length ' => 1 ,
147+ 'unsigned ' => true ,
148+ ]
149+ ]);
150+
151+ $ tbl = $ this ->get_first_table ("CREATE TABLE foo (bar NUMERIC(1,2) ZEROFILL) " );
152+ $ this ->assertEquals ($ tbl ['fields ' ], [
153+ [
154+ 'name ' => "bar " ,
155+ 'type ' => "NUMERIC " ,
156+ 'length ' => 1 ,
157+ 'decimals ' => 2 ,
158+ 'zerofill ' => true ,
159+ ]
160+ ]);
102161 }
103162
104163 function testTimes (){
You can’t perform that action at this time.
0 commit comments