<[EMAIL PROTECTED]> schrieb am 08.03.02:
> Hi all,
> 
> In the process of learning about SQL and SAPDB, I downloaded and ran
> egSQL.py.  In the two cases when session.sql is called with SELECT INTO, the
> results where not what was expected.  The comments in egSQL.py and the
> documentation for the Python interface, state that a tuple should be
> returned.  What was returned was a character string.  I ran the program with
> [snip]
> The one odd case is the Python snippet that follows:
> 
>       cmmd = 'select first msgno, msgtext from messages where msgno between 200
> and 700'
>       result = session.sql (cmmd)
>       result = session.sqlX (cmmd)
> 
> sql returned a character string while sqlX returned the following error
> message:
> 
>       'sapdb.SQLError: [-5015] (at 29) Missing
> keyword:YEARS,WRITE,WORK,WHILE,WHENEVER,
>       WAIT,VTRACE,VSIZE,VIEW'
> 
> Being a newbie, I am not sure if this is a valid SQL command; however, I
> believe that one or both of the results must be wrong.
> 
> I am sorry that I don't have any real solutions for you.
> 
> Al Perga

The following code snippet worked for me:

# -----
import sapdb

USERNAME = "PLR_USER"
PASSWORD = "*******"
DATABASE = "PLR"
HOSTNAME = "C1129"

session = sapdb.connect(USERNAME, PASSWORD, DATABASE, HOSTNAME)
sql = 'select msgno, msgtext from messages where msgno between 200 and 700'
for a in session.sql(sql):
    print a

for a in session.sqlX(sql):
    print a

# -----

(200, 'Duplicate key')
(250, 'Duplicate secondary key')
(300, 'Integrity violation')
(320, 'View violation')
(350, 'Referential integrity violated')
(360, 'Foreign key integrity violation')
(400, 'Lock collision')
(450, 'Lock collision caused by pending locks')
(500, 'Lock request timeout')
(600, 'Work rolled back')
(650, 'Work rolled back')
(700, 'Session inactivity timeout (work rolled back)')
(200, 'Duplicate key')
(250, 'Duplicate secondary key')
(300, 'Integrity violation')
(320, 'View violation')
(350, 'Referential integrity violated')
(360, 'Foreign key integrity violation')
(400, 'Lock collision')
(450, 'Lock collision caused by pending locks')
(500, 'Lock request timeout')
(600, 'Work rolled back')
(650, 'Work rolled back')
(700, 'Session inactivity timeout (work rolled back)')

Both returned the same results. "select first msgno..." is a 
SELECT ORDERED statement described in the Reference Manual, sorry, 
but I currently do not have the time to look deeper into that 
statement.

R�diger
________________________________________________________________
Keine verlorenen Lotto-Quittungen, keine vergessenen Gewinne mehr! 
Beim WEB.DE Lottoservice: http://tippen2.web.de/?x=13


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

Reply via email to