[python-sybase] python newbie seeks advice on sybase.py

De Clarke de at ucolick.org
Sat, 19 Oct 2002 22:27:41 -0700


dear all:  the Fearless (and Clueless) Python Newbie here trying to
understand the sybase module :-)  Dave Cole very kindly helped me
to identify the source of the segv.  looks like libct is a bit
more temperamental than the libsybdb that I'm used to:  it gets
upset if the locale in LANG envar isn't in locales.dat, in the 
block for your OS.  segv seems like a rather extreme response
to this condition, but that's Sybase's problem :-)

am starting to get my bearings, have figured out where col names/types 
are stashed (c.description) after execution of a query.

but now am puzzled because I got a rowcount of -1 when I expected to
get a rowcount of <number of rows returned>.  here's the braindead code.

    c.execute('select * from numbers order by tablename')
    print c.description
    a = []
    for item in c.description:
        a.append(item[0])
    print "COL NAMES:",a
    print c.rowcount," ROWS"
    for row in c.fetchall():
        print row

python test.py
[('tablename', 0, 0, 30, 0, 0, 0), ('nserial', 8, 0, 4, 0, 0, 0), ('uid', 7, 0, 2, 0, 0, 32), ('stamp', 13, 0, 4, 0, 0, 32)]
COL NAMES: ['tablename', 'nserial', 'uid', 'stamp']
-1  ROWS
('Agents', 200, 1, '25/07/96')
('Alarms', 1, 1, '28/04/97')
...
currentThread(): no current thread for 1024

why do I get -1 rows?  the dbapi doco says this value is -1 when no
command has been executed;  but as you see, a SQL command has been
executed and rows are being returned.  am I missing something?

also as you see I keep getting this "no current thread" message.
it seems harmless (like a bogus condition on image rundown) but
I wish I knew what it meant.

de

-- 
.............................................................................
:De Clarke, Software Engineer                     UCO/Lick Observatory, UCSC:
:Mail: de@ucolick.org |                                                     :
:Web: www.ucolick.org |             Don't Fear the Penguins                 :
:1024D/B9C9E76E           F892 5F17 8E0A F095 05CD  EE8B D169 EDAA B9C9 E76E: