empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1201471 - /incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
Date Sun, 13 Nov 2011 18:39:03 GMT
Author: doebele
Date: Sun Nov 13 18:39:02 2011
New Revision: 1201471

URL: http://svn.apache.org/viewvc?rev=1201471&view=rev
Log:
EMPIREDB-122
added option to for Unicode prefix

Modified:
    incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java

Modified: incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java?rev=1201471&r1=1201470&r2=1201471&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
(original)
+++ incubator/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
Sun Nov 13 18:39:02 2011
@@ -100,15 +100,21 @@ public class DBDatabaseDriverMSSQL exten
     // Sequence treatment
     // When set to 'false' (default) MySQL's auto-increment feature is used.
     private boolean useSequenceTable = false;
+    private boolean useUnicodePrefix = true;
     
     private DBDDLGenerator<?> ddlGenerator = null; // lazy creation
+
+    protected static final String[] MSSQL_SQL_KEYWORDS = new String[] { "type", "key" };
       
     
     /**
      * Constructor for the MSSQL database driver.<br>
      */
     public DBDatabaseDriverMSSQL()
     {
-        // Default Constructor
+        // Initialize List of reserved Keywords
+        for (String keyWord:MSSQL_SQL_KEYWORDS){
+             reservedSQLKeywords.add(keyWord);
+        }
     }
 
     public String getDatabaseName()
@@ -169,6 +175,24 @@ public class DBDatabaseDriverMSSQL exten
 		this.sequenceTableName = sequenceTableName;
 	}
 
+	/**
+	 * Indicates whether or not a Unicode Prefix (N) is prepended to all text values
+	 */
+    public boolean isUseUnicodePrefix()
+    {
+        return useUnicodePrefix;
+    }
+
+    /**
+     * Sets whether or not to use a Unicode Prefix (N) for all text values
+     * Default is true 
+     * @param useUnicodePrefix true if a Unicode Prefix (N) should be used for text values
+     */
+    public void setUseUnicodePrefix(boolean useUnicodePrefix)
+    {
+        this.useUnicodePrefix = useUnicodePrefix;
+    }
+
     /** {@inheritDoc} */
     @Override
     public void attachDatabase(DBDatabase db, Connection conn)
@@ -358,7 +382,7 @@ public class DBDatabaseDriverMSSQL exten
     {
         StringBuilder valBuf = new StringBuilder();
         // for SQLSERVER utf8 support, see EMPIREDB-122
-        valBuf.append("N'");
+        valBuf.append((useUnicodePrefix) ? "N'" : "'");
         if (DBDatabase.EMPTY_STRING.equals(value)==false)
             appendTextValue(valBuf, value.toString());
         valBuf.append("'");



Mime
View raw message