openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r1030235 - in /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql: AbstractSQLServerDictionary.java SQLServerDictionary.java
Date Tue, 02 Nov 2010 21:28:24 GMT
Author: dwoods
Date: Tue Nov  2 21:28:23 2010
New Revision: 1030235

URL: http://svn.apache.org/viewvc?rev=1030235&view=rev
Log:
OPENJPA-1759 Use new DATETIME2 type in MSSQL2008 for new tables with DATE or TIMESTAMP columns,
but 3.0 driver still doesn't handle 2.0 created tables with DATETIME columns....

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractSQLServerDictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractSQLServerDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractSQLServerDictionary.java?rev=1030235&r1=1030234&r2=1030235&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractSQLServerDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractSQLServerDictionary.java
Tue Nov  2 21:28:23 2010
@@ -79,6 +79,7 @@ public abstract class AbstractSQLServerD
             "IMAGE", "TEXT", "NTEXT", "MONEY", "SMALLMONEY", "INT",
             "DOUBLE PRECISION", "DATETIME", "SMALLDATETIME",
             "EXTENDED TYPE", "SYSNAME", "SQL_VARIANT", "INDEX",
+            "DATETIME2",
         }));
     }
 

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java?rev=1030235&r1=1030234&r2=1030235&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
Tue Nov  2 21:28:23 2010
@@ -22,9 +22,12 @@ import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Timestamp;
 import java.sql.Types;
+import java.util.Calendar;
 import java.util.Set;
 
 import org.apache.openjpa.jdbc.identifier.DBIdentifier;
@@ -74,7 +77,7 @@ public class SQLServerDictionary extends
         if (driverVendor == null) {
             if (driverName != null) {
                 if (driverName.startsWith("Microsoft SQL Server")) {
-                    // v1.1, 1.2 or 2.0 driver
+                    // v1.1, 1.2, 2.0 or 3.0 driver
                     driverVendor = VENDOR_MICROSOFT;
                     // serverMajorVersion of 8==2000, 9==2005, 10==2008
                     if (meta.getDatabaseMajorVersion() >= 9)
@@ -88,6 +91,13 @@ public class SQLServerDictionary extends
                         // and disableStatementPooling=true
                         requiresWarnings = false;
                     }
+                    if (meta.getDatabaseMajorVersion() >= 10) {
+                        // MSSQL 2008 supports new date, time and datetime2 types
+                        // Use DATETIME2 which has 100ns vs. 3.333msec precision
+                        dateTypeName = "DATETIME2";
+                        timeTypeName = "DATETIME";
+                        timestampTypeName = "DATETIME2";
+                    }
                 } else {
                     if ("NetDirect JSQLConnect".equals(driverName))
                         driverVendor = VENDOR_NETDIRECT;
@@ -321,5 +331,4 @@ public class SQLServerDictionary extends
         return clob.getCharacterStream();
     }
 
-    
 }



Mime
View raw message