Mike Bayer avatar Mike Bayer committed 415b47b

- attempted to add a test for #622 / #751, but cant reproduce the failing condition
- fixed major oracle bug introduced by r3561, since colnames come back as unicode now,
need to encode keys in setinputsizes() step

Comments (0)

Files changed (3)

lib/sqlalchemy/databases/mssql.py

 class MSSQLDialect_pymssql(MSSQLDialect):
     supports_sane_rowcount = False
     max_identifier_length = 30
-
+    
     def import_dbapi(cls):
         import pymssql as module
         # pymmsql doesn't have a Binary method.  we use string

lib/sqlalchemy/engine/default.py

                     typeengine = params.get_type(key)
                     dbtype = typeengine.dialect_impl(self.dialect).get_dbapi_type(self.dialect.dbapi)
                     if dbtype is not None:
-                        inputsizes[key] = dbtype
+                        inputsizes[key.encode(self.dialect.encoding)] = dbtype
             self.cursor.setinputsizes(**inputsizes)
 
     def _process_defaults(self):

test/dialect/oracle.py

         b = bindparam("foo", u"hello world!")
         assert b.type.dialect_impl(dialect).get_dbapi_type(dbapi) == 'STRING'
         
+    def test_longstring(self):
+        metadata = MetaData(testbase.db)
+        testbase.db.execute("""
+        CREATE TABLE Z_TEST
+        (
+          ID        NUMERIC(22) PRIMARY KEY,
+          ADD_USER  VARCHAR2(20)  NOT NULL
+        )        
+        """)
+        try:
+            t = Table("z_test", metadata, autoload=True)
+            t.insert().execute(id=1.0, add_user='foobar')
+            assert t.select().execute().fetchall() == [(1, 'foobar')]
+        finally:
+            testbase.db.execute("DROP TABLE Z_TEST")
+        
 class SequenceTest(SQLCompileTest):
     def test_basic(self):
         seq = Sequence("my_seq_no_schema")
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.