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

[OLEDB] rollback of OleDbTransaction is not work

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: OLEDB-9.1.0.p1
    • Fix Version/s: OLEDB-9.1.0.p1
    • Component/s: OLEDB
    • Labels:
      None
    • Environment:
      • OS: Window7 32bit
      • .Net Framework: 3.5
      • Server Version:CUBRID 9.1 (9.1.0.0212) (64bit release build for linux_gnu) (Mar 14 2013 00:16:33)
      • Driver Version:OLEDB driver 9.1 (timestamp:20130422-14175366)

      Description

      • Brief:
        • execute rollback of transaction, but it doesn't work
      • Test Code
        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Text;
        using System.Data;
        using System.Data.OleDb;
        
        namespace CubridOleDbInterface
        {
            class bts_issue
            {
                static void Main(string[] args)
                {
                    bts_issue issue = new bts_issue();
                    issue.testcase1();
                }
        
                public void testcase1()
                {
                    string connStr =
                        @"Provider=CUBRIDProvider.1;Data Source=testdb;Persist Security Info=False;
                    Location=10.34.64.58;User ID=dba;Cache Authentication=False;Encrypt Password=False;
                    Mask Password=False;Persist Encrypted=False;Port=33022;Fetch Size=100";
        
                    string sql1 = "drop table if exists t1";
                    string sql2 = "create table t1(id int)";
                    string sql3 = "insert into t1 values(1)";
                    string sql4 = "insert into t1 values(2)";
                    string sql5 = "select count(*) from t1";
        
                    OleDbConnection conn = new OleDbConnection(connStr);            
                    conn.Open();
                    OleDbCommand cmd = conn.CreateCommand();
                    OleDbTransaction tr = null;
                    cmd.CommandText = sql1;
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = sql2;
                    cmd.ExecuteNonQuery();
        
                    tr = conn.BeginTransaction();
                    
                    cmd.Transaction = tr;
                    cmd.CommandText = sql3;
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = sql4;
                    cmd.ExecuteNonQuery();
        
                    tr.Rollback();
        
                    cmd.CommandText = sql5;
                    OleDbDataReader reader = cmd.ExecuteReader();
                    reader.Read();
        
                    Console.WriteLine(reader.GetInt32(0));
                    reader.Close();
                    cmd.Dispose();
                    conn.Close();
                }
            }
        }
        
      • Expect Result: 0
      • Actual Result: 2

        Activity

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

        we should turn off autocommit.

        cci_set_autocommit(rc, CCI_AUTOCOMMIT_FALSE);

        Show
        cn15800 谢韦华[Bert] added a comment - we should turn off autocommit. cci_set_autocommit(rc, CCI_AUTOCOMMIT_FALSE);
        Hide
        cottonspan Laura Oh added a comment -

        CCI_DEFAULT_AUTOCOMMIT is the parameter for autocommit and its default value is set to "Yes"
        which means be default an operation will be auto-committed. See our manual: http://www.cubrid.org/manual/91/en/api/cci.html#writing-cci-applications

        Show
        cottonspan Laura Oh added a comment - CCI_DEFAULT_AUTOCOMMIT is the parameter for autocommit and its default value is set to "Yes" which means be default an operation will be auto-committed. See our manual: http://www.cubrid.org/manual/91/en/api/cci.html#writing-cci-applications
        Hide
        guorui 郭瑞 added a comment -

        OS:Windows7 32-bit
        .Net Framework: 3.5
        Test version: OLEDB-9.1 (20130502-17480225)
        Test Result: pass

        Show
        guorui 郭瑞 added a comment - OS:Windows7 32-bit .Net Framework: 3.5 Test version: OLEDB-9.1 (20130502-17480225) Test Result: pass

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            guorui 郭瑞
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: