Menu

nextset not working?

2009-05-12
2013-04-29
  • Damien Churchill

    In pymssql 1.0.2 the following doesn't work when using FreeTDS:

    <pre>
    >>> import pymssql
    >>>
    >>> conn = pymssql.connect(host='testdbhost', database='Test')
    >>> cursor = conn.cursor()
    >>> cursor.execute('SELECT 1; SELECT 2')
    >>> cursor.fetchall()
    [(1,)]
    >>> cursor.nextset()
    1
    >>> cursor.fetchall()
    []
    </pre>

    I could be doing this in completely the wrong fashion so feel free to correct me :)

     
    • A

      A - 2009-05-12

      Please try it with _mssql if you can.

       
    • Damien Churchill

      >>> import _mssql
      >>> conn = _mssql.connect('testdbhost', 'sa', 'test', False, None, 'Test')
      >>> conn.execute_query('SELECT 1; SELECT 2')
      >>> for row in conn:
      ...     print row
      ...
      {0: 1}
      >>> conn.nextresult()
      1
      >>> for row in conn:
      ...     print row
      ...
      >>>

      Same result I think.

       
      • A

        A - 2009-05-12

        >>> import _mssql
        >>> conn = _mssql.connect('testdbhost', 'sa', 'test', False, None, 'Test')
        >>> conn.execute_query('SELECT 1; SELECT 2')
        >>> for row in conn: print row
        >>> for row in conn: print row

        This should work; after reading one result set _mssql / pymssql automatically advances to the next (if any).

         
        • Damien Churchill

          Running that code yields the same result as the other 2 methods.

          I've tried specifying different versions of tds in freetds.conf but that doesn't change anything.

          Here is the freetds debug log if that'll be any help?
          http://pastebin.com/f2e1370da

           
          • A

            A - 2009-05-12

            This was a bug in pymssql; it is now fixed in CVS. You can manually checkout mssqldbmodule.c and compile the module if you need the fix now. Sorry for the inconvenience.

             
            • Damien Churchill

              No need to be sorry at all, thanks for all the great work improving pymssql!

               
    • mrtwice

      mrtwice - 2009-05-20

      > This was a bug in pymssql; it is now fixed in CVS.

      Any chance we could get a new release?  I am using Windows and do not have a compiler.

       
      • A

        A - 2009-05-20

        If nothing goes wrong it may happen by the end of the month. Which Python version do you use? I'd recommend 2.6 because there may be problem with binaries for older Pythons starting with next release.

         
        • mrtwice

          mrtwice - 2009-05-20

          I am using 2.5.4.  I don't think everything in my web stack is ready for 2.6 or I would switch.

          Do you have instructions anywhere on how to compile the .c file on Windows?  I did C years ago and could probably work through it with some rough direction.  Do you normally use Ming on Windows?

          Thanks.

           
          • A

            A - 2009-05-20

            Yes there are detailed instructions at http://pymssql.sourceforge.net/compilation.php
            I use Visual Studio, I've never tried Ming.

            I'll consider providing binaries for 2.4 and 2.5 for some more time. But instead of wasting energy on outdated Python, I'd prefer to start working on support for Python 3.x

             
  • Anonymous

    Anonymous - 2010-02-17

    It is 2010 and binaries was not recompiled. Btw, where do i find sources?

     
  • Anonymous

    Anonymous - 2010-02-17

    Sources appeared xD. They were hidden.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.