[egenix-users] mxODBC - How do I "set schema"?
M.-A. Lemburg
mal at egenix.com
Tue Feb 1 17:03:00 CET 2005
Bob Gibson wrote:
>
>
>
>
> Marc:
>
> Ah, so it worked? This I have to test. :-)
>
> So I wrote a test script to use this information. The output is below.
> Since rowcount is always -1, it would seem that this information isn't
> available from the interface.
That is possible since not all data sources are able to report the
correct size of the result size. Like in your case, there are also
a few types of data sources that don't even know how to count ;-)
(given that .fetchall() provides this information).
What kind of backend database and ODBC driver are you using ?
> Things are looking up! Thanks (yet again).
>
> --------------------------------------------------------------------------------
> C:\Programs\Python> dotest
> set schema bowling
> cursor.rowcount after query: "select * from teams" = -1
> cursor.rowcount after fetchall(): -1
> Query result:
> (1, 'Marlins', 2)
> (2, 'Sharks', 5)
> (3, 'Terrapins', 12)
> (4, 'Barracudas', 16)
> (5, 'Dolphins', 20)
> (6, 'Orcas', 24)
> (7, 'Manatees', 28)
> (8, 'Swordfish', 32)
>
> set schema school
> cursor.rowcount after query: "select * from faculty" = -1
> cursor.rowcount after fetchall(): -1
> Query result:
> (98005, 'Instructor', 'Full Time', 1)
> (98007, 'Associate Professor', 'Full Time', 1)
> (98010, 'Associate Professor', 'On Leave', 1)
> (98011, 'Instructor', 'Full Time', 1)
> (98012, 'Instructor', 'Full Time', 1)
> (98013, 'Instructor', 'Full Time', 1)
> (98014, 'Professor', 'Full Time', 1)
> (98019, 'Instructor', 'Full Time', 1)
> (98020, 'Instructor', 'Full Time', 1)
> (98025, 'Associate Professor', 'Full Time', 1)
> (98028, 'Professor', 'Full Time', 1)
> (98030, 'Instructor', 'Full Time', 1)
> (98036, 'Professor', 'Full Time', 1)
> (98040, 'Associate Professor', 'Full Time', 1)
> (98042, 'Associate Professor', 'Full Time', 1)
> (98045, 'Professor', 'Full Time', 1)
> (98048, 'Professor', 'Full Time', 1)
> (98052, 'Instructor', 'Part Time', 0)
> (98053, 'Instructor', 'Full Time', 1)
> (98055, 'Professor', 'Full Time', 1)
> (98059, 'Instructor', 'Full Time', 1)
> (98062, 'Associate Professor', 'Full Time', 0)
> (98063, 'Instructor', 'Full Time', 1)
> (98064, 'Professor', 'Full Time', 1)
>
> --------------------------------------------------------------------------------
>
>
> Bob
>
>
> Ps 37:16 It is better to be godly and have little than to be evil and
> possess much.
>
>
>
>
> "M.-A. Lemburg"
> <mal at egenix.com>
> To
> 02/01/2005 02:55 Bob Gibson/Raleigh/IBM at IBMUS
> AM cc
> egenix-users at lists.egenix.com
> Subject
> Re: [egenix-users] mxODBC - How do
> I "set schema"?
>
>
>
>
>
>
>
>
>
>
> Bob Gibson wrote:
>
>>
>>
>>Hi:
>>
>> I'm working with mxODBC, and have successfully connected to my
>
> database.
>
>>This is the good news. :-)
>>
>> When I try to "set schema" though, I get a -1 return value. What,
>>exactly, does this mean? What am I doing wrong?
>
>
> Nothing. The -1 return value is from the old days when .execute()
> used to return the number of affected rows (or -1 in case the
> statement did not affect any).
>
> With DB-API 2.0 you should always use .rowcount instead.
>
> <<< Text removed for brevity >>>
>
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source (#1, Feb 01 2005)
> >>> Python/Zope Consulting and Support ... http://www.egenix.com/
> >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
> ________________________________________________________________________
>
> ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
>
--
Marc-Andre Lemburg
eGenix.com
Professional Python Services directly from the Source (#1, Jan 28 2005)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the egenix-users
mailing list