[teiid-commits] teiid SVN: r840 - trunk/server/src/main/java/com/metamatrix/common/log/reader.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu Apr 23 18:44:04 EDT 2009


Author: vhalbert at redhat.com
Date: 2009-04-23 18:44:04 -0400 (Thu, 23 Apr 2009)
New Revision: 840

Modified:
   trunk/server/src/main/java/com/metamatrix/common/log/reader/DBLogReader.java
Log:
JBEDSP-803 - this is related to the postgres issue, changed to determine the quote at the initialization of the class instead on every call (getDatabaseMetadata() can be expensive is called on every write)

Modified: trunk/server/src/main/java/com/metamatrix/common/log/reader/DBLogReader.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/common/log/reader/DBLogReader.java	2009-04-23 22:43:10 UTC (rev 839)
+++ trunk/server/src/main/java/com/metamatrix/common/log/reader/DBLogReader.java	2009-04-23 22:44:04 UTC (rev 840)
@@ -38,6 +38,7 @@
 import com.metamatrix.common.CommonPlugin;
 import com.metamatrix.common.config.CurrentConfiguration;
 import com.metamatrix.common.config.JDBCConnectionPoolHelper;
+import com.metamatrix.common.jdbc.JDBCPlatform;
 import com.metamatrix.common.util.ErrorMessageKeys;
 import com.metamatrix.common.util.PropertiesUtils;
 import com.metamatrix.core.util.DateUtil;
@@ -66,12 +67,11 @@
 
     public static final String DEFAULT_TABLE_NAME = "LOGENTRIES";//$NON-NLS-1$
 
-
-   
-	
     private Properties properties;
 
     protected String tableName;
+    
+    protected String quote=null;
 
   
     
@@ -93,12 +93,25 @@
 
         // Get the table name
         this.tableName = properties.getProperty(TABLE_PROPERTY_NAME, DEFAULT_TABLE_NAME );
+        
+        Connection connection = null;
+        try {
+        	connection = getConnection();
+        	quote = JDBCPlatform.getIdentifierQuoteString(connection); 
+        	
+        } catch (SQLException e) {
+            throw new MetaMatrixComponentException(e, ErrorMessageKeys.LOG_ERR_0032, CommonPlugin.Util.getString(ErrorMessageKeys.LOG_ERR_0032, ""));
+        } finally {
+            close(connection);
+        }
+
      }
 
 
    
     protected Connection getConnection() throws SQLException {
     	return JDBCConnectionPoolHelper.getInstance().getConnection();
+    	
     }
     
 
@@ -136,7 +149,7 @@
         try {
             //get connection
             connection = getConnection();
-            
+                        
             //get sql
             sqlString = createSQL(startTime, endTime, levels, contexts, maxRows);
             
@@ -175,7 +188,7 @@
             // if we do it in LogEntryPropertyNames.ColumnName.EXCEPTION then
             // the console breaks.
             if (colName.equals(LogEntryPropertyNames.ColumnName.EXCEPTION)) {
-            	sql.append('"'+colName+'"');
+            	sql.append(quote +colName+ quote);
             } else {
             	sql.append(colName);
             }




More information about the teiid-commits mailing list