]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
get most oracle tests in sql working again....
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 18 Dec 2007 06:13:42 +0000 (06:13 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 18 Dec 2007 06:13:42 +0000 (06:13 +0000)
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/functions.py
test/sql/testtypes.py

index 3219e6c5b81706ba16f0c3b2454903babb79e612..783d60cf446de58d39f408e29ba5d26ca8988e8a 100644 (file)
@@ -1656,8 +1656,17 @@ class BufferedColumnResultProxy(ResultProxy):
     _process_row = BufferedColumnRow
 
     def _get_col(self, row, key):
-        rec = self._key_cache[key]
-        return row[rec[2]]
+        try:
+            rec = self._key_cache[key]
+            return row[rec[2]]
+        except TypeError:
+            # the 'slice' use case is very infrequent,
+            # so we use an exception catch to reduce conditionals in _get_col
+            if isinstance(key, slice):
+                indices = key.indices(len(row))
+                return tuple([self._get_col(row, i) for i in xrange(*indices)])
+            else:
+                raise
 
     def fetchall(self):
         l = []
index 30b4089d319a08ca7784d596f8b0c7d2610d4110..2472853847a3126777978b462ee4c1193d950135 100644 (file)
@@ -90,6 +90,7 @@ FUNCTIONS = {
     functions.current_user: 'CURRENT_USER', 
     functions.localtime: 'LOCALTIME', 
     functions.localtimestamp: 'LOCALTIMESTAMP',
+    functions.sysdate: 'sysdate',
     functions.session_user :'SESSION_USER', 
     functions.user: 'USER'
 }
index d39032b91c937ffb070431996a9d12aded5754d4..869df46a7eaee74d5ffb5b2bb7a63485c8bf5812 100644 (file)
@@ -67,6 +67,9 @@ class localtimestamp(AnsiFunction):
 class session_user(AnsiFunction):
     __return_type__ = sqltypes.String
 
+class sysdate(AnsiFunction):
+    __return_type__ = sqltypes.DateTime
+
 class user(AnsiFunction):
     __return_type__ = sqltypes.String
 
@@ -75,4 +78,4 @@ def _type_from_args(args):
         if not isinstance(a.type, sqltypes.NullType):
             return a.type
     else:
-        return sqltypes.NullType
\ No newline at end of file
+        return sqltypes.NullType
index 073af3e39ac2f3111f6204d5a593db7ec425b5e9..69696ec642f2b8f3559718bdd1f60841fd432887 100644 (file)
@@ -73,11 +73,13 @@ class MyPickleType(types.TypeDecorator):
     impl = PickleType
     
     def process_bind_param(self, value, dialect):
-        value.stuff = 'this is modified stuff'
+        if value:
+            value.stuff = 'this is modified stuff'
         return value
     
     def process_result_value(self, value, dialect):
-        value.stuff = 'this is the right stuff'
+        if value:
+            value.stuff = 'this is the right stuff'
         return value
         
 class LegacyType(types.TypeEngine):