RE: Python interface

"Dittmar, Daniel" <[email protected]> Fri, 4 Apr 2003 14:04:15 +0200
Newsgroups gmane.comp.db.sapdb.sources
Message-ID <B9A2DDA03044D311BBD40008C75D6968147D860B@dewdfx24>
Back to front:

> The problem with serial numbers is that they may be too small (at 32
> bits) for the eventual application size.

Declare a column as FIXED (38) DEFAULT SERIAL, the type SERIAL is short for FIXED (10) DEFAULT SERIAL. But the Python interfaces expects only numbers in int range, so there is a problem.

> The reason is simple: I want to use DEFAULT STAMP rather than DEFAULT
> SERIAL and be able to get back the stamp value of an inserted row. For
> serial numbers, we can now get serial number of a row after INSERT,
> but there's no equivalent for stamps.

This would require changes to the kernel as well as the value has to put into the communication packet.

> OK, I'm stumped. Where is the source to the Python interface? I can
> find various Python bits, but they keep referring to other modules
> that I just can't find. For example, where can I find the code for
> SapDB_Result? Even a grep of the source tree failed.

The Python interface is implemented in C
- 7.3, 7.4.03: sys/src/vin77.c
- 7.4 develop (CVS): sys/src/SAPDB/Scripting/Script_sqlPython.c

You'd be interested in the routine setSerialEntries, which calls mem2int. See routine getOutputParameter2 (after case dfixed:) for some code that tries to convert to an int and reverts to a string in case of an overflow.

Daniel Dittmar

-- 
Daniel Dittmar
SAP DB, SAP Labs Berlin
[email protected]
http://www.sapdb.org/