@@ -922,16 +922,17 @@ public void test08_InsertAllColumnTypes() throws SQLException {
922922 dialect .dialect == Dialect .POSTGRESQL );
923923 String sql =
924924 "INSERT INTO TableWithAllColumnTypes ("
925- + "ColInt64, ColFloat64, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, ColJson, "
926- + "ColInt64Array, ColFloat64Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray, ColJsonArray"
927- + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ;
925+ + "ColInt64, ColFloat64, ColFloat32, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, ColJson, "
926+ + "ColInt64Array, ColFloat64Array, ColFloat32Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray, ColJsonArray"
927+ + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ? , ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ;
928928 try (Connection con = createConnection (env , database )) {
929929 try (PreparedStatement ps = con .prepareStatement (sql )) {
930930 ParameterMetaData metadata = ps .getParameterMetaData ();
931- assertEquals (22 , metadata .getParameterCount ());
931+ assertEquals (24 , metadata .getParameterCount ());
932932 int index = 0 ;
933933 assertEquals (Types .BIGINT , metadata .getParameterType (++index ));
934934 assertEquals (Types .DOUBLE , metadata .getParameterType (++index ));
935+ assertEquals (Types .REAL , metadata .getParameterType (++index ));
935936 assertEquals (Types .BOOLEAN , metadata .getParameterType (++index ));
936937 assertEquals (Types .NVARCHAR , metadata .getParameterType (++index ));
937938 assertEquals (Types .NVARCHAR , metadata .getParameterType (++index ));
@@ -952,10 +953,12 @@ public void test08_InsertAllColumnTypes() throws SQLException {
952953 assertEquals (Types .ARRAY , metadata .getParameterType (++index ));
953954 assertEquals (Types .ARRAY , metadata .getParameterType (++index ));
954955 assertEquals (Types .ARRAY , metadata .getParameterType (++index ));
956+ assertEquals (Types .ARRAY , metadata .getParameterType (++index ));
955957
956958 index = 0 ;
957959 ps .setLong (++index , 1L );
958960 ps .setDouble (++index , 2D );
961+ ps .setFloat (++index , 3.14f );
959962 ps .setBoolean (++index , true );
960963 ps .setString (++index , "test" );
961964 ps .setObject (++index , UUID .fromString ("2d37f522-e0a5-4f22-8e09-4d77d299c967" ));
@@ -968,6 +971,7 @@ public void test08_InsertAllColumnTypes() throws SQLException {
968971
969972 ps .setArray (++index , con .createArrayOf ("INT64" , new Long [] {1L , 2L , 3L }));
970973 ps .setArray (++index , con .createArrayOf ("FLOAT64" , new Double [] {1.1D , 2.2D , 3.3D }));
974+ ps .setArray (++index , con .createArrayOf ("FLOAT32" , new Float [] {1.1f , 2.2f , 3.3f }));
971975 ps .setArray (
972976 ++index , con .createArrayOf ("BOOL" , new Boolean [] {Boolean .TRUE , null , Boolean .FALSE }));
973977 ps .setArray (++index , con .createArrayOf ("STRING" , new String [] {"1" , "2" , "3" }));
@@ -1006,6 +1010,7 @@ public void test08_InsertAllColumnTypes() throws SQLException {
10061010 assertTrue (rs .next ());
10071011 assertEquals (1L , rs .getLong (++index ));
10081012 assertEquals (2d , rs .getDouble (++index ), 0.0d );
1013+ assertEquals (3.14f , rs .getFloat (++index ), 0.0f );
10091014 assertTrue (rs .getBoolean (++index ));
10101015 assertEquals ("test" , rs .getString (++index ));
10111016 assertEquals ("2d37f522-e0a5-4f22-8e09-4d77d299c967" , rs .getString (++index ));
@@ -1020,6 +1025,8 @@ public void test08_InsertAllColumnTypes() throws SQLException {
10201025 assertArrayEquals (new Long [] {1L , 2L , 3L }, (Long []) rs .getArray (++index ).getArray ());
10211026 assertArrayEquals (
10221027 new Double [] {1.1D , 2.2D , 3.3D }, (Double []) rs .getArray (++index ).getArray ());
1028+ assertArrayEquals (
1029+ new Float [] {1.1f , 2.2f , 3.3f }, (Float []) rs .getArray (++index ).getArray ());
10231030 assertArrayEquals (
10241031 new Boolean [] {true , null , false }, (Boolean []) rs .getArray (++index ).getArray ());
10251032 assertArrayEquals (new String [] {"1" , "2" , "3" }, (String []) rs .getArray (++index ).getArray ());
@@ -1049,13 +1056,14 @@ public void test08_PGInsertAllColumnTypes() throws SQLException {
10491056
10501057 String sql =
10511058 "INSERT INTO TableWithAllColumnTypes ("
1052- + "ColInt64, ColFloat64, ColBool, ColString, ColStringMax, ColBytes, ColDate, ColTimestamp, ColNumeric, ColJson"
1053- + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ;
1059+ + "ColInt64, ColFloat64, ColFloat32, ColBool, ColString, ColStringMax, ColBytes, ColDate, ColTimestamp, ColNumeric, ColJson"
1060+ + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" ;
10541061 try (Connection con = createConnection (env , database )) {
10551062 try (PreparedStatement ps = con .prepareStatement (sql )) {
10561063 int index = 0 ;
10571064 ps .setLong (++index , 1L );
10581065 ps .setDouble (++index , 2D );
1066+ ps .setFloat (++index , 3.14f );
10591067 ps .setBoolean (++index , true );
10601068 ps .setString (++index , "test" );
10611069 ps .setObject (++index , UUID .fromString ("2d37f522-e0a5-4f22-8e09-4d77d299c967" ));
@@ -1074,6 +1082,7 @@ public void test08_PGInsertAllColumnTypes() throws SQLException {
10741082 assertTrue (rs .next ());
10751083 assertEquals (1L , rs .getLong (++index ));
10761084 assertEquals (2d , rs .getDouble (++index ), 0.0d );
1085+ assertEquals (3.14f , rs .getFloat (++index ), 0.0f );
10771086 assertTrue (rs .getBoolean (++index ));
10781087 assertEquals ("test" , rs .getString (++index ));
10791088 assertEquals ("2d37f522-e0a5-4f22-8e09-4d77d299c967" , rs .getString (++index ));
@@ -1097,10 +1106,11 @@ public void test09_MetaData_FromQuery() throws SQLException {
10971106 try (PreparedStatement ps =
10981107 con .prepareStatement ("SELECT * FROM TableWithAllColumnTypes WHERE ColInt64=?" )) {
10991108 ResultSetMetaData metadata = ps .getMetaData ();
1100- assertEquals (24 , metadata .getColumnCount ());
1109+ assertEquals (26 , metadata .getColumnCount ());
11011110 int index = 0 ;
11021111 assertEquals ("ColInt64" , metadata .getColumnLabel (++index ));
11031112 assertEquals ("ColFloat64" , metadata .getColumnLabel (++index ));
1113+ assertEquals ("ColFloat32" , metadata .getColumnLabel (++index ));
11041114 assertEquals ("ColBool" , metadata .getColumnLabel (++index ));
11051115 assertEquals ("ColString" , metadata .getColumnLabel (++index ));
11061116 assertEquals ("ColStringMax" , metadata .getColumnLabel (++index ));
@@ -1113,6 +1123,7 @@ public void test09_MetaData_FromQuery() throws SQLException {
11131123 assertEquals ("ColJson" , metadata .getColumnLabel (++index ));
11141124 assertEquals ("ColInt64Array" , metadata .getColumnLabel (++index ));
11151125 assertEquals ("ColFloat64Array" , metadata .getColumnLabel (++index ));
1126+ assertEquals ("ColFloat32Array" , metadata .getColumnLabel (++index ));
11161127 assertEquals ("ColBoolArray" , metadata .getColumnLabel (++index ));
11171128 assertEquals ("ColStringArray" , metadata .getColumnLabel (++index ));
11181129 assertEquals ("ColStringMaxArray" , metadata .getColumnLabel (++index ));
@@ -1149,14 +1160,15 @@ public void test11_InsertDataUsingSpannerValue() throws SQLException {
11491160 dialect .dialect == Dialect .POSTGRESQL );
11501161 String sql =
11511162 "INSERT INTO TableWithAllColumnTypes ("
1152- + "ColInt64, ColFloat64, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, ColJson, "
1153- + "ColInt64Array, ColFloat64Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray, ColJsonArray"
1154- + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ;
1163+ + "ColInt64, ColFloat64, ColFloat32, ColBool, ColString, ColStringMax, ColBytes, ColBytesMax, ColDate, ColTimestamp, ColCommitTS, ColNumeric, ColJson, "
1164+ + "ColInt64Array, ColFloat64Array, ColFloat32Array, ColBoolArray, ColStringArray, ColStringMaxArray, ColBytesArray, ColBytesMaxArray, ColDateArray, ColTimestampArray, ColNumericArray, ColJsonArray"
1165+ + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, PENDING_COMMIT_TIMESTAMP(), ? , ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ;
11551166 try (Connection con = createConnection (env , database )) {
11561167 try (PreparedStatement ps = con .prepareStatement (sql )) {
11571168 int index = 1 ;
11581169 ps .setObject (index ++, Value .int64 (2L ));
11591170 ps .setObject (index ++, Value .float64 (2D ));
1171+ ps .setObject (index ++, Value .float32 (3.14f ));
11601172 ps .setObject (index ++, Value .bool (true ));
11611173 ps .setObject (index ++, Value .string ("testvalues" ));
11621174 ps .setObject (index ++, Value .string ("2d37f522-e0a5-4f22-8e09-4d77d299c967" ));
@@ -1170,6 +1182,7 @@ public void test11_InsertDataUsingSpannerValue() throws SQLException {
11701182
11711183 ps .setObject (index ++, Value .int64Array (new long [] {1L , 2L , 3L }));
11721184 ps .setObject (index ++, Value .float64Array (new double [] {1.1D , 2.2D , 3.3D }));
1185+ ps .setObject (index ++, Value .float32Array (new float [] {1.1f , 2.2f , 3.3f }));
11731186 ps .setObject (index ++, Value .boolArray (Arrays .asList (Boolean .TRUE , null , Boolean .FALSE )));
11741187 ps .setObject (index ++, Value .stringArray (Arrays .asList ("1" , "2" , "3" )));
11751188 ps .setObject (index ++, Value .stringArray (Arrays .asList ("3" , "2" , "1" )));
@@ -1207,6 +1220,7 @@ public void test11_InsertDataUsingSpannerValue() throws SQLException {
12071220 int index = 1 ;
12081221 assertEquals (Value .int64 (2L ), rs .getObject (index ++, Value .class ));
12091222 assertEquals (Value .float64 (2d ), rs .getObject (index ++, Value .class ));
1223+ assertEquals (Value .float32 (3.14f ), rs .getObject (index ++, Value .class ));
12101224 assertEquals (Value .bool (true ), rs .getObject (index ++, Value .class ));
12111225 assertEquals (Value .string ("testvalues" ), rs .getObject (index ++, Value .class ));
12121226 assertEquals (
@@ -1229,6 +1243,8 @@ public void test11_InsertDataUsingSpannerValue() throws SQLException {
12291243 assertEquals (
12301244 Value .float64Array (new double [] {1.1D , 2.2D , 3.3D }),
12311245 rs .getObject (index ++, Value .class ));
1246+ assertEquals (
1247+ Value .float32Array (new float [] {1.1f , 2.2f , 3.3f }), rs .getObject (index ++, Value .class ));
12321248 assertEquals (
12331249 Value .boolArray (Arrays .asList (true , null , false )), rs .getObject (index ++, Value .class ));
12341250 assertEquals (
0 commit comments