Author: phd
Date: 2009-04-17 10:44:30 -0600 (Fri, 17 Apr 2009)
New Revision: 3855
Modified:
SQLObject/trunk/docs/News.txt
SQLObject/trunk/sqlobject/col.py
SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
Log:
Partially merged revision 3853 from branch 0.9:
a bug in MSSQLConnection related to properties was fixed.
Modified: SQLObject/trunk/docs/News.txt
===================================================================
--- SQLObject/trunk/docs/News.txt 2009-04-17 16:41:57 UTC (rev 3854)
+++ SQLObject/trunk/docs/News.txt 2009-04-17 16:44:30 UTC (rev 3855)
@@ -178,6 +178,12 @@
are now recognized and created as proper ForeignKey with correct
column name and table name.
+* Bugs in PostgresConnection and MSSQLConnection related to properties was
+ fixed. A note for developers: from now on properties in DBConnection
+ classes are forbidden as they don't work with Transaction -
+ Transaction.__getattr__() cannot properly wrap 'self' so a property is
+ called with wrong 'self'.
+
SQLObject 0.9.9
===============
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2009-04-17 16:41:57 UTC (rev 3854)
+++ SQLObject/trunk/sqlobject/col.py 2009-04-17 16:44:30 UTC (rev 3855)
@@ -479,7 +479,7 @@
if self.customSQLType is not None:
return self.customSQLType
if not self.length:
- if self.connection and self.connection.can_use_max_types:
+ if self.connection and self.connection.can_use_max_types():
type = 'VARCHAR(MAX)'
else:
type = 'varchar(4000)'
@@ -1458,7 +1458,7 @@
return 'BYTEA'
def _mssqlType(self):
- if self.connection and self.connection.can_use_max_types:
+ if self.connection and self.connection.can_use_max_types():
return 'VARBINARY(MAX)'
else:
return "IMAGE"
Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2009-04-17 16:41:57 UTC (rev 3854)
+++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2009-04-17 16:44:30 UTC (rev 3855)
@@ -60,6 +60,7 @@
self.limit_re = re.compile('^\s*(select )(.*)', re.IGNORECASE)
self.password = password
self.module = sqlmodule
+ self._can_use_max_types = None
DBAPI.__init__(self, **kw)
def connectionFromURI(cls, uri):
@@ -277,7 +278,6 @@
else:
return col.Col, {}
- @property
def server_version(self):
try:
server_version = self.queryAll("SELECT SERVERPROPERTY('productversion')")[0][0]
@@ -288,9 +288,10 @@
self.server_version = server_version # cache it forever
return server_version
- @property
def can_use_max_types(self):
- server_version = self.server_version
- self.can_use_max_types = can_use_max_types = \
+ if self._can_use_max_types is not None:
+ return self._can_use_max_types
+ server_version = self.server_version()
+ self._can_use_max_types = can_use_max_types = \
(server_version is not None) and (server_version >= 9)
return can_use_max_types
|