2014-07-08 19 views
0

我试图创建一个简单的插件,可以将其粘贴到我们的日志中的sql查询中,并让它在列表中显示列名和插入值。除了日期和时间之外,我已经使用它了,因为我们的DB2数据库使用特殊值,如{d: '2014-07-03'}而不是'2014-07-03'获取特定于DB2的解析器实例

我如何找出什么样的价值观,我需要传递给SQLQueryParserManagerProvider.getInstance().getParserManager(dbProduct, dbVersion);

获得能够处理这些值的权利解析器?

回答

0

建立在数据库开发视图的连接(我叫雷QA),双击打开一个连接,然后运行:

IConnectionProfile profile = ProfileManager.getInstance().getProfileByName("QA"); 
Database db = getDatabase(profile); 
if (db != null) { 
    System.out.println("DB Vendor: " + db.getVendor()); 
    System.out.println("DB Version: " + db.getVersion()); 
} 

getDatabase方法从this page末取

private Database getDatabase(IConnectionProfile profile) { 
    IManagedConnection managedConnection = ((IConnectionProfile) profile) 
      .getManagedConnection("org.eclipse.datatools.connectivity.sqm.core.connection.ConnectionInfo"); 
    if (managedConnection != null) { 
     try { 
      ConnectionInfo connectionInfo = (ConnectionInfo) managedConnection.getConnection().getRawConnection(); 
      if (connectionInfo != null) { 
       Database database = connectionInfo.getSharedDatabase(); 
       return database; 
      } 
     } 
     catch (Exception e) { 
      e.printStackTrace(); 
     } 
    } 
    return null; 
} 
+0

也发现'{d:'2014-07-03'}'是特殊的[JDBC语法](http://www.mindprod.com/jgloss/jdbc.html#LITERALS) –

相关问题