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

Transactions are broken when using the Ruby Driver

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Ruby 9.2.0.0001
    • Component/s: Ruby Driver
    • Labels:
      None
    • Environment:

      CUBRID 8.4.1.6004

      Description

      An affiliate user reported the following:

      Transactions are broken. It supposedly sets autocommit to false when initializing, but even when setting it to false manually, it doesn't work. Here's an example:

      {code}
      require 'cubrid'
      c = Cubrid.connect('sequel_test')
      c.auto_commit = false
      c.query('CREATE TABLE a (a integer)')
      c.query('SELECT COUNT FROM a').fetch
      c.query('INSERT INTO a DEFAULT VALUES').fetch c.query('SELECT COUNT FROM a').fetch c.rollback c.query('SELECT COUNT FROM a').fetch{code}

        Activity

        Hide
        cn15800 谢韦华[Bert] added a comment -

        When user call c.auto_commit= false, driver should call cci_set_autocommit (self->handle, CCI_AUTOCOMMIT_FALSE)

        Show
        cn15800 谢韦华[Bert] added a comment - When user call c.auto_commit= false, driver should call cci_set_autocommit (self->handle, CCI_AUTOCOMMIT_FALSE)
        Hide
        cn15800 谢韦华[Bert] added a comment -

        test code:
        require 'rubygems'
        require 'cubrid'
        db = 'demodb'
        c = Cubrid.connect(db)
        #con = Cubrid.connect('shard1','10.34.64.218',36069,'dba','')

        c.auto_commit = false
        #c.query('CREATE TABLE a (a integer)')
        c.query('SELECT COUNT FROM a').fetch
        c.query('INSERT INTO a DEFAULT VALUES').fetch
        stmt = c.query('SELECT COUNT FROM a')
        while row = stmt.fetch
        print row[0]
        puts
        end
        c.rollback

        stmt = c.query('SELECT COUNT FROM a')
        while row = stmt.fetch
        print row[0]
        puts
        end

        Show
        cn15800 谢韦华[Bert] added a comment - test code: require 'rubygems' require 'cubrid' db = 'demodb' c = Cubrid.connect(db) #con = Cubrid.connect('shard1','10.34.64.218',36069,'dba','') c.auto_commit = false #c.query('CREATE TABLE a (a integer)') c.query('SELECT COUNT FROM a').fetch c.query('INSERT INTO a DEFAULT VALUES').fetch stmt = c.query('SELECT COUNT FROM a') while row = stmt.fetch print row [0] puts end c.rollback stmt = c.query('SELECT COUNT FROM a') while row = stmt.fetch print row [0] puts end
        Hide
        ryin005 Ray Yin added a comment -

        The problem has been solved in CUBRID-Ruby 9.2.0.0001, but is still existed in CUBRID-Ruby 8.4.4

        Reopen the issue

        Show
        ryin005 Ray Yin added a comment - The problem has been solved in CUBRID-Ruby 9.2.0.0001, but is still existed in CUBRID-Ruby 8.4.4 Reopen the issue

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            ovidiu.veliscu Veliscu Ovidiu
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: