Why can't use cursor.nextset() in adodbapi package?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nightmarch

    #1

    Why can't use cursor.nextset() in adodbapi package?

    I want use crsr.nextset() , But I got errors like following:

    [color=blue][color=green][color=darkred]
    >>> connStr = "Provider=MSDAO RA.1;Password=j mpower;User[/color][/color][/color]
    ID=jmpower;Data Source=jmgis_ag ps3;Persist Security Info=True"[color=blue][color=green][color=darkred]
    >>> import adodbapi
    >>> conn= adodbapi.connec t( connStr )
    >>> crsr = conn.cursor()
    >>> sql = "select * from wjtmp"
    >>> crsr.execute(sq l)
    >>> rec = crsr.fetchone()
    >>> crsr.nextset()[/color][/color][/color]
    Traceback (most recent call last):
    File "<interacti ve input>", line 1, in ?
    File "C:\Python24\Li b\site-packages\adodba pi\adodbapi.py" , line 711,
    in nextset
    rsTuple=self.rs .NextRecordset( )
    File "<COMObject Execute>", line 2, in NextRecordset
    File "C:\Python24\Li b\site-packages\win32c om\client\dynam ic.py",
    line 251, in _ApplyTypes_
    result = self._oleobj_.I nvokeTypes(*(di spid, LCID, wFlags,
    retType, argTypes) + args)
    com_error: (-2147352567, '\xb7\xa2\xc9\x fa\xd2\xe2\xcd\ xe2\xa1\xa3',
    (0, 'ADODB.Recordse t', 'Current provider does not support returning
    multiple recordsets from a single execution.',
    'C:\\WINNT\\HEL P\\ADO210.CHM', 0, -2146825037), None)




    Why?

    thanks
  • Dennis Lee Bieber

    #2
    Re: Why can't use cursor.nextset( ) in adodbapi package?

    On Mon, 24 Jan 2005 17:18:05 +0800, nightmarch <nightmarch@gma il.com>
    declaimed the following in comp.lang.pytho n:
    [color=blue][color=green][color=darkred]
    > >>> sql = "select * from wjtmp"
    > >>> crsr.execute(sq l)
    > >>> rec = crsr.fetchone()
    > >>> crsr.nextset()[/color][/color][/color]
    [color=blue]
    > com_error: (-2147352567, '\xb7\xa2\xc9\x fa\xd2\xe2\xcd\ xe2\xa1\xa3',
    > (0, 'ADODB.Recordse t', 'Current provider does not support returning
    > multiple recordsets from a single execution.',
    > 'C:\\WINNT\\HEL P\\ADO210.CHM', 0, -2146825037), None)
    >
    >
    >
    >
    > Why?
    >[/color]

    Could it be because you don't have multiple recordsets in crsr?

    You're executing a single select statement, retrieving the
    /first/ record from the result, and then trying to get a totally
    different result set.

    Maybe you want the next record in the record set you already
    have? crsr.fetchnext( )?
    [color=blue]
    > thanks[/color]

    --[color=blue]
    > =============== =============== =============== =============== == <
    > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
    > wulfraed@dm.net | Bestiaria Support Staff <
    > =============== =============== =============== =============== == <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

    Comment

    • nightmarch

      #3
      Re: Why can't use cursor.nextset( ) in adodbapi package?

      Thank you Dennis!

      You mean I should execute many select statement like this " rec =
      crsr.fetchall() " ?
      But the result is the same, still got the error like "... 'Current
      provider does not support returning multiple recordsets from a single
      execution.'..."


      On Mon, 24 Jan 2005 17:00:39 GMT, Dennis Lee Bieber
      <wlfraed@ix.net com.com> wrote:[color=blue]
      > On Mon, 24 Jan 2005 17:18:05 +0800, nightmarch <nightmarch@gma il.com>
      > declaimed the following in comp.lang.pytho n:
      >[color=green][color=darkred]
      > > >>> sql = "select * from wjtmp"
      > > >>> crsr.execute(sq l)
      > > >>> rec = crsr.fetchone()
      > > >>> crsr.nextset()[/color][/color]
      >[color=green]
      > > com_error: (-2147352567, '\xb7\xa2\xc9\x fa\xd2\xe2\xcd\ xe2\xa1\xa3',
      > > (0, 'ADODB.Recordse t', 'Current provider does not support returning
      > > multiple recordsets from a single execution.',
      > > 'C:\\WINNT\\HEL P\\ADO210.CHM', 0, -2146825037), None)
      > >
      > >
      > >
      > >
      > > Why?
      > >[/color]
      >
      > Could it be because you don't have multiple recordsets in crsr?
      >
      > You're executing a single select statement, retrieving the
      > /first/ record from the result, and then trying to get a totally
      > different result set.
      >
      > Maybe you want the next record in the record set you already
      > have? crsr.fetchnext( )?
      >[color=green]
      > > thanks[/color]
      >
      > --[color=green]
      > > =============== =============== =============== =============== == <
      > > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
      > > wulfraed@dm.net | Bestiaria Support Staff <
      > > =============== =============== =============== =============== == <
      > > Home Page: <http://www.dm.net/~wulfraed/> <
      > > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]
      > --
      > http://mail.python.org/mailman/listinfo/python-list
      >[/color]

      Comment

      • Dennis Lee Bieber

        #4
        Re: Why can't use cursor.nextset( ) in adodbapi package?

        On Tue, 25 Jan 2005 11:23:51 +0800, nightmarch <nightmarch@gma il.com>
        declaimed the following in comp.lang.pytho n:
        [color=blue]
        > Thank you Dennis!
        >
        > You mean I should execute many select statement like this " rec =
        > crsr.fetchall() " ?
        > But the result is the same, still got the error like "... 'Current
        > provider does not support returning multiple recordsets from a single
        > execution.'..."[/color]

        Multiple recordsets, as I understand it, implies one execute
        that returns more than one "select" structure (I'm very weak on
        paraphrasing this).

        Your SELECT should be returning multiple /records/ in ONE
        recordset. It is the multiple records you should be processing. What
        follows is an excerpt from a program I have that updates a static web
        page (no CGI/dynamic server available -- I have to update the database
        locally, run a Python script to regenerate the web page, and upload the
        web page).

        I execute a SELECT, the process /all/ the returned records using
        a loop on fetchall(). {TableRow() is a short function that writes the
        HTML for a table data row}

        # open database NOTE: NO ERROR CHECKING
        myDB = MySQLdb.connect (host='localhos t', user='bestiaria ',
        passwd='web-asst', db='bestiaria')
        myC = myDB.cursor()

        # get convention records occurring later than today
        myC.execute(""" select name, URL, banner, width, height, dates,
        site, notes
        from conventions
        where sortdate > curdate()
        order by sortdate""")

        # write each to table
        for aCon in myC.fetchall():
        (name, URL, banner, width, height, dates, site, notes) =
        aCon
        TableRow(fnew, name, URL, banner, width, height, dates,
        site, notes)

        # repeat for convention records occurring BEFORE today
        myC.execute(""" select name, URL, banner, width, height, dates,
        site, notes
        from conventions
        where sortdate <= curdate()
        order by sortdate""")

        # write each to table
        for aCon in myC.fetchall():
        (name, URL, banner, width, height, dates, site, notes) =
        aCon
        TableRow(fnew, name, URL, banner, width, height, dates,
        site, notes)


        Oh, if it means anything, that uses a DB-API compatible module,
        not some M$ specific system...

        --[color=blue]
        > =============== =============== =============== =============== == <
        > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
        > wulfraed@dm.net | Bestiaria Support Staff <
        > =============== =============== =============== =============== == <
        > Home Page: <http://www.dm.net/~wulfraed/> <
        > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

        Comment

        • Tim Roberts

          #5
          Re: Why can't use cursor.nextset( ) in adodbapi package?

          nightmarch <nightmarch@gma il.com> wrote:
          [color=blue]
          >Thank you Dennis!
          >
          >You mean I should execute many select statement like this " rec =
          >crsr.fetchall( ) " ?[/color]

          No, you misunderstand. nextset() is used when you issue several SELECT
          statements in a single request. The first fetchall() gets the results of
          the first SELECT statement. To get the next one, you use nextset().

          Your example only had one SELECT:
          [color=blue][color=green][color=darkred]
          >> > >>> sql = "select * from wjtmp"
          >> > >>> crsr.execute(sq l)
          >> > >>> rec = crsr.fetchone()
          >> > >>> crsr.nextset()[/color][/color][/color]

          If you are only issuing one SELECT, like most applications, then nextset()
          serves no purpose. If you did something like this:

          sql = "select * from wjtmp; select count(*) from wjtmp;"

          That's when you need nextset(). Personally, I've never used it.
          --
          - Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.

          Comment

          Working...