Hy there, I found a strange Problem, which seems like a Python-Driver Bug.

The Problem seems to occur when Reading LONG fields greater than 60000 bytes

Writing always succeeds, but reading seems to hang when around 32000 bytes 
are already read. (looks like a Buffer-Overflow ....?)

PLATFORMS:
Server: Linux i386 SuSE7.3 Version 7.3.0.21
Client: Python 1.5 / Python 2.1 / Python 2.2 
    Drivers : sapdb-python-linux-i386-7.3.00.21a.tgz
    Platform: (SuSE7.3 and SuSE6.4)

Python   1.5 Does Segmentationfaults during the read-loop
Python > 2.1 Hangs during the read-loop, so I could only stop the testprogram by 
pressing "CRTL-\"


Thank you very much in advance.
Greetings, Andre'



COMPLETE TESTSCRIPT TO REPRODUCE THE ERROR:
================================================================================
import sapdb,cStringIO,sys

SIZE=77000
password=sys.argv[1]
#------------------------------------------------------------------------------
# CREATE A TABLE AND INSTER LONG BYTE DATA
#
connection=sapdb.connect("LOGBUCH2",password,"FOX","sirius")
print "Connected to DB!"
try:   connection.sql("DROP TABLE TEST")
except Exception,err: print err

connection.sql("CREATE TABLE TEST (A INTEGER PRIMARY KEY, B LONG BYTE)")
connection.commit()

data_write="X"*SIZE
f=cStringIO.StringIO(data_write)
connection.sqlX("INSERT INTO TEST (A,B) VALUES (1,?)",[f.read])
connection.commit()
connection.release()
print "Successfully wrote %i bytes!" % len(data_write)


#------------------------------------------------------------------------------
# READ LONG BYTE DATA
#

connection=sapdb.connect("LOGBUCH2",password,"FOX","sirius")
print "Connected to DB!"
rset  =connection.sql("SELECT A,B FROM TEST WHERE A=1")
reader=rset.next()[1]
data_read=""
while 1:
        b=reader.read(100)
        if not b: break
        data_read=data_read+b
        print len(data_read)

print "Successfully read  %i bytes!" % len(data_read)

if data_write==data_read:
        print "SUCCESS: data_read==data_write"
else:
        print "ERROR: data_read!=data_write"
connection.release()

================================================================================

-- 
_____________________________________________
inworks GmbH            Andre Reitz             
Magirusstrasse 44       Tel. 0731/93 80 7-21
89077 Ulm               http://www.inworks.de

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to