OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ai.heavy.jdbc.HeavyAIGeomTest Class Reference
+ Collaboration diagram for ai.heavy.jdbc.HeavyAIGeomTest:

Public Member Functions

void tst1_geometry () throws Exception
 
void tst2_geometry () throws Exception
 

Static Package Attributes

static Properties PROPERTIES = new Property_loader("connection_test.properties")
 
static final String url = PROPERTIES.getProperty("default_db_connection_url")
 
static final String user = PROPERTIES.getProperty("default_super_user")
 
static final String password = PROPERTIES.getProperty("default_user_password")
 
static String sql_drop_tbl_geom = "drop table if exists jdbc_geom"
 
static String sql_create_tbl_geom
 
static String sql_insert_geom
 
static String sql_insert_geom_batch = "insert into jdbc_geom values (?, ?, ?, ?)"
 
static String sql_select_geom = "select * from jdbc_geom"
 

Detailed Description

Definition at line 9 of file HeavyAIGeomTest.java.

Member Function Documentation

void ai.heavy.jdbc.HeavyAIGeomTest.tst1_geometry ( ) throws Exception
inline

Definition at line 30 of file HeavyAIGeomTest.java.

References report.conn, ai.heavy.jdbc.HeavyAIGeomTest.password, ai.heavy.jdbc.HeavyAIGeomTest.sql_create_tbl_geom, ai.heavy.jdbc.HeavyAIGeomTest.sql_drop_tbl_geom, ai.heavy.jdbc.HeavyAIGeomTest.sql_insert_geom, ai.heavy.jdbc.HeavyAIGeomTest.sql_select_geom, ai.heavy.jdbc.HeavyAIGeomTest.url, and ai.heavy.jdbc.HeavyAIGeomTest.user.

30  {
31  Connection conn = DriverManager.getConnection(url, user, password);
32  assertNotEquals(null, conn);
33  Statement statement = conn.createStatement();
34  statement.executeUpdate(sql_drop_tbl_geom);
35  statement.executeUpdate(sql_create_tbl_geom);
36  statement.executeUpdate(sql_insert_geom);
37 
38  ResultSet rs = statement.executeQuery(sql_select_geom);
39  while (rs.next()) {
40  Object m_point = rs.getObject("m_point");
41  Object m_linestring = rs.getObject("m_linestring");
42  Object m_polygon = rs.getObject("m_polygon");
43  Object m_multi_polygon = rs.getString("m_multi_polygon");
44  assertEquals("POLYGON ((0 0,4 0,4 4,0 0))", m_polygon);
45  assertEquals("LINESTRING (0 1,2 2)", m_linestring);
46  assertEquals("POINT (0 0)", m_point);
47  assertEquals("MULTIPOLYGON (((0 0,4 0,4 4,0 4,0 0)))", m_multi_polygon);
48  }
49  rs.close();
50  statement.executeUpdate(sql_drop_tbl_geom);
51  }
tuple conn
Definition: report.py:41
void ai.heavy.jdbc.HeavyAIGeomTest.tst2_geometry ( ) throws Exception
inline

Definition at line 55 of file HeavyAIGeomTest.java.

References report.conn, ai.heavy.jdbc.HeavyAIGeomTest.password, ai.heavy.jdbc.HeavyAIGeomTest.sql_create_tbl_geom, ai.heavy.jdbc.HeavyAIGeomTest.sql_drop_tbl_geom, ai.heavy.jdbc.HeavyAIGeomTest.sql_insert_geom_batch, ai.heavy.jdbc.HeavyAIGeomTest.sql_select_geom, ai.heavy.jdbc.HeavyAIGeomTest.url, and ai.heavy.jdbc.HeavyAIGeomTest.user.

55  {
56  Connection conn = DriverManager.getConnection(url, user, password);
57  assertNotEquals(null, conn);
58  Statement statement = conn.createStatement();
59  statement.executeUpdate(sql_drop_tbl_geom);
60  statement.executeUpdate(sql_create_tbl_geom);
61  PreparedStatement ps = conn.prepareStatement(sql_insert_geom_batch);
62  ps.setString(1, "POINT(0 0)");
63  ps.setString(2, "LINESTRING(0 1, 2 2)");
64  ps.setString(3, "POLYGON((0 0,4 0,4 4,0 0))");
65  ps.setString(4, "MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0)))");
66  ps.addBatch();
67  ps.executeBatch();
68 
69  ResultSet rs = statement.executeQuery(sql_select_geom);
70  while (rs.next()) {
71  // Test getString and getObject return on geo type
72  Object m_point = rs.getObject("m_point");
73  Object m_linestring = rs.getString("m_linestring");
74  Object m_polygon = rs.getObject("m_polygon");
75  String m_multi_polygon = rs.getString("m_multi_polygon");
76  assertEquals("POLYGON ((0 0,4 0,4 4,0 0))", m_polygon);
77  assertEquals("LINESTRING (0 1,2 2)", m_linestring);
78  assertEquals("POINT (0 0)", m_point);
79  assertEquals("MULTIPOLYGON (((0 0,4 0,4 4,0 4,0 0)))", m_multi_polygon);
80  }
81  rs.close();
82  statement.executeUpdate(sql_drop_tbl_geom);
83  }
tuple conn
Definition: report.py:41

Member Data Documentation

final String ai.heavy.jdbc.HeavyAIGeomTest.password = PROPERTIES.getProperty("default_user_password")
staticpackage
Properties ai.heavy.jdbc.HeavyAIGeomTest.PROPERTIES = new Property_loader("connection_test.properties")
staticpackage

Definition at line 10 of file HeavyAIGeomTest.java.

String ai.heavy.jdbc.HeavyAIGeomTest.sql_create_tbl_geom
staticpackage
Initial value:
=
"create table jdbc_geom (m_point POINT, m_linestring LINESTRING, m_polygon POLYGON, m_multi_polygon MULTIPOLYGON)"

Definition at line 16 of file HeavyAIGeomTest.java.

Referenced by ai.heavy.jdbc.HeavyAIGeomTest.tst1_geometry(), and ai.heavy.jdbc.HeavyAIGeomTest.tst2_geometry().

String ai.heavy.jdbc.HeavyAIGeomTest.sql_drop_tbl_geom = "drop table if exists jdbc_geom"
staticpackage
String ai.heavy.jdbc.HeavyAIGeomTest.sql_insert_geom
staticpackage
Initial value:
=
"insert into jdbc_geom values ('POINT(0 0)', 'LINESTRING(0 1, 2 2)',"
+ " 'POLYGON((0 0,4 0,4 4,0 0))',"
+ " 'MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0)))')"

Definition at line 19 of file HeavyAIGeomTest.java.

Referenced by ai.heavy.jdbc.HeavyAIGeomTest.tst1_geometry().

String ai.heavy.jdbc.HeavyAIGeomTest.sql_insert_geom_batch = "insert into jdbc_geom values (?, ?, ?, ?)"
staticpackage

Definition at line 24 of file HeavyAIGeomTest.java.

Referenced by ai.heavy.jdbc.HeavyAIGeomTest.tst2_geometry().

String ai.heavy.jdbc.HeavyAIGeomTest.sql_select_geom = "select * from jdbc_geom"
staticpackage
final String ai.heavy.jdbc.HeavyAIGeomTest.url = PROPERTIES.getProperty("default_db_connection_url")
staticpackage

The documentation for this class was generated from the following file: