]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed the "numeric" paramstyle, which apparently is the
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 20 Oct 2009 16:17:48 +0000 (16:17 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 20 Oct 2009 16:17:48 +0000 (16:17 +0000)
default paramstyle used by Informixdb.

CHANGES
lib/sqlalchemy/sql/compiler.py
test/sql/test_select.py

diff --git a/CHANGES b/CHANGES
index 4ecb2552eaf952501f7007d8517b66a56f482a15..231f97828f5db5ae903dcb9d28bb59d2f8c04c34 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -23,6 +23,10 @@ CHANGES
       by contains_eager() out of individual instance states.
       [ticket:1553]
 
+- sql
+    - Fixed the "numeric" paramstyle, which apparently is the
+      default paramstyle used by Informixdb.
+      
 - postgresql
     - Added support for reflecting the DOUBLE PRECISION type,
       via a new postgres.PGDoublePrecision object.  
index 6af65ec140b36cb729118079bfee8de5e56c8193..9c06d99277ef0b57a460c677f294caac103184ac 100644 (file)
@@ -52,7 +52,7 @@ BIND_TEMPLATES = {
     'pyformat':"%%(%(name)s)s",
     'qmark':"?",
     'format':"%%s",
-    'numeric':"%(position)s",
+    'numeric':":%(position)s",
     'named':":%(name)s"
 }
 
index f70492fb31e949106c466da72a5708a99fefd436..941973e5fbd1552aa495ffb772e9ecabf0bf07b2 100644 (file)
@@ -152,6 +152,36 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A
             select([cast("data", sqlite.SLInteger)], use_labels=True),      # this will work with plain Integer in 0.6
             "SELECT CAST(:param_1 AS INTEGER) AS anon_1"
         )
+    
+    def test_paramstyles(self):
+        
+        stmt = text("select :foo, :bar, :bat from sometable")
+        
+        self.assert_compile(
+            stmt,
+            "select ?, ?, ? from sometable"
+            , dialect=default.DefaultDialect(paramstyle='qmark')
+        )
+        self.assert_compile(
+            stmt,
+            "select :foo, :bar, :bat from sometable"
+            , dialect=default.DefaultDialect(paramstyle='named')
+        )
+        self.assert_compile(
+            stmt,
+            "select %s, %s, %s from sometable"
+            , dialect=default.DefaultDialect(paramstyle='format')
+        )
+        self.assert_compile(
+            stmt,
+            "select :1, :2, :3 from sometable"
+            , dialect=default.DefaultDialect(paramstyle='numeric')
+        )
+        self.assert_compile(
+            stmt,
+            "select %(foo)s, %(bar)s, %(bat)s from sometable"
+            , dialect=default.DefaultDialect(paramstyle='pyformat')
+        )