internal T_CCI_ERROR_CODE ReadResultTuple() { resultTuple.Index = currentRow - 1; resultTuple.Oid = null; T_CCI_ERROR err = new T_CCI_ERROR(); int res = CciInterface.cci_cursor(handle, 1, CCICursorPosition.CCI_CURSOR_CURRENT, ref err); if (res == (int)T_CCI_ERROR_CODE.CCI_ER_NO_MORE_DATA) { return(T_CCI_ERROR_CODE.CCI_ER_NO_MORE_DATA); } if (res < 0) { throw new CUBRIDException(err.err_msg); } if ((res = CciInterface.cci_fetch(handle, ref err)) < 0) { throw new CUBRIDException(err.err_msg); } for (int i = 1; i <= columnMetaData.Length; i++) { res = CciInterface.cci_get_data(resultTuple, handle, i, (int)columnMetaData[i - 1].Type, conn); if (columnMetaData[i - 1].Name == null) { columnMetaData[i - 1].Name = i.ToString(); } resultTuple[columnMetaData[i - 1].Name] = resultTuple[i - 1]; } return(T_CCI_ERROR_CODE.CCI_ER_NO_ERROR); }
/// <summary> /// Executes a SQL statement against a connection object. /// </summary> /// <returns> The number of rows affected. </returns> public override int ExecuteNonQuery() { BindParameters(); T_CCI_ERROR err = new T_CCI_ERROR(); int ret = CciInterface.cci_execute(handle, (char)CCIExecutionOption.CCI_EXEC_QUERY_ALL, 0, ref err); if (ret < 0) { throw new CUBRIDException(err.err_msg); } columnInfos = CciInterface.cci_get_result_info(conn, handle); if (this.Parameters.Count > 0) { if (this.GetOutModeParameterCount() == 0 || columnInfos == null) { CciInterface.cci_close_req_handle(handle); handle = 0; return(ret); } if ((CciInterface.cci_cursor(handle, 1, CCICursorPosition.CCI_CURSOR_FIRST, ref err)) < 0) { throw new CUBRIDException(err.err_msg); } if ((CciInterface.cci_fetch(handle, ref err)) < 0) { throw new CUBRIDException(err.err_msg); } for (int i = 1; i <= this.Parameters.Count; i++) { if (this.Parameters[i - 1].Direction == ParameterDirection.InputOutput || this.Parameters[i - 1].Direction == ParameterDirection.Output) { object value = new object(); CciInterface.cci_get_value(conn, i, Parameters[i - 1].CUBRIDDataType, ref value); Parameters[i - 1].Value = value; } } } CciInterface.cci_close_req_handle(handle); handle = 0; return(ret); }