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

[Python] set autocommit failed using "self.con.set_autocommit('OFF') "

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Python-Aprium
    • Fix Version/s: None
    • Component/s: Python Driver
    • Labels:
    • Environment:

      Windows and Linux

      Description

      [Python] set autocommit failed using "self.con.set_autocommit('OFF') "

      Test Case: http://svn.cubrid.org/cubridapis/python/branches/RB-9.1.0/tests2/python/_12_autocommit/test_auocommit_01.py

      Test Build: 9.1.0.0203
      Test OS: Linux and windows
      python driver: 9.1.0.0001

      Test codes:

      {code}
      def test_03errorRollback(self):
      print "\nset_autocommit is not correct "
      self.con.set_autocommit(False)
      self.assertEqual(self.con.get_autocommit(), False, "autocommit is off")
      self.con.set_autocommit('ON')
      self.assertEqual(self.con.get_autocommit(), True, "autocommit is ON")
      self.con.set_autocommit('OFF')
      self.assertEqual(self.con.get_autocommit(), False, "autocommit is off"){code}

      Test Result:

      ======================================================================
      FAIL: test_03errorRollback (__main__.AutocommitTest)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "python\_12_autocommit\test_auocommit_01.py", line 87, in test_03errorRollback
          self.assertEqual(self.con.get_autocommit(), False, "autocommit is off")
      AssertionError: autocommit is off
      
      ----------------------------------------------------------------------
      

      self.con.set_autocommit('ON') can set autocommit to True.
      But self.con.set_autocommit('OFF') can not set autocommit to False.

        Activity

        Hide
        jinhu 李金虎 added a comment - - edited

        Analysis:
        The set_autocommit() allows the argument to be boolean. So, the below call can work:
        set_autocommit(True)
        set_autocommit(False)

        If the argument is a string, it's corresponding to boolean True.

        The above logic is the same as the set_autocommit() in Mysql Python driver.
        However, there is not the specification about the arguments of set_autocommit() in PEP-249

        My solution:
        Because the boolean data type is availabe in Python, so I think it's more reasonable to supply the boolean type for set_autocommit().
        Raise error if the parameter is not a boolean value.

        Show
        jinhu 李金虎 added a comment - - edited Analysis: The set_autocommit() allows the argument to be boolean. So, the below call can work: set_autocommit(True) set_autocommit(False) If the argument is a string, it's corresponding to boolean True. The above logic is the same as the set_autocommit() in Mysql Python driver. However, there is not the specification about the arguments of set_autocommit() in PEP-249 My solution: Because the boolean data type is availabe in Python, so I think it's more reasonable to supply the boolean type for set_autocommit(). Raise error if the parameter is not a boolean value.
        Hide
        jinhu 李金虎 added a comment -

        Fixed in RB-9.1.0, revision: 1554
        Merge into trunk, revision: 1555
        Merge into RB-8.4.1, revision: 1556
        Merge into RB-8.4.3, revision: 1557
        Merge into RB-8.4.4, revision: 1558

        To QA:
        Please update the test case accordingly.

        Show
        jinhu 李金虎 added a comment - Fixed in RB-9.1.0, revision: 1554 Merge into trunk, revision: 1555 Merge into RB-8.4.1, revision: 1556 Merge into RB-8.4.3, revision: 1557 Merge into RB-8.4.4, revision: 1558 To QA: Please update the test case accordingly.
        Hide
        jinhu 李金虎 added a comment -

        Resolved.

        Show
        jinhu 李金虎 added a comment - Resolved.
        Hide
        cn14130 欧明宝[Bom Owen] added a comment -

        Test Build: 9.1.0.0206
        Test OS: Linux x64
        python driver: 9.1.0.0001 Revision: 1608
        Test Result: pass
        RB-8.4.1, RB-8.4.3, RB-8.4.4 will be validated by daily qa test

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

          People

          • Assignee:
            cn14130 欧明宝[Bom Owen]
            Reporter:
            cn14130 欧明宝[Bom Owen]
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: