bool suitableType(ErrorCodeInfo errorCodeInfo, List <IEntity> args)
        {
            if (args.Count != colTypes_.Count)
            {
                errorCodeInfo.set(ErrorCodeInfo.Code.EC_InvalidObject, string.Format("Column counts don't match {0}.", colTypes_.Count));
                return(false);
            }
            int cols = args.Count();

            for (int i = 0; i < cols; ++i)
            {
                DATA_TYPE argsType;
                if (args[i] is IVector)
                {
                    argsType = ((IVector)args[i]).getDataType();
                }
                else
                {
                    argsType = args[i].getDataType();
                }
                DATA_TYPE colType = args[i] is IVector ? colTypes_[i] - 64 : colTypes_[i];
                if ((int)argsType != (int)colType)
                {
                    if (!((argsType == DATA_TYPE.DT_STRING && (int)colType == (int)DATA_TYPE.DT_SYMBOL) || (argsType == DATA_TYPE.DT_STRING && (int)colType == (int)DATA_TYPE.DT_BLOB)))
                    {
                        errorCodeInfo.set(ErrorCodeInfo.Code.EC_InvalidObject, "Failed to insert data, the type of argument does not match the type of column at column: " + i.ToString());
                        return(false);
                    }
                }
            }
            return(true);
        }
        public ErrorCodeInfo insertUnwrittenData(List <List <IEntity> > data)
        {
            if (hasError_)
            {
                throw new Exception("Thread is exiting. ");
            }
            BasicEntityFactory basicEntityFactory = (BasicEntityFactory)BasicEntityFactory.instance();
            ErrorCodeInfo      errorCodeInfo      = new ErrorCodeInfo();
            IVector            partitionCol       = basicEntityFactory.createVectorWithDefaultValue(colTypes_[partitionColumnIdx_], data.Count);
            int rows = data.Count;

            for (int i = 0; i < rows; ++i)
            {
                partitionCol.set(i, (IScalar)data[i][partitionColumnIdx_]);
            }

            if (threads_.Count() > 1)
            {
                List <int>         threadindexs = new List <int>();
                BasicEntityFactory factory      = (BasicEntityFactory)BasicEntityFactory.instance();
                if (isPartionedTable_)
                {
                    threadindexs = partitionDomain_.getPartitionKeys(partitionCol);
                }
                else
                {
                    for (int i = 0; i < rows; ++i)
                    {
                        threadindexs.Add(partitionCol.get(i).GetHashCode());
                    }
                }
                for (int i = 0; i < rows; ++i)
                {
                    insertThreadWrite(threadindexs[i], data[i]);
                }
            }
            else
            {
                for (int i = 0; i < rows; ++i)
                {
                    insertThreadWrite(0, data[i]);
                }
            }
            return(new ErrorCodeInfo());
        }
        ErrorCodeInfo insertRecursive(List <IEntity> args)
        {
            ErrorCodeInfo errorCodeInfo = new ErrorCodeInfo();

            if (!suitableType(errorCodeInfo, args))
            {
                return(errorCodeInfo);
            }
            int threadindex;

            if (threads_.Count() > 1)
            {
                BasicEntityFactory factory = (BasicEntityFactory)BasicEntityFactory.instance();
                if (isPartionedTable_)
                {
                    {
                        try
                        {
                            threadindex = partitionDomain_.getPartitionKey((IScalar)args[partitionColumnIdx_]);
                        }
                        catch (Exception e)
                        {
                            return(new ErrorCodeInfo(ErrorCodeInfo.Code.EC_InvalidObject, e.Message));
                        }
                    }
                }
                else
                {
                    threadindex = args[threadByColIndexForNonPartion_].GetHashCode();
                }
            }
            else
            {
                threadindex = 0;
            }
            insertThreadWrite(threadindex, args);
            return(errorCodeInfo);
        }
 public void set(ErrorCodeInfo errorCodeInfo)
 {
     set(errorCodeInfo.errorCode, errorCodeInfo.errorInfo);
 }
 public ErrorCodeInfo(ErrorCodeInfo src)
 {
     set(src.errorCode, src.errorInfo);
 }