empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject empire-db git commit: EMPIREDB-258 added "plan" as keyword. fixed modulo function syntax.
Date Fri, 30 Jun 2017 07:28:04 GMT
Repository: empire-db
Updated Branches:
  refs/heads/master 6283adbbb -> 0c4337e2a


EMPIREDB-258
added "plan" as keyword.
fixed modulo function syntax.


Project: http://git-wip-us.apache.org/repos/asf/empire-db/repo
Commit: http://git-wip-us.apache.org/repos/asf/empire-db/commit/0c4337e2
Tree: http://git-wip-us.apache.org/repos/asf/empire-db/tree/0c4337e2
Diff: http://git-wip-us.apache.org/repos/asf/empire-db/diff/0c4337e2

Branch: refs/heads/master
Commit: 0c4337e2a2dab8e6d9c04422fb5c062f044529b5
Parents: 6283adb
Author: Rainer Döbele <doebele@apache.org>
Authored: Fri Jun 30 09:28:00 2017 +0200
Committer: Rainer Döbele <doebele@apache.org>
Committed: Fri Jun 30 09:28:00 2017 +0200

----------------------------------------------------------------------
 .../db/sqlserver/DBDatabaseDriverMSSQL.java     | 26 +++++++++++++++++---
 1 file changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/empire-db/blob/0c4337e2/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
----------------------------------------------------------------------
diff --git a/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
b/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
index 1d53257..42d9cfe 100644
--- a/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
+++ b/empire-db/src/main/java/org/apache/empire/db/sqlserver/DBDatabaseDriverMSSQL.java
@@ -36,6 +36,7 @@ import org.apache.empire.db.DBRelation;
 import org.apache.empire.db.DBSQLScript;
 import org.apache.empire.db.DBTable;
 import org.apache.empire.db.DBTableColumn;
+import org.apache.empire.db.DBDatabaseDriver.DBSetGenKeys;
 import org.apache.empire.db.exceptions.EmpireSQLException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -100,13 +101,13 @@ public class DBDatabaseDriverMSSQL extends DBDatabaseDriver
     private String objectOwner = "dbo";
     private String sequenceTableName = "Sequences";
     // Sequence treatment
-    // When set to 'false' (default) MySQL's auto-increment feature is used.
+    // When set to 'false' (default) MySQL's IDENTITY 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" };
       
+    protected static final String[] MSSQL_SQL_KEYWORDS = new String[] { "type", "key", "plan"
};        
     
     /**
      * Constructor for the MSSQL database driver.<br>
@@ -197,7 +198,7 @@ public class DBDatabaseDriverMSSQL extends DBDatabaseDriver
 
     /** {@inheritDoc} */
     @Override
-    public void attachDatabase(DBDatabase db, Connection conn)
+    protected void attachDatabase(DBDatabase db, Connection conn)
     {
         // Prepare
         try
@@ -305,7 +306,7 @@ public class DBDatabaseDriverMSSQL extends DBDatabaseDriver
             case SQL_FUNC_TRUNC:              return "trunc(?,{0})";
             case SQL_FUNC_CEILING:            return "ceiling(?)";
             case SQL_FUNC_FLOOR:              return "floor(?)";
-            case SQL_FUNC_MODULO:             return "mod(?,{0})";
+            case SQL_FUNC_MODULO:             return "((?) % {0})";
             // Date
             case SQL_FUNC_DAY:                return "day(?)";
             case SQL_FUNC_MONTH:              return "month(?)";
@@ -423,6 +424,23 @@ public class DBDatabaseDriverMSSQL extends DBDatabaseDriver
     }
 
     /**
+     * @see DBDatabaseDriver#executeSQL(String, Object[], Connection, DBSetGenKeys)  
+     */
+    @Override
+    public int executeSQL(String sqlCmd, Object[] sqlParams, Connection conn, DBSetGenKeys
genKeys)
+        throws SQLException
+    {
+        int affected = super.executeSQL(sqlCmd, sqlParams, conn, genKeys);
+        if (affected<0)
+        {   // less than 0?
+            log.warn("executeSQL for {} retuned {} affected records!", sqlCmd, affected);
+            return 0;
+        }
+        return affected;
+        
+    }
+    
+    /**
      * @see DBDatabaseDriver#getDDLScript(DBCmdType, DBObject, DBSQLScript)  
      */
     @Override


Mime
View raw message