]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
changed mysql TIMESTAMP->DATETIME
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 2 Jan 2006 04:06:57 +0000 (04:06 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 2 Jan 2006 04:06:57 +0000 (04:06 +0000)
fixed up date unit test
RowProxy __iter__ properly routes columns through type processing

lib/sqlalchemy/databases/mysql.py
lib/sqlalchemy/databases/sqlite.py
lib/sqlalchemy/engine.py
test/query.py

index 4e43f36730e93a26c36813d7aeb02b1dc6eee716..21dbc2c17abfd40ebf9c95242c7a21ac7a4c7de7 100644 (file)
@@ -30,7 +30,7 @@ class MSInteger(sqltypes.Integer):
         return "INTEGER"
 class MSDateTime(sqltypes.DateTime):
     def get_col_spec(self):
-        return "TIMESTAMP"
+        return "DATETIME"
 class MSText(sqltypes.TEXT):
     def get_col_spec(self):
         return "TEXT"
index 5a143a201c7fd0fe04311552b7f7786b15d29e03..5708247e20a0fb6976a8042bdaedab0c1fc927c8 100644 (file)
@@ -30,8 +30,11 @@ class SLDateTime(sqltypes.DateTime):
     def get_col_spec(self):
         return "TIMESTAMP"
     def convert_result_value(self, value):
+        print "RESULT", value
         if value is None:
+            print "RETNONE"
             return None
+        print "HI"
         parts = value.split('.')
         try:
             (value, microsecond) = value.split('.')
index 07574a260ab9dd6845d66f95452537ced0d2fbad..580d854505ec267ac47dde6c1d05fc6b5282c1f9 100644 (file)
@@ -670,7 +670,8 @@ class RowProxy:
         self.parent = parent
         self.row = row
     def __iter__(self):
-        return iter(self.row)
+        for i in range(0, len(self.row)):
+            yield self.parent._get_col(self.row, i)
     def __eq__(self, other):
         return (other is self) or (other == tuple([self.parent._get_col(self.row, key) for key in range(0, len(self.row))]))
     def __repr__(self):
index e3d1767b51e3581d0b91ccbfd0b3e0465b4ba00e..945893844136b4f36dbde3c734d0dcf3cc8720b4 100644 (file)
@@ -54,8 +54,18 @@ class QueryTest(PersistTest):
            users_with_date.insert().execute(user_id = 8, user_name = 'roy', user_date=datetime.datetime(2005,11,10, 11,52,35))
            users_with_date.insert().execute(user_id = 9, user_name = 'foo', user_date=datetime.datetime(2005,11,10, 11,52,35, 54839))
            users_with_date.insert().execute(user_id = 10, user_name = 'colber', user_date=None)
-           print repr(users_with_date.select().execute().fetchall())
-           users_with_date.drop()
+           l = users_with_date.select().execute().fetchall()
+           l = [[c for c in r] for r in l]
+           if db.engine.__module__.endswith('mysql'):
+               x = [[7, 'jack', datetime.datetime(2005, 11, 10, 0, 0)], [8, 'roy', datetime.datetime(2005, 11, 10, 11, 52, 35)], [9, 'foo', datetime.datetime(2005, 11, 10, 11, 52, 35)], [10, 'colber', None]]
+           else:
+               x = [[7, 'jack', datetime.datetime(2005, 11, 10, 0, 0)], [8, 'roy', datetime.datetime(2005, 11, 10, 11, 52, 35)], [9, 'foo', datetime.datetime(2005, 11, 10, 11, 52, 35, 54839)], [10, 'colber', None]]
+           print repr(l)
+           print repr(x)
+           try:
+               self.assert_(l == x)
+           finally:
+               users_with_date.drop()
 
     def testdefaults(self):
         x = {'x':0}