From 44bd6f235c12c3dcf806622c4cdf36b7b4fa5d34 Mon Sep 17 00:00:00 2001 From: Redkale <8730487+redkale@users.noreply.github.com> Date: Thu, 25 Jul 2019 16:58:20 +0800 Subject: [PATCH] --- src/org/redkale/source/DataJdbcSource.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/org/redkale/source/DataJdbcSource.java b/src/org/redkale/source/DataJdbcSource.java index 3aba98f83..e27a9e182 100644 --- a/src/org/redkale/source/DataJdbcSource.java +++ b/src/org/redkale/source/DataJdbcSource.java @@ -73,14 +73,15 @@ public class DataJdbcSource extends DataSqlSource { if (info.tableStrategy == null || !info.isTableNotExist(se)) throw se; synchronized (info.tables) { final String oldTable = info.table; - final String newTable = info.getTable(entitys[0]); final String catalog = conn.getCatalog(); - if (!info.tables.contains(catalog + '.' + newTable)) { + final String newTable = info.getTable(entitys[0]); + final String tablekey = newTable.indexOf('.') > 0 ? newTable : (catalog + '.' + newTable); + if (!info.tables.contains(tablekey)) { try { Statement st = conn.createStatement(); st.execute(info.tablecopySQL.replace("${newtable}", newTable).replace("${oldtable}", oldTable)); st.close(); - info.tables.add(catalog + '.' + newTable); + info.tables.add(tablekey); } catch (SQLException sqle) { //多进程并发时可能会出现重复建表 if (newTable.indexOf('.') > 0 && info.isTableNotExist(se)) { Statement st; @@ -95,7 +96,7 @@ public class DataJdbcSource extends DataSqlSource { st = conn.createStatement(); st.execute(info.tablecopySQL.replace("${newtable}", newTable).replace("${oldtable}", oldTable)); st.close(); - info.tables.add(newTable); + info.tables.add(tablekey); } catch (SQLException sqle2) { logger.log(Level.SEVERE, "create table2(" + info.tablecopySQL.replace("${newtable}", newTable).replace("${oldtable}", oldTable) + ") error", sqle2); }