Skip to content

Commit

Permalink
fix: zonky weird
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Oct 27, 2023
1 parent 11447fa commit b28ac2d
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,24 @@ public class GenericPreparedStatementBuilderTest extends InitializeQueryTest {

@Test
public void copyFromGenericBean() throws ArcException {
UtilitaireDao.get(0).executeImmediate(c, "DROP SCHEMA IF EXISTS test CASCADE;");
UtilitaireDao.get(0).executeImmediate(c, "CREATE SCHEMA test;");

UtilitaireDao.get(0).executeImmediate(c, "DROP SCHEMA IF EXISTS arc_bas9 CASCADE;");
UtilitaireDao.get(0).executeImmediate(c, "CREATE SCHEMA arc_bas9;");

// create a test table with 26 lines
UtilitaireDao.get(0).executeImmediate(c, "CREATE TABLE test.table_test as select i as id, chr(i+64) as val, array[i,i+1] as arr, current_date as dd from generate_series(1,26) i;");
UtilitaireDao.get(0).executeImmediate(c, "CREATE TABLE arc_bas9.table_test as select i as id, chr(i+64) as val, array[i,i+1] as arr, current_date as dd from generate_series(1,26) i;");

// the content will grab the first 10 lines of test table
GenericBean gb= new GenericBean(UtilitaireDao.get(0).executeRequest(c, new GenericPreparedStatementBuilder("SELECT * FROM test.table_test where id<=10")));
GenericBean gb= new GenericBean(UtilitaireDao.get(0).executeRequest(c, new GenericPreparedStatementBuilder("SELECT * FROM arc_bas9.table_test where id<=10")));

// copy the content into a target table using copyFromGenericBean
GenericPreparedStatementBuilder query = new GenericPreparedStatementBuilder();
query.copyFromGenericBean("test.table_test_copy", gb);
query.copyFromGenericBean("arc_bas9.table_test_copy", gb);
UtilitaireDao.get(0).executeRequest(c, query);

// test result
testMetadataAndNumberOfRecords("test.table_test_copy", 10, new String[] {"id", "val", "arr", "dd"});
UtilitaireDao.get(0).executeImmediate(c, "DROP SCHEMA IF EXISTS test CASCADE;");
testMetadataAndNumberOfRecords("arc_bas9.table_test_copy", 10, new String[] {"id", "val", "arr", "dd"});
UtilitaireDao.get(0).executeImmediate(c, "DROP SCHEMA IF EXISTS arc_bas9 CASCADE;");

}

Expand Down

0 comments on commit b28ac2d

Please sign in to comment.