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

CUBRID python driver returns NUMERIC object as float

    Details

      Description

      Here is the test code for creating the database and the python code:

      {code}
      CREATE TABLE "tst2"(
      "a" NUMERIC(38,12)
      );
      INSERT INTO tst2 values (5.3);{code} {code}
      import CUBRIDdb
      conn = CUBRIDdb.connect('CUBRID:localhost:30000:demodb', 'dba', '')
      cur = conn.cursor()
      cur.execute("SELECT * from tst2");
      row = cur.fetchone()
      print type(row[0])
      cur.close(){code}

      The type returned for the NUMERIC field is (type 'float') which is incorrect. It should be returned as decimal.Decimal object.

        Activity

        Hide
        lilin54 李林 (Inactive) added a comment -

        There is Decimal module in Python, convert numeric type of CUBRID to decimal type in Python.

        Show
        lilin54 李林 (Inactive) added a comment - There is Decimal module in Python, convert numeric type of CUBRID to decimal type in Python.
        Hide
        cn14130 欧明宝[Bom Owen] added a comment - - edited

        Test build : 9.1.0.0212
        OS: Linux 64bit
        python driver: 9.1.0.001 http://svn.cubrid.org/cubridapis/python/branches/RB-9.1.0 Revision: 1703
        Test Result: pass

        Show
        cn14130 欧明宝[Bom Owen] added a comment - - edited Test build : 9.1.0.0212 OS: Linux 64bit python driver: 9.1.0.001 http://svn.cubrid.org/cubridapis/python/branches/RB-9.1.0 Revision: 1703 Test Result: pass

          People

          • Assignee:
            cn14130 欧明宝[Bom Owen]
            Reporter:
            ovidiu.veliscu Veliscu Ovidiu
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: