提交 1dc18673 编写于 作者: J jurgen

QMDB model fix

Former-commit-id: b75dc855
上级 6317f1e9
......@@ -163,6 +163,18 @@ public abstract class JDBCDataSource
}
}
protected void closeConnection(Connection connection)
{
if (connection != null) {
try {
connection.close();
}
catch (Throwable ex) {
log.error(ex);
}
}
}
protected String getConnectionUserName(DBPConnectionConfiguration connectionInfo)
{
return connectionInfo.getUserName();
......
......@@ -88,6 +88,15 @@ public class JDBCExecutionContext extends AbstractExecutionContext<JDBCDataSourc
} catch (Throwable e) {
log.warn("Can't set auto-commit state", e); //$NON-NLS-1$
}
{
// Cache auto-commit
try {
this.autoCommit = connection.getAutoCommit();
} catch (Throwable e) {
log.warn("Can't check auto-commit state", e); //$NON-NLS-1$
this.autoCommit = false;
}
}
if (!this.autoCommit && txnLevel != null) {
try {
......@@ -97,14 +106,6 @@ public class JDBCExecutionContext extends AbstractExecutionContext<JDBCDataSourc
log.warn("Can't set transaction isolation level", e); //$NON-NLS-1$
}
}
{
// Cache auto-commit
try {
this.autoCommit = connection.getAutoCommit();
} catch (Throwable e) {
log.warn("Can't check auto-commit state", e); //$NON-NLS-1$
}
}
this.initContextBootstrap(monitor, autoCommit);
......@@ -172,18 +173,8 @@ public class JDBCExecutionContext extends AbstractExecutionContext<JDBCDataSourc
// [JDBC] Need sync here because real connection close could take some time
// while UI may invoke callbacks to operate with connection
synchronized (this) {
// try {
// Thread.sleep(10000);
// } catch (InterruptedException e) {
// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
// }
if (connection != null) {
try {
connection.close();
}
catch (Throwable ex) {
log.error(ex);
}
this.dataSource.closeConnection(connection);
connection = null;
}
super.closeContext();
......
......@@ -117,7 +117,7 @@ class ForeignKeysCache extends JDBCCompositeCache<GenericStructContainer, Generi
if (!CommonUtils.isEmpty(pkName)) {
pk = DBUtils.findObject(pkTable.getConstraints(session.getProgressMonitor()), pkName);
if (pk == null) {
log.warn("Unique key '" + pkName + "' not found in table " + pkTable.getFullQualifiedName());
log.debug("Unique key '" + pkName + "' not found in table " + pkTable.getFullQualifiedName());
}
}
if (pk == null) {
......
......@@ -366,7 +366,7 @@ public class GenericTable extends JDBCTable<GenericDataSource, GenericStructCont
if (!CommonUtils.isEmpty(info.pkName)) {
pk = DBUtils.findObject(this.getConstraints(monitor), info.pkName);
if (pk == null) {
log.warn("Unique key '" + info.pkName + "' not found in table " + this.getFullQualifiedName());
log.debug("Unique key '" + info.pkName + "' not found in table " + this.getFullQualifiedName());
}
}
if (pk == null) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册