This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SQLObject development repository".
The branch, 2.1 has been updated
via b3381c4d9fc2f0d2579a83a0a3e70e821871202e (commit)
via 4384a86393b2ae832e7765cfdd0641943352d9a8 (commit)
via 62c12c3c36164a981ee1430a66e285048d2d0d78 (commit)
via 48cd28437ddf45eadac2bb6b503f49f869d0b995 (commit)
from 6abfcc4936a5005a736dac22f44d776f85b71c37 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/b3381c4d9fc2f0d2579a83a0a3e70e821871202e
commit b3381c4d9fc2f0d2579a83a0a3e70e821871202e
Author: Oleg Broytman <ph...@ph...>
Date: Wed Jun 10 18:20:04 2015 +0300
For MSSQL use datetime2(6) and time(6) columns
diff --git a/docs/News.txt b/docs/News.txt
index 928a5e9..c559599 100644
--- a/docs/News.txt
+++ b/docs/News.txt
@@ -13,6 +13,8 @@ SQLObject 2.1.3
* Minor refactoring to pave the way to Python 3 was merged from
`SQLObject 1.6.7`_.
+* For MSSQL use datetime2(6) and time(6) columns.
+
SQLObject 2.1.2
===============
@@ -69,6 +71,9 @@ Features & Interface
``ALTER TABLE name MODIFY COLUMN col TIME(6)`` for every column that
you want to store microseconds.
+ For MSSQL use datetime2(6) and time(6) columns. They are available
+ since MS SQL Server 2008.
+
WARNING: backward compatibility problem! Date/Time columns created
with microseconds cannot be read back from SQLite databases (and
perhaps other backends) with versions of SQLObject older than 1.7.
diff --git a/sqlobject/col.py b/sqlobject/col.py
index 1a677bb..087f8f8 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -1206,7 +1206,10 @@ class SODateTimeCol(SOCol):
return 'DATETIME'
def _mssqlType(self):
- return 'DATETIME'
+ if self.connection and self.connection.can_use_microseconds():
+ return 'DATETIME2(6)'
+ else:
+ return 'DATETIME'
def _sqliteType(self):
return 'TIMESTAMP'
@@ -1339,6 +1342,12 @@ class SOTimeCol(SOCol):
def _sybaseType(self):
return 'TIME'
+ def _mssqlType(self):
+ if self.connection and self.connection.can_use_microseconds():
+ return 'TIME(6)'
+ else:
+ return 'TIME'
+
def _sqliteType(self):
return 'TIME'
diff --git a/sqlobject/mssql/mssqlconnection.py b/sqlobject/mssql/mssqlconnection.py
index 9954dd6..a61343a 100644
--- a/sqlobject/mssql/mssqlconnection.py
+++ b/sqlobject/mssql/mssqlconnection.py
@@ -82,6 +82,7 @@ class MSSQLConnection(DBAPI):
self.db = db
self._server_version = None
self._can_use_max_types = None
+ self._can_use_microseconds = None
DBAPI.__init__(self, **kw)
@classmethod
@@ -323,3 +324,11 @@ class MSSQLConnection(DBAPI):
self._can_use_max_types = can_use_max_types = \
(server_version is not None) and (server_version >= 9)
return can_use_max_types
+
+ def can_use_microseconds(self):
+ if self._can_use_microseconds is not None:
+ return self._can_use_microseconds
+ server_version = self.server_version()
+ self._can_use_microseconds = can_use_microseconds = \
+ (server_version is not None) and (server_version >= 10)
+ return can_use_microseconds
http://sourceforge.net/p/sqlobject/sqlobject/ci/4384a86393b2ae832e7765cfdd0641943352d9a8
commit 4384a86393b2ae832e7765cfdd0641943352d9a8
Merge: 6abfcc4 62c12c3
Author: Oleg Broytman <ph...@ph...>
Date: Wed Jun 10 18:07:55 2015 +0300
Merge branch '1.7' into 2.1
-----------------------------------------------------------------------
Summary of changes:
docs/News.txt | 7 +++++++
sqlobject/col.py | 11 ++++++++++-
sqlobject/mssql/mssqlconnection.py | 15 +++++++++++++++
3 files changed, 32 insertions(+), 1 deletions(-)
hooks/post-receive
--
SQLObject development repository
|