> If I try to use it with sapdb.sql:
> session = sapdb.sql.connect (*params)
> curs = session.prepare ("CALL PC_VERIFIEAPPRO (?,?,?,?)")
> s = curs.execute ([53,'8170-002',1])
> No exception raised but s is NoneType, should be, I think, 
> (2,) because
> no resultset is available with these values.

Could you try the included python program? The output on my machine using Python 2.2 
is:
=== using sapdb.sql
OK: (3,)
ERR: sql.SQLError: [-300] (at 0) stopped

> A try with sapdb.dbapi returns 0 for cursor.execute ("CALL .....").
> Should return a tuple, or None.

Whene using the dbapi, Stored procedures should be called using cursor.callproc (). 
This doesn't help in this case as I found plenty of errors in the implementation when 
using output variables. Fix forthcoming.

Daniel Dittmar

-- 
Daniel Dittmar
SAP Labs Berlin
[EMAIL PROTECTED]

#!/usr/bin/env python
# procout.py

from sapdb import sql, dbapi

username, pwd, dbname, host = <yourname>, <yourpwd>, <yourdbname>, ''

procsource = """CREATE DBPROC procout (
            IN errcode SMALLINT,
            IN idetablissement VARCHAR(8),
            IN idmodeproduction FIXED(2),
            OUT r FIXED(1)
        )
    AS
    BEGIN
        IF errcode <> 0
        THEN
            STOP (errcode, 'stopped');
        SET r = 3;
    END;
"""

def testNative ():
    print '=== using sapdb.sql'
    session = sql.connect (username, pwd, dbname, host)
    session.sql (procsource)
    call = session.prepare ('call procout (?, ?, ?, ?)').execute
    for rc in [0, -300]:
        try:
            result = call ([rc, 'text', 1])
            print 'OK:', result
        except sql.SQLError, err:
            print 'ERR:', err
    session.rollback ()

if __name__ == '__main__':
    testNative ()



-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to