@@ -572,6 +572,48 @@ public void testNullableTypesSimpleStatement() throws SQLException {
572572 }
573573 }
574574
575+ @ Test (enabled = false )//TODO: The client doesn't support all of these yet
576+ public void testGeometricTypesSimpleStatement () throws SQLException {
577+ runQuery ("CREATE TABLE test_geometric (order Int8, "
578+ + "point Point, ring Ring, linestring LineString, multilinestring MultiLineString, polygon Polygon, multipolygon MultiPolygon"
579+ + ") ENGINE = Memory" );
580+
581+ // Insert random (valid) values
582+ long seed = System .currentTimeMillis ();
583+ Random rand = new Random (seed );
584+ log .info ("Random seed was: {}" , seed );
585+
586+ String point = "(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + ")" ;
587+ String ring = "[(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + "),(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + "),(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + ")]" ;
588+ String linestring = "[(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + "),(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + "),(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + ")]" ;
589+ String multilinestring = "[[(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + "),(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + ")],[(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + "),(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + ")]]" ;
590+ String polygon = "[[(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + ")],[(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + "),(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + ")]]" ;
591+ String multipolygon = "[[[(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + ")],[(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + "),(" + rand .nextInt (1000 ) + "," + rand .nextInt (1000 ) + ")]]]" ;
592+
593+
594+ String sql = String .format ("INSERT INTO test_geometric VALUES ( 1, %s, %s, %s, %s, %s, %s )" ,
595+ point , ring , linestring , multilinestring , polygon , multipolygon );
596+ insertData (sql );
597+
598+ // Check the results
599+ try (Connection conn = getConnection ()) {
600+ try (Statement stmt = conn .createStatement ()) {
601+ try (ResultSet rs = stmt .executeQuery ("SELECT * FROM test_geometric ORDER BY order" )) {
602+ assertTrue (rs .next ());
603+ assertEquals (rs .getString ("point" ), point );
604+ assertEquals (rs .getString ("linestring" ), linestring );
605+ assertEquals (rs .getString ("polygon" ), polygon );
606+ assertEquals (rs .getString ("multilinestring" ), multilinestring );
607+ assertEquals (rs .getString ("multipolygon" ), multipolygon );
608+ assertEquals (rs .getString ("ring" ), ring );
609+
610+ assertFalse (rs .next ());
611+ }
612+ }
613+ }
614+ }
615+
616+
575617 @ Test (enabled = false )//TODO: This type is experimental right now
576618 public void testDynamicTypesSimpleStatement () throws SQLException {
577619 runQuery ("CREATE TABLE test_dynamic (order Int8, "
0 commit comments