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

Public Member Functions

void setUp () throws Exception
 
void tearDown () throws Exception
 
void insert_times () throws Exception
 
void create_times () throws Exception
 
void escape_function1 () throws Exception
 
void escape_function2 () throws Exception
 
void escape_function3 () throws Exception
 
void create_types () throws Exception
 
void cancelTest1 () throws Exception
 
void maxRowsTest () 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_tm = "drop table if exists test_jdbc_tm_tble"
 
static String sql_create_tbl_tm
 
static String sql_insert_tm_1
 
static String sql_insert_tm_2
 
static String sql_insert_tm_3
 
static String insert_prepare_tm
 
static String sql_insert_tm_4
 
static String sql_select_tm = "select * from test_jdbc_tm_tble"
 
static String sql_drop_tbl = "drop table if exists test_jdbc_types_tble"
 
static String sql_create_tbl
 
static String sql_insert
 
static String sql_select_all = "select * from test_jdbc_types_tble"
 

Private Member Functions

int resultSetSize (ResultSet rs) throws SQLException
 

Private Attributes

Connection m_conn = null
 

Detailed Description

Definition at line 20 of file HeavyAIStatementTest.java.

Member Function Documentation

void ai.heavy.jdbc.HeavyAIStatementTest.cancelTest1 ( ) throws Exception
inline

Definition at line 497 of file HeavyAIStatementTest.java.

References run_benchmark_import.result, ai.heavy.jdbc.HeavyAIStatementTest.sql_create_tbl, ai.heavy.jdbc.HeavyAIStatementTest.sql_drop_tbl, ai.heavy.jdbc.HeavyAIStatementTest.sql_insert, and ai.heavy.jdbc.HeavyAIStatementTest.sql_select_all.

497  {
498  Statement statement = m_conn.createStatement();
499  statement.executeUpdate(sql_drop_tbl);
500  statement.executeUpdate(sql_create_tbl);
501  statement.executeUpdate(sql_insert);
502 
503  Supplier<Boolean> B = () -> {
504  try {
505  Thread.sleep(1);
506  statement.cancel();
507  } catch (SQLException | InterruptedException e) {
508  e.printStackTrace();
509  return false;
510  }
511  return true;
512  };
513  Future<Boolean> result = CompletableFuture.supplyAsync(B);
514  ResultSet rs = statement.executeQuery(sql_select_all);
515  int size = 0;
516  while (rs.next()) {
517  size++;
518  }
519  assertEquals(size, 1);
520  // To verify the main connection is still functioning
521  // after the cancel command.
522  statement.executeUpdate(sql_insert);
523  rs = statement.executeQuery(sql_select_all);
524 
525  size = 0;
526  while (rs.next()) {
527  size++;
528  }
529  assertEquals(size, 2);
530  statement.executeUpdate(sql_drop_tbl);
531  }
void ai.heavy.jdbc.HeavyAIStatementTest.create_times ( ) throws Exception
inline

Definition at line 113 of file HeavyAIStatementTest.java.

References ai.heavy.jdbc.HeavyAIStatementTest.sql_create_tbl_tm, ai.heavy.jdbc.HeavyAIStatementTest.sql_drop_tbl_tm, ai.heavy.jdbc.HeavyAIStatementTest.sql_insert_tm_1, ai.heavy.jdbc.HeavyAIStatementTest.sql_insert_tm_2, ai.heavy.jdbc.HeavyAIStatementTest.sql_insert_tm_3, ai.heavy.jdbc.HeavyAIStatementTest.sql_insert_tm_4, and ai.heavy.jdbc.HeavyAIStatementTest.sql_select_tm.

113  {
114  Statement statement = m_conn.createStatement();
115  statement.executeUpdate(sql_drop_tbl_tm);
116  statement.executeUpdate(sql_create_tbl_tm);
117 
118  statement.executeUpdate(sql_insert_tm_1);
119  statement.executeUpdate(sql_insert_tm_2);
120  statement.executeUpdate(sql_insert_tm_3);
121  statement.executeUpdate(sql_insert_tm_4);
122  ResultSet rs = statement.executeQuery(sql_select_tm);
123 
124  for (int i = 0; rs.next(); ++i) {
125  TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
126  Timestamp timestamp = rs.getTimestamp("m_timestamp");
127 
128  Timestamp timestamp_3 = rs.getTimestamp("m_timestamp_3");
129  Timestamp timestamp_6 = rs.getTimestamp("m_timestamp_6");
130  Timestamp timestamp_9 = rs.getTimestamp("m_timestamp_9");
131  if (i == 0) {
132  assertEquals("1910-01-01 00:00:10.0", timestamp.toString());
133  assertEquals("1910-01-01 00:00:10.001", timestamp_3.toString());
134  assertEquals("1910-01-01 00:00:10.555556", timestamp_6.toString());
135  assertEquals("1910-01-01 00:00:10.999999999", timestamp_9.toString());
136  }
137  if (i == 1) {
138  assertEquals("1969-12-31 23:00:00.0", timestamp.toString());
139  assertEquals("1969-12-31 23:00:00.001", timestamp_3.toString());
140  assertEquals("1969-12-31 23:00:00.000001", timestamp_6.toString());
141  assertEquals("1969-12-31 23:00:00.000000001", timestamp_9.toString());
142  }
143  if (i == 2) {
144  assertEquals("1970-01-01 00:00:10.0", timestamp.toString());
145  assertEquals("1970-01-01 00:00:10.001", timestamp_3.toString());
146  assertEquals("1970-01-01 00:00:10.000001", timestamp_6.toString());
147  assertEquals("1970-01-01 00:00:10.000000001", timestamp_9.toString());
148  }
149  if (i == 3) {
150  assertEquals("2970-01-01 00:00:10.0", timestamp.toString());
151  assertEquals("2970-01-01 00:00:10.001", timestamp_3.toString());
152  assertEquals("2970-01-01 00:00:10.000001", timestamp_6.toString());
153  assertEquals("2262-04-11 23:47:16.850000001", timestamp_9.toString());
154  }
155  }
156 
157  statement.executeUpdate(sql_drop_tbl_tm);
158  }
void ai.heavy.jdbc.HeavyAIStatementTest.create_types ( ) throws Exception
inline

Definition at line 436 of file HeavyAIStatementTest.java.

References heavydb.dtypes.Date, Double, Float, Integer, ai.heavy.jdbc.HeavyAIStatementTest.sql_create_tbl, ai.heavy.jdbc.HeavyAIStatementTest.sql_drop_tbl, ai.heavy.jdbc.HeavyAIStatementTest.sql_insert, ai.heavy.jdbc.HeavyAIStatementTest.sql_select_all, and heavydb.dtypes.Time.

436  {
437  Statement statement = m_conn.createStatement();
438  statement.executeQuery(sql_drop_tbl);
439  statement.executeUpdate(sql_create_tbl);
440  statement.executeUpdate(sql_insert);
441  statement.executeUpdate(sql_insert);
442  ResultSet rs = statement.executeQuery(sql_select_all);
443 
444  int i = 0;
445  for (; rs.next(); ++i) {
446  int r_int = rs.getInt("m_int");
447  assertEquals(Integer.MAX_VALUE, r_int);
448  float r_float = rs.getFloat("m_float");
449  float delta_f = ulp(Float.MAX_VALUE);
450  assertEquals(Float.MAX_VALUE, r_float, delta_f);
451 
452  double r_double = rs.getDouble("m_double");
453  double delta_d = ulp(Double.MAX_VALUE);
454  assertEquals(Double.MAX_VALUE, r_double, delta_d);
455 
456  long r_long = rs.getLong("m_bigint");
457  assertEquals(Long.MAX_VALUE, r_long);
458 
459  short r_short = rs.getShort("m_smallint");
460  assertEquals(Short.MAX_VALUE, r_short);
461 
462  byte r_byte = (byte) rs.getShort("m_tinyint");
463  assertEquals(Byte.MAX_VALUE, r_byte);
464 
465  String decimal_str = rs.getString("m_decimal");
466  assertEquals("12345.123", decimal_str);
467 
468  // byte r_boolean = rs.getByte("m_boolean"); Not supported!
469  byte r_boolean = (byte) rs.getShort("m_boolean");
470  assertEquals(0, r_boolean);
471 
472  String r_text_encoded = rs.getString("m_text_encoded");
473  assertEquals("String 1 - encoded", r_text_encoded);
474 
475  String r_text_encoded_none = rs.getString("m_text_encoded_none");
476  assertEquals("String 2 - not encoded", r_text_encoded_none);
477 
478  // Set the tz to GMT to help with compares
479  TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
480 
481  Timestamp r_timestamp = rs.getTimestamp("m_timestamp");
482  assertEquals("1970-01-01 00:00:00.0", r_timestamp.toString());
483 
484  Date r_date = rs.getDate("m_date");
485  assertEquals("1970-01-01", r_date.toString());
486 
487  Time r_time = rs.getTime("m_time");
488  assertEquals("00:00:00", r_time.toString());
489  }
490 
491  assertEquals(2, i);
492 
493  statement.executeUpdate(sql_drop_tbl);
494  }
void ai.heavy.jdbc.HeavyAIStatementTest.escape_function1 ( ) throws Exception
inline

Definition at line 187 of file HeavyAIStatementTest.java.

References heavydb.dtypes.Date, Double, and heavydb.dtypes.Time.

187  {
188  Statement statement = m_conn.createStatement();
189  TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
190 
191  // Test multiple nested fn {}
192  String d_select =
193  "select {fn cos(1)} as m_cos, {d '1999-01-09'} as m_date, {t '20:00:03'} as m_time, {ts '1990-01-09 20:00:03'} as m_timestamp, {fn week({d '2005-01-24'})} as m_week";
194  ResultSet rs = statement.executeQuery(d_select);
195  for (int i = 0; rs.next(); ++i) {
196  Date r_date = rs.getDate("m_date");
197  assertEquals("1999-01-09", r_date.toString());
198  Time r_time = rs.getTime("m_time");
199  assertEquals("20:00:03", r_time.toString());
200  Timestamp ts_time = rs.getTimestamp("m_timestamp");
201  assertEquals("1990-01-09 20:00:03.0", ts_time.toString());
202  double m_cos = rs.getDouble("m_cos");
203  assertEquals(Double.compare(m_cos, 0.5403023058681398), 0);
204  int m_week = rs.getInt("m_week");
205  assertEquals(m_week, 4);
206  }
207 
208  d_select = "select {fn FLOOR(-1 * {fn dayofmonth({d '1990-01-31'})})} as WWW";
209  rs = statement.executeQuery(d_select);
210  for (int i = 0; rs.next(); ++i) {
211  int www = rs.getInt("WWW");
212  assertEquals(-31, www);
213  }
214  d_select =
215  "select {fn FLOOR(-1 * {fn dayofmonth(cast('1990-01-31' as date))})} as XXX";
216  rs = statement.executeQuery(d_select);
217  for (int i = 0; rs.next(); ++i) {
218  int xxx = rs.getInt("XXX");
219  assertEquals(-31, xxx);
220  }
221 
222  d_select = "select {fn floor(1.005)} as YYY limit 1000 {";
223  try {
224  statement.executeQuery(d_select);
225  assertTrue(false);
226  } catch (RuntimeException rE) {
227  }
228 
229  d_select = "select ' {fn floor(1.005)} as YYY limit 1000 {";
230  try {
231  statement.executeQuery(d_select);
232  assertTrue(false);
233  } catch (RuntimeException rE) {
234  }
235 
236  d_select = "select ' {fn floor(1.005)} as YYY limit 1000 }";
237  try {
238  statement.executeQuery(d_select);
239  assertTrue(false);
240  } catch (RuntimeException rE) {
241  }
242  }
void ai.heavy.jdbc.HeavyAIStatementTest.escape_function2 ( ) throws Exception
inline

Definition at line 244 of file HeavyAIStatementTest.java.

244  {
245  Statement statement = m_conn.createStatement();
246  TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
247 
248  String sql_drop_tester = "drop table if exists tester";
249 
250  statement.executeUpdate(sql_drop_tester);
251  String sql_create_tester =
252  "CREATE table tester(Connection_start TIMESTAMP, d_start DATE)";
253  statement.executeUpdate(sql_create_tester);
254 
255  String sql_insert_tester1 =
256  "insert into tester values ('2018-11-08 12:19:59', '2018-11-08')";
257  statement.executeUpdate(sql_insert_tester1);
258 
259  // test multiple embedded {} with TIMESTAMPSIDD.
260  String e_statement =
261  "select COUNT( {fn TIMESTAMPDIFF(SQL_TSI_DAY, {fn TIMESTAMPADD(SQL_TSI_DAY,CAST((-1 * (EXTRACT(DAY FROM tester.d_start) - 1)) AS INTEGER),CAST( tester.d_start AS DATE))}, {fn TIMESTAMPADD(SQL_TSI_DAY,CAST((-1 * (EXTRACT(DAY FROM {fn TIMESTAMPADD(SQL_TSI_MONTH,1, tester.d_start)}) - 1)) AS INTEGER),CAST( {fn TIMESTAMPADD(SQL_TSI_MONTH,1, tester.d_start)} AS DATE)) }) }) AS TEMP from tester";
262  ResultSet rs = statement.executeQuery(e_statement);
263  rs = statement.executeQuery(e_statement);
264  for (int i = 0; rs.next(); ++i) {
265  int r_count = rs.getInt("TEMP");
266  assertEquals(r_count, 1);
267  }
268  // test TOP filter.
269  String x_select =
270  "SELECT TOP 1000 sum(1) AS sum_Number_of_Records_ok, {fn TIMESTAMPADD(SQL_TSI_HOUR, EXTRACT(HOUR FROM tester.Connection_Start), CAST(tester.Connection_Start as DATE))} AS thr_Connection_Start_ok FROM tester Where ((tester.Connection_Start >= {ts '2018-11-01 00:00:00'}) AND (tester.Connection_Start <= {ts '2018-11-08 23:59:59'})) GROUP BY 2";
271  rs = statement.executeQuery(x_select);
272  for (int i = 0; rs.next(); ++i) {
273  int r_count = rs.getInt("sum_Number_of_Records_ok");
274  assertEquals(r_count, 1);
275  Timestamp ts_time = rs.getTimestamp("thr_Connection_Start_ok");
276  assertEquals(ts_time.toString(), "2018-11-08 12:00:00.0");
277  }
278 
279  // Test the simple date transformation in HeavyDBStatment.
280  String d_simple_quarter = "select quarter(Connection_start) as m_quarter from tester";
281  rs = statement.executeQuery(d_simple_quarter);
282  for (int i = 0; rs.next(); ++i) {
283  int r_quarter = rs.getInt("m_quarter");
284  assertEquals(4, r_quarter);
285  }
286  d_simple_quarter =
287  "select quarter(cast('2019-04-03' as date)) as m_quarter from tester";
288  rs = statement.executeQuery(d_simple_quarter);
289  for (int i = 0; rs.next(); ++i) {
290  int r_quarter = rs.getInt("m_quarter");
291  assertEquals(2, r_quarter);
292  }
293  }
void ai.heavy.jdbc.HeavyAIStatementTest.escape_function3 ( ) throws Exception
inline

Definition at line 296 of file HeavyAIStatementTest.java.

References heavydb.dtypes.Date, Double, and Float.

296  {
297  Statement statement = m_conn.createStatement();
298  TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
299 
300  // ceil
301  String d_ceiling = "select {fn ceiling(1.005)} as YYY";
302  ResultSet rs = statement.executeQuery(d_ceiling);
303  for (int i = 0; rs.next(); ++i) {
304  float yyy = rs.getFloat("YYY");
305  assertEquals(Float.compare(2.0F, yyy), 0);
306  }
307 
308  // floor
309  String d_floor = "select {fn floor(1.005)} as YYY";
310  rs = statement.executeQuery(d_floor);
311  for (int i = 0; rs.next(); ++i) {
312  float yyy = rs.getFloat("YYY");
313  assertEquals(Float.compare(1.0F, yyy), 0);
314  }
315 
316  // ln
317  String d_ln = "select {fn log(10)} as m_ln";
318  rs = statement.executeQuery(d_ln);
319  for (int i = 0; rs.next(); ++i) {
320  double r_ln = rs.getDouble("m_ln");
321  assertEquals(Double.compare(r_ln, 2.302585092994046), 0);
322  }
323  // ln
324  d_ln = "select {fn ln(10)} as m_ln";
325  rs = statement.executeQuery(d_ln);
326  for (int i = 0; rs.next(); ++i) {
327  double r_ln = rs.getDouble("m_ln");
328  assertEquals(Double.compare(r_ln, 2.302585092994046), 0);
329  }
330 
331  // log10
332  String d_log10 = "select {fn log10(10)} as m_log10";
333  rs = statement.executeQuery(d_log10);
334  for (int i = 0; rs.next(); ++i) {
335  double r_log10 = rs.getDouble("m_log10");
336  assertEquals(Double.compare(r_log10, 1), 0);
337  }
338 
339  // abs
340  String d_abs = "select {fn abs(-1.45)} as m_abs";
341  rs = statement.executeQuery(d_abs);
342  for (int i = 0; rs.next(); ++i) {
343  float r_abs = rs.getFloat("m_abs");
344  assertEquals(Float.compare(r_abs, (float) Math.abs(-1.45)), 0);
345  }
346 
347  // power
348  String d_power = "select {fn power(2,10)} as YYY";
349  rs = statement.executeQuery(d_power);
350  for (int i = 0; rs.next(); ++i) {
351  float yyy = rs.getFloat("YYY");
352  assertEquals(Float.compare((float) Math.pow(2, 10), yyy), 0);
353  }
354  // truncate
355  String d_truncate = "select {fn truncate(2.01,1)} as YYY";
356  rs = statement.executeQuery(d_truncate);
357  for (int i = 0; rs.next(); ++i) {
358  float yyy = rs.getFloat("YYY");
359  assertEquals(Float.compare(2.0F, yyy), 0);
360  }
361 
362  // length
363  String d_length = "select {fn length('12345')} as YYY";
364  rs = statement.executeQuery(d_length);
365  for (int i = 0; rs.next(); ++i) {
366  int yyy = rs.getInt("YYY");
367  assertEquals(5, yyy);
368  }
369 
370  // quarter
371  String d_quarter = "select {fn quarter({d '2005-01-24'})} as m_quarter";
372  rs = statement.executeQuery(d_quarter);
373  for (int i = 0; rs.next(); ++i) {
374  int r_quarter = rs.getInt("m_quarter");
375  assertEquals(1, r_quarter);
376  }
377 
378  // day of year
379  String d_dayofyear = "select {fn DAYOFYEAR({d '2005-01-24'})} as m_dayofyear";
380  rs = statement.executeQuery(d_dayofyear);
381  for (int i = 0; rs.next(); ++i) {
382  int r_dayofyear = rs.getInt("m_dayofyear");
383  assertEquals(24, r_dayofyear);
384  }
385 
386  // day of week
387  String d_dayofweek = "select {fn dayofweek({d '2005-01-24'})} as m_dayofweek";
388  rs = statement.executeQuery(d_dayofweek);
389  for (int i = 0; rs.next(); ++i) {
390  int r_dayofweek = rs.getInt("m_dayofweek");
391  assertEquals(2, r_dayofweek);
392  }
393  // day of month
394  String d_dayofmonth = "select {fn dayofmonth({d '2005-01-24'})} as m_dayofmonth";
395  rs = statement.executeQuery(d_dayofmonth);
396  for (int i = 0; rs.next(); ++i) {
397  int r_dayofmonth = rs.getInt("m_dayofmonth");
398  assertEquals(24, r_dayofmonth);
399  }
400  // hour
401  String d_hour = "select {fn hour({ts '2005-01-24 10:11:12'})} as m_hour";
402  rs = statement.executeQuery(d_hour);
403  for (int i = 0; rs.next(); ++i) {
404  int r_hour = rs.getInt("m_hour");
405  assertEquals(10, r_hour);
406  }
407 
408  // current date
409  String d_c =
410  "select {fn TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_DATE())} m, TIMESTAMPADD(SQL_TSI_WEEK, 1, CURRENT_DATE) y";
411  ResultSet rx = statement.executeQuery(d_c);
412  for (int i = 0; rx.next(); ++i) {
413  Date r_m = rx.getDate("m");
414  Date r_y = rx.getDate("y");
415  }
416 
417  // current date
418  d_c = "select TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_DATE) as m_zzz";
419  rs = statement.executeQuery(d_c);
420  for (int i = 0; rs.next(); ++i) {
421  Timestamp r_zzz = rs.getTimestamp("m_zzz");
422  }
423  // current date
424  d_c = "select TIMESTAMPADD(SQL_TSI_DAY, 1, CURRENT_DATE_TIME) as m_zzz";
425  try {
426  rs = statement.executeQuery(d_c);
427  assertTrue(false);
428  } catch (SQLException sE) {
429  assertTrue(sE.toString().contains("CURRENT_DATE_TIME' not found in any table"));
430  } catch (Exception ex) {
431  assertTrue(false);
432  }
433  }
void ai.heavy.jdbc.HeavyAIStatementTest.insert_times ( ) throws Exception
inline

Definition at line 67 of file HeavyAIStatementTest.java.

References ai.heavy.jdbc.HeavyAIStatementTest.insert_prepare_tm, ai.heavy.jdbc.HeavyAIStatementTest.sql_create_tbl_tm, ai.heavy.jdbc.HeavyAIStatementTest.sql_drop_tbl_tm, and ai.heavy.jdbc.HeavyAIStatementTest.sql_select_tm.

67  {
68  Statement statement = m_conn.createStatement();
69  statement.executeUpdate(sql_drop_tbl_tm);
70  statement.executeUpdate(sql_create_tbl_tm);
71 
72  TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
73  DateFormat date_format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
74 
75  java.util.Date date_tm = date_format.parse("1918-11-11 11:11:00.000");
76  Timestamp tm = new Timestamp(date_tm.getTime());
77 
78  date_tm = date_format.parse("1918-11-11 11:11:00.001");
79  Timestamp tm_3 = new Timestamp(date_tm.getTime());
80 
81  date_tm = date_format.parse("1918-11-11 11:11:00.000");
82  Timestamp tm_6 = new Timestamp(date_tm.getTime());
83  tm_6.setNanos(999999000);
84 
85  date_tm = date_format.parse("1918-11-11 11:11:00.000");
86  Timestamp tm_9 = new Timestamp(date_tm.getTime());
87  tm_9.setNanos(123456789);
88 
89  PreparedStatement pr = m_conn.prepareStatement(insert_prepare_tm);
90  pr.setTimestamp(1, tm);
91  pr.setTimestamp(2, tm_3);
92  pr.setTimestamp(3, tm_6);
93  pr.setTimestamp(4, tm_9);
94 
95  pr.executeUpdate();
96 
97  ResultSet rs = statement.executeQuery(sql_select_tm);
98  while (rs.next()) {
99  Timestamp r_tm = rs.getTimestamp("m_timestamp");
100  assertTrue(r_tm.equals(tm));
101  Timestamp r_tm3 = rs.getTimestamp("m_timestamp_3");
102  assertTrue(r_tm3.equals(tm_3));
103  Timestamp r_tm6 = rs.getTimestamp("m_timestamp_6");
104  assertTrue(r_tm6.equals(tm_6));
105  Timestamp r_tm9 = rs.getTimestamp("m_timestamp_9");
106  assertTrue(r_tm9.equals(tm_9));
107  }
108 
109  statement.executeUpdate(sql_drop_tbl_tm);
110  }
void ai.heavy.jdbc.HeavyAIStatementTest.maxRowsTest ( ) throws Exception
inline

Definition at line 542 of file HeavyAIStatementTest.java.

References ai.heavy.jdbc.HeavyAIStatementTest.password, ai.heavy.jdbc.HeavyAIStatementTest.resultSetSize(), ai.heavy.jdbc.HeavyAIStatementTest.url, and ai.heavy.jdbc.HeavyAIStatementTest.user.

542  {
543  Statement statement = m_conn.createStatement();
544  statement.executeUpdate("DROP TABLE IF EXISTS max_rows_tbl");
545  statement.executeUpdate("CREATE TABLE max_rows_tbl (i INTEGER)");
546  statement.executeUpdate("INSERT INTO max_rows_tbl VALUES (1)");
547  statement.executeUpdate("INSERT INTO max_rows_tbl VALUES (2)");
548  statement.executeUpdate("INSERT INTO max_rows_tbl VALUES (3)");
549  ResultSet rs = statement.executeQuery("SELECT * FROM max_rows_tbl");
550  assertEquals(3, resultSetSize(rs));
551  statement.setMaxRows(1);
552  rs = statement.executeQuery("SELECT * FROM max_rows_tbl");
553  assertEquals(1, resultSetSize(rs));
554  statement.close();
555 
556  Properties pt = new Properties();
557  pt.setProperty("user", user);
558  pt.setProperty("password", password);
559  pt.setProperty("max_rows", "2");
560  Connection limited_conn = DriverManager.getConnection(url, pt);
561  statement = limited_conn.createStatement();
562  rs = statement.executeQuery("SELECT * FROM max_rows_tbl");
563  assertEquals(2, resultSetSize(rs));
564  statement.setMaxRows(1);
565  rs = statement.executeQuery("SELECT * FROM max_rows_tbl");
566  assertEquals(1, resultSetSize(rs));
567  statement.close();
568  limited_conn.close();
569  }

+ Here is the call graph for this function:

int ai.heavy.jdbc.HeavyAIStatementTest.resultSetSize ( ResultSet  rs) throws SQLException
inlineprivate

Definition at line 533 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.maxRowsTest().

533  {
534  int sz = 0;
535  while (rs.next()) {
536  sz++;
537  }
538  return sz;
539  }

+ Here is the caller graph for this function:

void ai.heavy.jdbc.HeavyAIStatementTest.setUp ( ) throws Exception
inline

Definition at line 29 of file HeavyAIStatementTest.java.

References ai.heavy.jdbc.HeavyAIStatementTest.m_conn, ai.heavy.jdbc.HeavyAIStatementTest.password, ai.heavy.jdbc.HeavyAIStatementTest.url, and ai.heavy.jdbc.HeavyAIStatementTest.user.

29  {
30  Properties pt = new Properties();
31  pt.setProperty("user", user);
32  pt.setProperty("password", password);
33  m_conn = DriverManager.getConnection(url, pt);
34  }
void ai.heavy.jdbc.HeavyAIStatementTest.tearDown ( ) throws Exception
inline

Definition at line 37 of file HeavyAIStatementTest.java.

37  {
38  m_conn.close();
39  }

Member Data Documentation

String ai.heavy.jdbc.HeavyAIStatementTest.insert_prepare_tm
staticpackage
Initial value:
=
"insert into test_jdbc_tm_tble (m_timestamp, m_timestamp_3, m_timestamp_6, m_timestamp_9) values (?, ?, ?, ?)"

Definition at line 58 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.insert_times().

Connection ai.heavy.jdbc.HeavyAIStatementTest.m_conn = null
private

Definition at line 26 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.setUp().

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

Definition at line 21 of file HeavyAIStatementTest.java.

String ai.heavy.jdbc.HeavyAIStatementTest.sql_create_tbl
staticpackage
Initial value:
= "CREATE table test_jdbc_types_tble("
+ "m_decimal DECIMAL(8,3),"
+ "m_int int,"
+ "m_float float,"
+ "m_double double,"
+ "m_bigint BIGINT,"
+ "m_smallint SMALLINT,"
+ "m_tinyint TINYINT,"
+ "m_boolean BOOLEAN,"
+ "m_text_encoded TEXT ENCODING DICT,"
+ "m_text_encoded_none TEXT ENCODING NONE,"
+ "m_time TIME,"
+ "m_date DATE,"
+ "m_timestamp TIMESTAMP)"

Definition at line 162 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.cancelTest1(), and ai.heavy.jdbc.HeavyAIStatementTest.create_types().

String ai.heavy.jdbc.HeavyAIStatementTest.sql_create_tbl_tm
staticpackage
Initial value:
= "CREATE table test_jdbc_tm_tble("
+ "m_timestamp TIMESTAMP,"
+ "m_timestamp_3 TIMESTAMP(3),"
+ "m_timestamp_6 TIMESTAMP(6),"
+ "m_timestamp_9 TIMESTAMP(9))"

Definition at line 43 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.create_times(), and ai.heavy.jdbc.HeavyAIStatementTest.insert_times().

String ai.heavy.jdbc.HeavyAIStatementTest.sql_drop_tbl = "drop table if exists test_jdbc_types_tble"
staticpackage
String ai.heavy.jdbc.HeavyAIStatementTest.sql_drop_tbl_tm = "drop table if exists test_jdbc_tm_tble"
staticpackage
String ai.heavy.jdbc.HeavyAIStatementTest.sql_insert
staticpackage
Initial value:
= "insert into test_jdbc_types_tble values ("
+ "12345.123" + +Integer.MAX_VALUE + "," + Integer.MAX_VALUE + ","
+ Float.MAX_VALUE + "," + Double.MAX_VALUE + "," + Long.MAX_VALUE + ","
+ Short.MAX_VALUE + "," + Byte.MAX_VALUE + ","
+ "\'0\',"
+ "'String 1 - encoded', 'String 2 - not encoded', '00:00:00', '1970-01-01', '1970-01-01 00:00:00')"

Definition at line 177 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.cancelTest1(), and ai.heavy.jdbc.HeavyAIStatementTest.create_types().

String ai.heavy.jdbc.HeavyAIStatementTest.sql_insert_tm_1
staticpackage
Initial value:
=
"insert into test_jdbc_tm_tble values ('1910-01-01 00:00:10', '1910-01-01 00:00:10.001', '1910-01-01 00:00:10.555556', '1910-01-01 00:00:10.999999999')"

Definition at line 49 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.create_times().

String ai.heavy.jdbc.HeavyAIStatementTest.sql_insert_tm_2
staticpackage
Initial value:
=
"insert into test_jdbc_tm_tble values ('1969-12-31 23:00:00', '1969-12-31 23:00:00.001', '1969-12-31 23:00:00.000001', '1969-12-31 23:00:00.000000001')"

Definition at line 52 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.create_times().

String ai.heavy.jdbc.HeavyAIStatementTest.sql_insert_tm_3
staticpackage
Initial value:
=
"insert into test_jdbc_tm_tble values ('1970-01-01 00:00:10', '1970-01-01 00:00:10.001', '1970-01-01 00:00:10.000001', '1970-01-01 00:00:10.000000001')"

Definition at line 55 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.create_times().

String ai.heavy.jdbc.HeavyAIStatementTest.sql_insert_tm_4
staticpackage
Initial value:
=
"insert into test_jdbc_tm_tble values ('2970-01-01 00:00:10', '2970-01-01 00:00:10.001', '2970-01-01 00:00:10.000001', '2262-04-11 23:47:16.850000001')"

Definition at line 62 of file HeavyAIStatementTest.java.

Referenced by ai.heavy.jdbc.HeavyAIStatementTest.create_times().

String ai.heavy.jdbc.HeavyAIStatementTest.sql_select_all = "select * from test_jdbc_types_tble"
staticpackage
String ai.heavy.jdbc.HeavyAIStatementTest.sql_select_tm = "select * from test_jdbc_tm_tble"
staticpackage
final String ai.heavy.jdbc.HeavyAIStatementTest.url = PROPERTIES.getProperty("default_db_connection_url")
staticpackage

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