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

[Ruby][Manual] The stmt.affected_rows could be also used with SELECT query

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: Ruby 8.4.4.0002
    • Fix Version/s: Ruby 8.4.4.0002
    • Component/s: Ruby Driver
    • Labels:
    • Environment:
      • OS: Linux 64
      • CUBRID: 8.4.4.0227
      • Ruby: 1.8.7
      • Driver: cubrid-ruby 8.4.4.0002 (20130917)

      Description

      As described in the affected_rows manual http://www.cubrid.org/wiki_apis/entry/cubrid-ruby-api-documentation#affected_rows, we can see

      This method is used to get the number of rows which have been affected by the SQL statements (INSERT, DELETE, UPDATE).

      However, we can also use affected_rows to get the number or rows affected by SELECT DQL
      such as

      {code}
      @con = Cubrid.connect('demodb','localhost','33000','dba','')
      @con.query("DROP TABLE IF EXISTS test_cubrid")
      @con.query("CREATE TABLE test_cubrid (id INT, name STRING)")

      stmt = @con.query("INSERT INTO test_cubrid VALUES (1, 'Lily'),(2, 'Lucy'),(3, 'Sue'),(4, 'Paul')")

      stmt = @con.query("SELECT * FROM test_cubrid")
      puts stmt.affected_rows
      {code}

      Output: 4

      So the manual should be updated

        Activity

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

        fixed.

        Show
        cn15800 谢韦华[Bert] added a comment - fixed.
        Hide
        ryin005 Ray Yin added a comment -
        Show
        ryin005 Ray Yin added a comment - The manual http://www.cubrid.org/wiki_apis/entry/cubrid-ruby-api-documentation#affected_rows has been updated Close the issue

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            ryin005 Ray Yin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: