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

[Python] Fetchone get numeric data's type is not correct

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Python Driver
    • Labels:
      None
    • Environment:
      1. CUBRID: 2008 R4.1 (8.4.1.0561) (64bit release build for linux_gnu)
      2. OS: Linux 64bit

      Description

      1. Brief:
        1. Use fetchone method to get numeric data from db, including float,double,numeric and monetary, but the return data type is string.
      2. Test Steps:
        1. insert a double data 1.1 into table
        2. select the data and check it
      3. Result:
        1. Expect result is 1.1
        2. Actual result is '1.1'
      4. Code reference:
         
        import CUBRIDdb
        import unittest
        
        class FetchoneTest(unittest.TestCase):
                def test_numeric(self):
                        print "test_num"
                        self.con = CUBRIDdb.connect("CUBRID:localhost:33000:demodb", "dba","")
                        self.cur = self.con.cursor()
                        sqlCreate = "create table numeric_db(c_int int, c_short short,c_numeric numeric,c_float float,c_double double,c_monetary monetary)"
                        self.cur.execute(sqlCreate)
                        data1 = 1.1
                        sqlInsert = "insert into numeric_db(c_double) values (" +'%s'%data1 +")"
                        self.cur.execute(sqlInsert)
                        sqlSelect = "select * from numeric_db"
                        self.cur.execute(sqlSelect)
                        data2 = self.cur.fetchone()
                        self.assertEquals(data1, data2[4])
        
        if __name__ == '__main__':
                unittest.main()
        

        Activity

        Hide
        hellohuizhang 张慧 added a comment -

        Commit rev: 388

        Show
        hellohuizhang 张慧 added a comment - Commit rev: 388
        Hide
        guorui 郭瑞 added a comment -

        Resolved Type: float,double,numeric
        Unresolved Type:monetary

        Show
        guorui 郭瑞 added a comment - Resolved Type: float,double,numeric Unresolved Type:monetary

          People

          • Assignee:
            guorui 郭瑞
            Reporter:
            guorui 郭瑞
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: