On Mon, Jun 8, 2009 at 2:46 PM, ddorothy<didoro...@gmail.com> wrote: > > I have looked into this and considered what you have said. I think I > have come up with a potential solution. It seems to be that the most > common driver for mssql on non-windows platforms is going to be > freeTDS. Since there appears to be no way of knowing what ODBC is > using under the hood we should be able to safely assume that they are > using freeTDS if not on windows. Further, there should be nominal > overhead in setting "nocount on." So perhaps the following diff will > offer what is needed to address this specific issue. > > --- sqlalchemy/databases/mssql.py 2009-06-01 13:00:36.000000000 -0400 > +++ sqlalchemy/databases/mssql.py 2009-06-08 15:31:22.000000000 -0400 > @@ -239,7 +239,7 @@ > does **not** work around > > """ > -import datetime, decimal, inspect, operator, re, sys, urllib > +import datetime, decimal, inspect, operator, re, sys, urllib, os > > from sqlalchemy import sql, schema, exc, util > from sqlalchemy import Table, MetaData, Column, ForeignKey, String, > Integer > @@ -982,6 +982,8 @@ > super(MSSQLExecutionContext_pyodbc, self).pre_exec() > if self.compiled.isinsert and self.HASIDENT and not > self.IINSERT \ > and len(self.parameters) == 1 and > self.dialect.use_scope_identity: > + if os.name != 'nt': > + self.cursor.execute("SET NOCOUNT ON") > self.statement += "; select scope_identity()" > > def post_exec(self): > @@ -996,6 +998,8 @@ > except pyodbc.Error, e: > self.cursor.nextset() > self._last_inserted_ids = [int(row[0])] > + if os.name != 'nt': > + self.cursor.execute("SET NOCOUNT OFF") > else: > super(MSSQLExecutionContext_pyodbc, self).post_exec() > > >
Is it possible to set this nocount off somewhere on the "dsn" setup configuration file? Or this can only be set at run time? Thanks, Lucas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---