empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rei...@apache.org
Subject svn commit: r689082 - /incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/db/DBColumn.java
Date Tue, 26 Aug 2008 13:58:59 GMT
Author: reiher
Date: Tue Aug 26 06:58:58 2008
New Revision: 689082

URL: http://svn.apache.org/viewvc?rev=689082&view=rev
Log:
JIRA EMPIREDB-3 fix: added "useQuotes" property

Modified:
    incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/db/DBColumn.java

Modified: incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/db/DBColumn.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/db/DBColumn.java?rev=689082&r1=689081&r2=689082&view=diff
==============================================================================
--- incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/db/DBColumn.java (original)
+++ incubator/empire-db/trunk/core/Empire-db/src/org/apache/empire/db/DBColumn.java Tue Aug
26 06:58:58 2008
@@ -50,7 +50,9 @@
     protected final DBRowSet   rowset;
     protected final String     name;
     protected String           comment;
-
+    
+    protected boolean          useQuotes = false;
+    
     /**
      * Constructs a DBColumn object and set the specified parameters to this object.
      *
@@ -85,6 +87,14 @@
      */
     public abstract boolean isReadOnly();
 
+    /**
+     * @return Returns true if the column will be surrounded by quotes.
+     */
+    public boolean isUseQuotes()
+    {
+        return useQuotes;
+    }
+
 
     public abstract boolean checkValue(Object value);
 
@@ -118,14 +128,20 @@
      */
     @Override
     public void addSQL(StringBuilder buf, long context)
-    { // Alias verwenden wenn nicht select
-
+    { 
+        // Use alias if no select
         if ((context & CTX_FULLNAME) != 0 && rowset != null)
         { // Fully Qualified Name
             buf.append(rowset.getAlias());
             buf.append(".");
         }
+        // Use Quotes
+        if (useQuotes)
+            buf.append("\"");
         buf.append(name);
+        // Use Quotes
+        if (useQuotes)
+            buf.append("\"");
     }
 
     /**
@@ -246,4 +262,13 @@
         this.comment = comment;
     }
 
+    /**
+     * If set to TRUE, the column will be surronded by quotation marks in the SQL.
+     * 
+     * @param useQuotes flag to set quotes
+     */
+    public void setUseQuotes(boolean useQuotes)
+    {
+        this.useQuotes = useQuotes;
+    }    
 }
\ No newline at end of file



Mime
View raw message