Commits

Anonymous committed 83612b4

Minor style changes.

Comments (0)

Files changed (2)

src/sqlserver_ado/base.py

         sql = operation # So we can see the original and modified SQL in a traceback
 
         # Convert parameter style from "%s" to qmark
-        if parameters is not None and '%s' in sql:
+        if parameters:
             sql = sql % tuple("?" * len(parameters))
 
         # Look for LIMIT/OFFSET in the SQL

src/sqlserver_ado/query.py

 		def __init__(self, *args, **kwargs):
 			super(SqlServerQuery, self).__init__(*args, **kwargs)
 			
-			# If we are actually an insert query, try munging the as_sql call
+			# If we are an insert query, wrap "as_sql"
 			if self.__class__.__name__ == "InsertQuery":
-				self._saved_as_sql = self.as_sql
 				self.as_sql = self._insert_as_sql
 		
 		def _insert_as_sql(self, *args, **kwargs):
 			meta = self.model._meta
-			
 			quoted_table = self.connection.ops.quote_name(meta.db_table)
-			
-			sql, params = self._saved_as_sql(*args,**kwargs)
+			# Get (sql,params) from original InsertQuery.as_sql
+			sql, params = super(SqlServerQuery, self).as_sql(*args,**kwargs)
 			
 			if meta.pk.attname in self.columns:
 				sql = "SET IDENTITY_INSERT %s ON;%s;SET IDENTITY_INSERT %s OFF" % \
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.