Re: Python 2.5

2007-06-29 Thread Christian Ullrich
* Christian Ullrich wrote on Wednesday, 2007-06-20:

 Back in March, someone reported that the python interface didn't work
 correctly with python 2.5, in that raised exceptions were missing all
 information about the actual error (error codes, messages).

I think I may just have fixed it myself. Could someone with more
knowledge about Python's C API please have a look at this patch against
the 7.6.0.37 sources? At first glance, it works fine. The attributes are
back, and it works in Python 1.5, 2.1, 2.4, and 2.5, which are all the
releases I tested.

--- MaxDB_ORG/sys/src/SAPDB/Scripting/Script_sqlPython.c2007-04-19 
11:03:24.0 +0200
+++ MaxDB_DEV/sys/src/SAPDB/Scripting/Script_sqlPython.c2007-06-29 
17:47:03.085021000 +0200
@@ -1595,7 +1595,7 @@
 const char * msg)
 {
 ROUTINE_DBG_MSP00 (raiseCommunicationError);
-PyObject * exception = PyInstance_New (CommunicationErrorType, NULL, NULL);
+PyObject * exception = PyObject_CallObject(CommunicationErrorType, NULL);
 PyObject * pycode = NULL;
 PyObject * pymsg = NULL;
 
@@ -1626,7 +1626,7 @@
 int  tracebackLen)
 {
 ROUTINE_DBG_MSP00 (raiseSQLError);
-PyObject * exception = PyInstance_New (SQLErrorType, NULL, NULL);
+PyObject * exception = PyObject_CallObject(SQLErrorType, NULL);
 PyObject * errorCode = NULL;
 PyObject * message = NULL;
 PyObject * errorPos = NULL;

-- 
Christian Ullrich


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



Python 2.5

2007-06-20 Thread Christian Ullrich
Back in March, someone reported that the python interface didn't work
correctly with python 2.5, in that raised exceptions were missing all
information about the actual error (error codes, messages).

Is there any news about when this might be fixed?

-- 
  Christian Ullrich  .  E-Mails sollten Text sein, Text und nur Text. 
 .  Wenn Gott gewollt hätte, dass E-Mails in HTML
Registrierter.  geschrieben würden, endeten Gebete traditionell
 Linux-User #125183  .  mit amen/.

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



RE: sdb.sql error in python 2.5 interface

2007-03-29 Thread Dittmar, Daniel

try:
cursor = session.sql (select)
except sdb.sql.SQLError, err:
print ERR [%d] %s % (err.errorCode, err.message)
print select
print (= * (err.errorPos - 1)) + '^'
#

I obtain:

print ERR [%d] %s % (err.errorCode, err.message)
AttributeError: 'SQLError' object has no attribute 'errorCode'


It looks as if setting attributes of exception objects is no longer possible 
with the standard C-API. Exceptions are 'new style classes' in Python 2.5 and 
seem to require a different set of APIs. I'm looking into it and will provide 
updated modules as soon as I have a solution.

Daniel Dittmar

-- 
Daniel Dittmar
MaxDB  liveCache
mailto:[EMAIL PROTECTED]

www.sap.com
Sitz der Gesellschaft/Registered Office: Walldorf, Germany
Vorstand/SAP Executive Board: Henning Kagermann (Sprecher/CEO), Shai Agassi, 
Léo Apotheker, Werner Brandt, Claus Heinrich, Gerhard Oswald, Peter Zencke
Vorsitzender des Aufsichtsrats/Chairperson of the SAP Supervisory Board: Hasso 
Plattner 
Registergericht/Commercial Register Mannheim No HRB 350269

Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige 
vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich 
erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung 
oder Weitergabe der E-Mail ausdrücklich untersagt.
Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen 
Dank.

This e-mail may contain trade secrets or privileged, undisclosed, or otherwise 
confidential information. If you have received this e-mail in error, you are 
hereby notified that any review, copying, or distribution of it is strictly 
prohibited. Please inform us immediately and destroy the original transmittal. 
Thank you for your cooperation. 

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



sdb.sql error in python 2.5 interface

2007-03-28 Thread Olivier Fournier

hi,

Windows XP
python: 2.5
maxdb: 7.5

if I try:

import sys

import sdb.sql

#

# Connect to the database instance

# ---

database_user = sys.argv [1]

database_user_password = sys.argv [2]

database_name = sys.argv [3]

session = sdb.sql.connect (database_user, database_user_password, 
database_name)


#

# Execute a SELECT statement with an incorrect column

# name unknown (error in the SQL statement)

#

select = SELECT unknown FROM hotel.customer

try:

   cursor = session.sql (select)

except sdb.sql.SQLError, err:

   print ERR [%d] %s % (err.errorCode, err.message)

   print select

   print (= * (err.errorPos - 1)) + '^'

#

I obtain:

print ERR [%d] %s % (err.errorCode, err.message)
AttributeError: 'SQLError' object has no attribute 'errorCode'


with python 2.4 it's ok:

ERR [-4004] Unknown table name:CUSTOMER
SELECT unknown FROM hotel.customer
^
ERR [-4004] Unknown table name:CUSTOMER


bests regards
Olivier Fournier

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