[DB-SIG] Something funny
Jckabs Andru?aitis
j.andrusaitis@konts.lv
Mon, 17 Jul 2000 00:49:14 -0700
I am using OLD Oracle module (it header says Copyright 1996 by Digital
Creations).
I assume it might be outdated version of DCOracle or something :-)
Well, it works for me right, and I have patched it to meet my needs (ability
to create Python Oracle connection object from connection established by
Embedded
SQL in C file - I use Python as embedded scripting language and in order to
speed
things up I connect to Oracle only once - at program boot).
Anyhow, all this was just some background information.
My problem is following. In that Oracle module there is a method (for cursor
object) - execute() - yeah, you guessed - it is function which parses and
executes
SQL statements ;). If statement is update/delete, it does return number of
rows
affected. It is done by:
PyInt_FromLong(cur->cda[0].rpc);
Where cur->cda[0].rpc is that needed number of rows (defined as 'unsigned
int' in
structure definition).
From Python I am executing statement like:
a= dbc.execute("update xxx set yyy='Mooo' where zzz=:1",('Meee',))
if a!=0: dbc.execute("insert into xxx values('Mooo',:1)",('Meee',))
The problem is that second statement NEVER executes in my example as
dbc.execute()
returns None, not the number!
In addition must say, that in stand-alone Python interpreter (without
embedding
this code into my C application it seems to work all right).
Also, I added some debug information to this Oracle module, and before
'return res;'
statement in execute() method return value IS number (checked it by printing
it out
using Python functions)!!!
I am a bit confused, as I cannot think of what could possibly be wrong.
Mayhaps
the problem is improperly linked binary file (I link Oracle module
statically into
python/libpython, and then link it statically to my executable).
Anyhow - any ideas are welcome.
Jekabs