Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-368

CUBRID python driver throws _cubrid.Error errors instead of specific CUBRIDdb errors

    Details

      Description

      I tried to execute commands and catch cubrid exceptions specific.

      The error thrown each time is the type
      _cubrid.Error

      http://packages.python.org/CUBRID-Python/
      Here DatabaseError, InterfaceError, DateError and so forth are listed, but only the main Error class is thrown each time. In the documentation it states that "Exception that is the base class of all other error exceptions". This means that specific errors should be thrown each time and not general errors.

      If this feature actually works, please give examples as they are nowhere in the documentation or in the manual on cubrid.org.

        Activity

        Hide
        kadishmal Esen Sagynov added a comment -

        Veliscu Ovidiu, now on please assign Python issues directly to beagem@nhn.com.

        Show
        kadishmal Esen Sagynov added a comment - Veliscu Ovidiu , now on please assign Python issues directly to beagem@nhn.com.
        Hide
        jinhu 李金虎 added a comment -

        Add the DatabaseError and InterfaceError exception.
        If the error comes from Cubrid, then throw DatabaseError exception;
        If the error comes from the CCI, CAS or the driver, then throw InterfaceError exception.
        Because the Cubrid error codes are not confirm to the exception inheritance layout, so we don't supply the subclass exceptions.

        Modification:
        Sending CUBRIDdb/_init_.py
        Sending python_cubrid.c
        Sending setup.py
        Sending test_CUBRIDdb.py
        Revision: 955 Fixed in 8.4.1

        Show
        jinhu 李金虎 added a comment - Add the DatabaseError and InterfaceError exception. If the error comes from Cubrid, then throw DatabaseError exception; If the error comes from the CCI, CAS or the driver, then throw InterfaceError exception. Because the Cubrid error codes are not confirm to the exception inheritance layout , so we don't supply the subclass exceptions. Modification: Sending CUBRIDdb/_ init _.py Sending python_cubrid.c Sending setup.py Sending test_CUBRIDdb.py Revision: 955 Fixed in 8.4.1
        Hide
        jinhu 李金虎 added a comment -

        Merge into 8.4.3
        Merge into 9.0.0
        Merge into trunk.

        Done.

        Show
        jinhu 李金虎 added a comment - Merge into 8.4.3 Merge into 9.0.0 Merge into trunk. Done.
        Hide
        jinhu 李金虎 added a comment -

        When testing with the below test cases, there is an inconforimity between the errorcode and the msg.e.args[1].
        84 try:
        85 cur = con.cursor()
        86 cur.execute("insert into %sbooze values error_sql ('Hello') " % (self.table_prefix))
        87 except CUBRIDdb.DatabaseError, e:
        88 error = 1
        89 finally:
        90 con.close()
        91 print >>sys.stderr, "Error %d: %s" % (e.args[0], e.args[1])

        Error -1: ERROR: DBMS, -493, Syntax: syntax error, unexpected IdName, expecting DEFAULT or '('

        Fixed in 8.4.1. Revsion: 964
        The right prompt is as below:
        Error -493: ERROR: DBMS, -493, Syntax: syntax error, unexpected IdName, expecting DEFAULT or '('

        Merge into 8.4.3.
        Merge into 9.0.0.
        Merge into trunk.

        Done.

        Show
        jinhu 李金虎 added a comment - When testing with the below test cases, there is an inconforimity between the errorcode and the msg.e.args [1] . 84 try: 85 cur = con.cursor() 86 cur.execute("insert into %sbooze values error_sql ('Hello') " % (self.table_prefix)) 87 except CUBRIDdb.DatabaseError, e: 88 error = 1 89 finally: 90 con.close() 91 print >>sys.stderr, "Error %d: %s" % (e.args [0] , e.args [1] ) Error -1: ERROR: DBMS, -493, Syntax: syntax error, unexpected IdName, expecting DEFAULT or '(' Fixed in 8.4.1. Revsion: 964 The right prompt is as below: Error -493: ERROR: DBMS, -493, Syntax: syntax error, unexpected IdName, expecting DEFAULT or '(' Merge into 8.4.3. Merge into 9.0.0. Merge into trunk. Done.
        Hide
        jinhu 李金虎 added a comment -

        Resolved

        Show
        jinhu 李金虎 added a comment - Resolved
        Show
        cn14130 欧明宝[Bom Owen] added a comment - add test scenario for this issue: 1. RB-9.1.0 http://svn.cubrid.org/cubridapis/python/branches/RB-9.1.0/tests2/python/_13_exceptions/test_exceptions.py 2. RB-8.4.1 http://svn.cubrid.org/cubridapis/python/branches/RB-8.4.1/tests2/python/_13_exceptions/test_exceptions.py 3. RB-8.4.3 http://svn.cubrid.org/cubridapis/python/branches/RB-8.4.3/tests2/python/_13_exceptions/test_exceptions.py
        Hide
        cn14130 欧明宝[Bom Owen] added a comment -

        Test Build: 9.1.0.0203
        Test OS: Windows and Linux
        python driver: 9.1.0.0001
        Test Result: pass
        RB-8.4.1, RB-8.4.3 will be validated by daily qa test

        Show
        cn14130 欧明宝[Bom Owen] added a comment - Test Build: 9.1.0.0203 Test OS: Windows and Linux python driver: 9.1.0.0001 Test Result: pass RB-8.4.1, RB-8.4.3 will be validated by daily qa test

          People

          • Assignee:
            jinhu 李金虎
            Reporter:
            ovidiu.veliscu Veliscu Ovidiu
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: