Commits

Mike Bayer committed 0f1b087

- func.sysdate() emits "SYSDATE()", i.e. with the ending
parenthesis, on MySQL. [ticket:1794]

Comments (0)

Files changed (3)

     
 - engines
   - Fixed building the C extensions on Python 2.4. [ticket:1781]
-    
+
+- mysql
+  - func.sysdate() emits "SYSDATE()", i.e. with the ending
+    parenthesis, on MySQL.  [ticket:1794]
+
 - oracle
   - Added a check for cx_oracle versions lower than version 5,
     in which case the incompatible "output type handler" won't 

lib/sqlalchemy/dialects/mysql/base.py

     
     def visit_utc_timestamp_func(self, fn, **kw):
         return "UTC_TIMESTAMP"
+    
+    def visit_sysdate_func(self, fn, **kw):
+        return "SYSDATE()"
         
     def visit_concat_op(self, binary, **kw):
         return "concat(%s, %s)" % (self.process(binary.left), self.process(binary.right))

test/dialect/test_mysql.py

     def test_utc_timestamp(self):
         self.assert_compile(func.utc_timestamp(), "UTC_TIMESTAMP")
 
+    def test_sysdate(self):
+        self.assert_compile(func.sysdate(), "SYSDATE()")
+        
     def test_cast(self):
         t = sql.table('t', sql.column('col'))
         m = mysql
         meta.reflect(cx)
         eq_(cx.dialect._connection_charset, charset)
         cx.close()
-
+    
+    def test_sysdate(self):
+        d = testing.db.scalar(func.sysdate())
+        assert isinstance(d, datetime.datetime)
 
 class MatchTest(TestBase, AssertsCompiledSQL):
     __only_on__ = 'mysql'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.