[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7324 - in trunk/gnue-common/src/datasources/drivers: DBSIG2 adod
From: |
reinhard |
Subject: |
[gnue] r7324 - in trunk/gnue-common/src/datasources/drivers: DBSIG2 adodbapi/adodbapi postgresql/Base |
Date: |
Fri, 8 Apr 2005 04:51:11 -0500 (CDT) |
Author: reinhard
Date: 2005-04-08 04:51:10 -0500 (Fri, 08 Apr 2005)
New Revision: 7324
Modified:
trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
trunk/gnue-common/src/datasources/drivers/adodbapi/adodbapi/Connection.py
trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
Log:
Phased out a few Python2.1isms.
Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
2005-04-08 09:33:52 UTC (rev 7323)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
2005-04-08 09:51:10 UTC (rev 7324)
@@ -51,8 +51,6 @@
(defaults to False). Can be overwritten by descendants.
@cvar _boolean_true: Value to post to the database for boolean TRUE
(defaults to True). Can be overwritten by descendants.
- @cvar _numbers_as_string: Flags wether to convert numbers to strings or not.
- Can be overwritten by descendants.
@cvar _broken_fetchmany: Can be set to True by descendants if the DBSIG2
module raises an exception if fetchmany() is called when no records are
left.
@@ -65,8 +63,6 @@
_driver = None # DBSIG2 compatible driver module
_boolean_false = False # value to pass for boolean FALSE
_boolean_true = True # value to pass for boolean TRUE
- _numbers_as_string = False # Convert numbers into strings
-
_broken_fetchmany = False # Does fetchmany () raise an exception
# when no records are left?
_broken_rowcount = False # Is cursor.rowcount unusable?
@@ -100,22 +96,13 @@
# Unicode: return encoded string
return value.encode (self._encoding)
- elif sys.hexversion >= 0x02030000 and isinstance (value, BooleanType):
- # Booleans (Python 2.3 and later)
+ elif isinstance (value, BooleanType):
+ # Booleans
if value:
return self._boolean_true
else:
return self._boolean_false
- elif isinstance (value, IntType):
- # Sometimes (sigh), IntType is used for booleans. Some datbases (e.g.
- # postgres) want boolean 0 and 1 values as strings.
- # Can be removed as soon as we require Python 2.3
- if self._numbers_as_string:
- return str (value)
- else:
- return value
-
elif isinstance (value, mx.DateTime.DateTimeType):
# mx.DateTime
return self._driver.Timestamp (value.year, value.month, value.day,
Modified:
trunk/gnue-common/src/datasources/drivers/adodbapi/adodbapi/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/adodbapi/adodbapi/Connection.py
2005-04-08 09:33:52 UTC (rev 7323)
+++ trunk/gnue-common/src/datasources/drivers/adodbapi/adodbapi/Connection.py
2005-04-08 09:51:10 UTC (rev 7324)
@@ -52,11 +52,10 @@
_driver = adodbapi
- # FIXME: These 3 values were the default before. Check if the new default
+ # FIXME: These 2 values were the default before. Check if the new default
# would work, too, and if yes, remove the lines.
_boolean_false = '0'
_boolean_true = '1'
- _numbers_as_string = True
_broken_rowcount = True
Modified:
trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
2005-04-08 09:33:52 UTC (rev 7323)
+++ trunk/gnue-common/src/datasources/drivers/postgresql/Base/Connection.py
2005-04-08 09:51:10 UTC (rev 7324)
@@ -39,12 +39,6 @@
Generic Connection class for PostgreSQL databases.
"""
- import sys
- if sys.hexversion < 0x02020000:
- # For Python 2.1, True and False are 1 and 0, but Postres only likes '1'
- # and '0' for boolean columns.
- _numbers_as_string = True
-
defaultBehavior = Introspection
defaultCreator = Creation
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7324 - in trunk/gnue-common/src/datasources/drivers: DBSIG2 adodbapi/adodbapi postgresql/Base,
reinhard <=