Skip to content

Commit

Permalink
Revert "[jdbc] Select the proper schema when retrieving the item tabl…
Browse files Browse the repository at this point in the history
…es (#11023)"

This reverts commit 291d904.

Signed-off-by: dw-8 <[email protected]>
  • Loading branch information
dw-8 committed Jul 25, 2021
1 parent ad35fc4 commit 992d960
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ private void initSqlQueries() {
sqlIfTableExists = "SELECT * FROM PG_TABLES WHERE TABLENAME='#searchTable#'";
sqlCreateItemsTableIfNot = "CREATE TABLE IF NOT EXISTS #itemsManageTable# (itemid SERIAL NOT NULL, #colname# #coltype# NOT NULL, CONSTRAINT #itemsManageTable#_pkey PRIMARY KEY (itemid))";
sqlCreateNewEntryInItemsTable = "INSERT INTO items (itemname) SELECT itemname FROM #itemsManageTable# UNION VALUES ('#itemname#') EXCEPT SELECT itemname FROM items";
sqlGetItemTables = "SELECT table_name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema=(SELECT table_schema "
+ "FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_name='#itemsManageTable#') AND NOT table_name='#itemsManageTable#'";
sqlGetItemTables = "SELECT table_name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema='public' AND NOT table_name='#itemsManageTable#'";
// http://stackoverflow.com/questions/17267417/how-do-i-do-an-upsert-merge-insert-on-duplicate-update-in-postgresql
// for later use, PostgreSql > 9.5 to prevent PRIMARY key violation use:
// SQL_INSERT_ITEM_VALUE = "INSERT INTO #tableName# (TIME, VALUE) VALUES( NOW(), CAST( ? as #dbType#) ) ON
Expand Down Expand Up @@ -122,10 +121,9 @@ public Long doCreateNewEntryInItemsTable(ItemsVO vo) {

@Override
public List<ItemsVO> doGetItemTables(ItemsVO vo) {
String sql = StringUtilsExt.replaceArrayMerge(this.sqlGetItemTables,
new String[] { "#itemsManageTable#", "#itemsManageTable#" },
new String[] { vo.getItemsManageTable(), vo.getItemsManageTable() });
this.logger.debug("JDBC::doGetItemTables sql={}", sql);
String sql = StringUtilsExt.replaceArrayMerge(sqlGetItemTables, new String[] { "#itemsManageTable#" },
new String[] { vo.getItemsManageTable() });
logger.debug("JDBC::doGetItemTables sql={}", sql);
return Yank.queryBeanList(sql, ItemsVO.class, null);
}

Expand Down

0 comments on commit 992d960

Please sign in to comment.