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

When using bind parameters to insert data, if parameter type is SET and the actual data type is STRING, Ado.net driver willl threw an exception.

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: ADONET-9.0.0-b1
    • Fix Version/s: ADONET-9.0.0-b1
    • Component/s: ADO.NET
    • Labels:
      None

      Description

      When using bind parameters to insert data, if parameter type is CCI_U_TYPE_SET/CCI_U_TYPE_MULTISET/CCI_U_TYPE_SEQUENCE and the actual data type is CCI_U_TYPE_CHAR/CCI_U_TYPE_NCHAR/CCI_U_TYPE_STRING/CCI_U_TYPE_VARNCHAR. After data sort, the first data length must be greater than or equal to other data. otherwise, the Ado.net driver willl threw an exception.

      Test Case source:

      {code}
      private static void ExecuteSQL(string sql, CUBRIDConnection conn)
      {
      using (CUBRIDCommand cmd = new CUBRIDCommand(sql, conn))
      { cmd.ExecuteNonQuery(); }
      }

      public void Test_Write_Collection_String()
      {
      using (CUBRIDConnection conn = new CUBRIDConnection())
      {
      conn.ConnectionString = CUBRIDParameterTest.connString;
      conn.Open();

      CUBRIDParameterTest.ExecuteSQL("DROP TABLE IF EXISTS t", conn);

      //Create a new table with a collection
      CUBRIDParameterTest.ExecuteSQL("CREATE TABLE t(s SET(string))", conn);
      //Insert some data in the sequence column
      string[] sArray = new string[7]{"Performance implications", "Types of fragmentation", "File fragmentation", "Free space fragmentation", "File scattering", "File system fragmentation", "Preventing fragmentation"};
      string sql = "INSERT INTO t(s) VALUES( ?);";
      using (CUBRIDCommand cmd = new CUBRIDCommand(sql, conn))
      { CUBRIDParameter param = new CUBRIDParameter(); param.ParameterName = "?p"; param.Value = sArray; param.InnerCUBRIDDataType = CUBRIDDataType.CCI_U_TYPE_STRING; cmd.Parameters.Add(param); cmd.Parameters[0].CUBRIDDataType = CUBRIDDataType.CCI_U_TYPE_SET; cmd.ExecuteNonQuery(); }

      using (CUBRIDCommand cmd = new CUBRIDCommand("select * from t", conn))
      {
      using (CUBRIDDataReader reader = (CUBRIDDataReader)cmd.ExecuteReader())
      { reader.Read(); object objValue = reader.GetValue(0); Array oArray = objValue as Array; Assert.IsTrue(oArray != null); if (oArray != null) Assert.AreEqual(oArray.Length, 7); }
      }

      CUBRIDParameterTest.ExecuteSQL("DROP t", conn);
      }
      }{code}

        Activity

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

        There is no problem in cubrid 9.2.0

        Show
        cn15800 谢韦华[Bert] added a comment - There is no problem in cubrid 9.2.0

          People

          • Assignee:
            cn15800 谢韦华[Bert]
            Reporter:
            kevinyang Kai Yang (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: