1. Vernon Cole
  2. django-mssql-ado-merge

Commits

Vernon Cole  committed 0467ac6 Merge

update features settings

  • Participants
  • Parent commits e48939c, 768f489
  • Branches default

Comments (0)

Files changed (2)

File sqlserver_ado/base.py

View file
     
     ignores_nulls_in_unique_constraints = False
 
-    uses_savepoints = True
-
-    # Does the backend allow very long model names without error?
-    supports_long_model_names = False
 
 def is_ip_address(value):
     """

File tests/test_main/apitest/dbapi20.py

View file
     -- Ian Bicking
 '''
 
-__version__ = '$Revision: 1.13 $'[11:-2]
+__version__ = '$Revision: 1.14.1 $'[11:-2]
 __author__ = 'Stuart Bishop <stuart@stuartbishop.net>'
 
 import unittest
     from exceptions import StandardError as _BaseException
 
 # set this to "True" to follow API 2.0 to the letter
-I_REALLY_WANT_IDEMPOTENT_CLOSE = False
+I_REALLY_WANT_IDEMPOTENT_CLOSE = True
+
+# Revision 1.14  2013/05/20 11:02:05  kf7xm
+# Add a literal string to the format insertion test to catch trivial re-format algorthims
 
 # Revision 1.13  2013/05/08 14:31:50  kf7xm
-# Turn off IDEMPOTENT_CLOSE test by default. Silence teardown failure
+# Quick switch to Turn off IDEMPOTENT_CLOSE test. Also: Silence teardown failure
 
 # Revision 1.12  2009/02/06 03:35:11  kf7xm
 # Tested okay with Python 3.0, includes last minute patches from Mark H.
     table_prefix = 'dbapi20test_' # If you need to specify a prefix for tables
 
     ddl1 = 'create table %sbooze (name varchar(20))' % table_prefix
-    ddl2 = 'create table %sbarflys (name varchar(20))' % table_prefix
+    ddl2 = 'create table %sbarflys (name varchar(20), drink varchar(30))' % table_prefix
     xddl1 = 'drop table %sbooze' % table_prefix
     xddl2 = 'drop table %sbarflys' % table_prefix
 
             try:
                 cur = con.cursor()
                 for ddl in (self.xddl1,self.xddl2):
-                    try: 
+                    try:
                         cur.execute(ddl)
                         con.commit()
-                    except self.driver.Error: 
+                    except self.driver.Error:
                         # Assume table didn't exist. Other tests will check if
                         # execute is busted.
                         pass
         try:
             cur = con.cursor()
             self.executeDDL1(cur)
-            self.assertEqual(cur.rowcount,-1,
-                'cursor.rowcount should be -1 after executing no-result '
+            self.failUnless(cur.rowcount in (-1,0),   # Bug #543885 
+                'cursor.rowcount should be -1 or 0 after executing no-result '
                 'statements'
                 )
             cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
                     'callproc produced invalid results'
                     )
         finally:
-                con.close()
+            con.close()
 
     def test_close(self):
         con = self._connect()
             con.close()
 
     def _paraminsert(self,cur):
-        self.executeDDL1(cur)
-        cur.execute("insert into %sbooze values ('Victoria Bitter')" % (
+        self.executeDDL2(cur)
+        cur.execute("insert into %sbarflys values ('Victoria Bitter', 'thi%%s :may ca%%(u)se? troub:1e')" % (
             self.table_prefix
             ))
         self.failUnless(cur.rowcount in (-1,1))
 
         if self.driver.paramstyle == 'qmark':
             cur.execute(
-                'insert into %sbooze values (?)' % self.table_prefix,
+                "insert into %sbarflys values (?, 'thi%%s :may ca%%(u)se? troub:1e')" % self.table_prefix,
                 ("Cooper's",)
                 )
         elif self.driver.paramstyle == 'numeric':
             cur.execute(
-                'insert into %sbooze values (:1)' % self.table_prefix,
+                "insert into %sbarflys values (:1, 'thi%%s :may ca%%(u)se? troub:1e')" % self.table_prefix,
                 ("Cooper's",)
                 )
         elif self.driver.paramstyle == 'named':
             cur.execute(
-                'insert into %sbooze values (:beer)' % self.table_prefix, 
+                "insert into %sbarflys values (:beer, 'thi%%s :may ca%%(u)se? troub:1e')" % self.table_prefix, 
                 {'beer':"Cooper's"}
                 )
         elif self.driver.paramstyle == 'format':
             cur.execute(
-                'insert into %sbooze values (%%s)' % self.table_prefix,
+                "insert into %sbarflys values (%%s, 'thi%%s :may ca%%(u)se? troub:1e')" % self.table_prefix,
                 ("Cooper's",)
                 )
         elif self.driver.paramstyle == 'pyformat':
             cur.execute(
-                'insert into %sbooze values (%%(beer)s)' % self.table_prefix,
+                "insert into %sbarflys values (%%(beer)s, 'thi%%s :may ca%%(u)se? troub:1e')" % self.table_prefix,
                 {'beer':"Cooper's"}
                 )
         else:
             self.fail('Invalid paramstyle')
         self.failUnless(cur.rowcount in (-1,1))
 
-        cur.execute('select name from %sbooze' % self.table_prefix)
+        cur.execute('select name, drink from %sbarflys' % self.table_prefix)
         res = cur.fetchall()
         self.assertEqual(len(res),2,'cursor.fetchall returned too few rows')
         beers = [res[0][0],res[1][0]]
             'cursor.fetchall retrieved incorrect data, or data inserted '
             'incorrectly'
             )
-
+        trouble = "thi%s :may ca%(u)se? troub:1e"
+        self.assertEqual(res[0][1], trouble,
+            'cursor.fetchall retrieved incorrect data, or data inserted '
+            'incorrectly. Got=%s, Expected=%s' % (repr(res[0][1]), repr(trouble)))      
+        self.assertEqual(res[1][1], trouble,
+            'cursor.fetchall retrieved incorrect data, or data inserted '
+            'incorrectly. Got=%s, Expected=%s' % (repr(res[1][1]), repr(trouble)
+            ))
+        
     def test_executemany(self):
         con = self._connect()
         try: