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

Ruby Driver should be able to return last insert id

    Details

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

      CUBRID 8.4.1.6004

      Description

      Currently, there is no way of obtaining the last insert id using the Ruby Driver.

      The reason why this is a major bug is because it affects one of our affiliates and I quote here:
      "OK. When I finished up my work yesterday, I had most things working
      using CUBRID's jdbc driver on JRuby. I'm going to work on supporting
      the cubrid ruby gem on regular ruby later today. However, if it can't
      return the last inserted ID, a good portion of Sequel's test suite will
      fail."

      The reason why this a bug also and not just a feature request is because the last insert id cannot be obtained neither by executing the query "SELECT LAST_INSERT_ID()" from the ruby driver and then getting the result (which is "nil").

        Activity

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

        test code:

        {code}
        require 'rubygems'
        require 'cubrid'
        db = 'demodb'
        c = Cubrid.connect(db)

        c.query('create table test_cubrid(id NUMERIC AUTO_INCREMENT(10300, 1), name VARCHAR(50))')
        c.query('insert into test_cubrid(name) values (\'Lily\')')
        puts c.last_insert_id(){code}
        Show
        cn15800 谢韦华[Bert] added a comment - test code: {code} require 'rubygems' require 'cubrid' db = 'demodb' c = Cubrid.connect(db) c.query('create table test_cubrid(id NUMERIC AUTO_INCREMENT(10300, 1), name VARCHAR(50))') c.query('insert into test_cubrid(name) values (\'Lily\')') puts c.last_insert_id(){code}
        Hide
        cn15800 谢韦华[Bert] added a comment -

        fixed

        Show
        cn15800 谢韦华[Bert] added a comment - fixed
        Hide
        ryin005 Ray Yin added a comment -

        The last_insert_id is working correctly in CUBRID-Ruby driver 9.2.0.0001, but failed in 8.4.4.0001

        Reopen the issue

        Show
        ryin005 Ray Yin added a comment - The last_insert_id is working correctly in CUBRID-Ruby driver 9.2.0.0001, but failed in 8.4.4.0001 Reopen the issue
        Hide
        ryin005 Ray Yin added a comment - - edited
        • Test OS: Linux 64
        • CUBRID: 8.4.4.0227
        • Ruby: 1.8.7
        • Driver: cubrid-ruby 8.4.4.0002 (20130917)

        Test Result: Pass

        8.4.4

        [ruby@NC-PL-QA-012 qa_test]$ svn ci --username cn14323 -m "[NOISSUE] remove the old files"
        Added       qa_test/ruby/_13_issues/bug_apis_291/case/bug_apis_291.rb
        Committed revision 35350.
        

        Test Case: http://svn.bds.nhncorp.com/xdbms/cubridqa/branches/RB-8.4.4/interface/Ruby/qa_test/ruby/_13_issues/bug_apis_291/case/

        Show
        ryin005 Ray Yin added a comment - - edited Test OS: Linux 64 CUBRID: 8.4.4.0227 Ruby: 1.8.7 Driver: cubrid-ruby 8.4.4.0002 (20130917) Test Result: Pass 8.4.4 [ruby@NC-PL-QA-012 qa_test]$ svn ci --username cn14323 -m "[NOISSUE] remove the old files" Added qa_test/ruby/_13_issues/bug_apis_291/case/bug_apis_291.rb Committed revision 35350. Test Case: http://svn.bds.nhncorp.com/xdbms/cubridqa/branches/RB-8.4.4/interface/Ruby/qa_test/ruby/_13_issues/bug_apis_291/case/

          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: