Пример #1
0
 public static ResultMetaData NewGeneratedColumnsMetaData(int[] columnIndexes, string[] columnNames)
 {
     if (columnIndexes != null)
     {
         ResultMetaData data2 = new ResultMetaData(5)
         {
             _columnCount         = columnIndexes.Length,
             _extendedColumnCount = columnIndexes.Length,
             ColIndexes           = new int[columnIndexes.Length]
         };
         for (int i = 0; i < columnIndexes.Length; i++)
         {
             data2.ColIndexes[i] = columnIndexes[i] - 1;
         }
         return(data2);
     }
     if (columnNames != null)
     {
         return(new ResultMetaData(6)
         {
             ColumnLabels = new string[columnNames.Length],
             _columnCount = columnNames.Length,
             _extendedColumnCount = columnNames.Length,
             ColumnLabels = columnNames
         });
     }
     return(null);
 }
Пример #2
0
        public static Result NewDataResult(ResultMetaData md)
        {
            Result result1 = NewResult(3);

            result1.navigator = new RowSetNavigatorClient();
            result1.MetaData  = md;
            return(result1);
        }
Пример #3
0
        public static Result NewSingleColumnResult(ResultMetaData meta)
        {
            Result result1 = NewResult(3);

            result1.MetaData  = meta;
            result1.navigator = new RowSetNavigatorClient();
            return(result1);
        }
Пример #4
0
        public static Result NewBatchedExecuteRequest()
        {
            SqlType[] types   = new SqlType[] { SqlType.SqlVarchar };
            Result    result1 = NewResult(8);

            result1.MetaData = ResultMetaData.NewSimpleResultMetaData(types);
            return(result1);
        }
Пример #5
0
        public ResultMetaData GetNewMetaData(int[] columnMap)
        {
            ResultMetaData data = NewResultMetaData(columnMap.Length);

            ArrayUtil.ProjectRow(this.ColumnLabels, columnMap, data.ColumnLabels);
            ArrayUtil.ProjectRow(this.ColumnTypes, columnMap, data.ColumnTypes);
            ArrayUtil.ProjectRow(this.columns, columnMap, data.columns);
            return(data);
        }
Пример #6
0
        public static Result NewUpdateResultRequest(SqlType[] types, long id)
        {
            Result result1 = NewResult(0x29);

            result1.MetaData  = ResultMetaData.NewUpdateResultMetaData(types);
            result1._id       = id;
            result1.ValueData = new object[0];
            return(result1);
        }
Пример #7
0
        public static Result NewUpdateCountResult(ResultMetaData meta, int count)
        {
            Result result  = NewDataResult(meta);
            Result result1 = NewResult(1);

            result1.UpdateCount = count;
            result1.AddChainedResult(result);
            return(result1);
        }
Пример #8
0
        public static Result NewPreparedExecuteRequest(SqlType[] types, long statementId)
        {
            Result result1 = NewResult(0x23);

            result1.MetaData     = ResultMetaData.NewSimpleResultMetaData(types);
            result1._statementId = statementId;
            result1.ValueData    = new object[0];
            return(result1);
        }
Пример #9
0
        public static Result NewCallResponse(SqlType[] types, long statementId, object[] values)
        {
            Result result1 = NewResult(0x2b);

            result1.MetaData     = ResultMetaData.NewSimpleResultMetaData(types);
            result1._statementId = statementId;
            result1.ValueData    = values;
            return(result1);
        }
Пример #10
0
 public void SetPrepareOrExecuteProperties(string sql, int maxRows, int fetchSize, int statementReturnType, int timeout, int resultSetProperties, int keyMode, int[] generatedIndexes, string[] generatedNames)
 {
     this._mainString          = sql;
     this.UpdateCount          = maxRows;
     this._fetchSize           = fetchSize;
     this._statementReturnType = statementReturnType;
     this.QueryTimeout         = timeout;
     this.RsProperties         = resultSetProperties;
     this._generateKeys        = keyMode;
     this.GeneratedMetaData    = ResultMetaData.NewGeneratedColumnsMetaData(generatedIndexes, generatedNames);
 }
Пример #11
0
        public static Result NewSingleColumnResult(string colName, SqlType type)
        {
            Result result1 = NewResult(3);

            result1.MetaData            = ResultMetaData.NewResultMetaData(1);
            result1.MetaData.columns[0] = new ColumnBase(null, null, null, colName);
            result1.MetaData.columns[0].SetType(type);
            result1.MetaData.PrepareData();
            result1.navigator = new RowSetNavigatorClient(8);
            return(result1);
        }
Пример #12
0
        public static ResultMetaData NewUpdateResultMetaData(SqlType[] types)
        {
            ResultMetaData data = new ResultMetaData(3)
            {
                ColumnTypes          = new SqlType[types.Length],
                _columnCount         = types.Length,
                _extendedColumnCount = types.Length
            };

            Array.Copy(types, data.ColumnTypes, types.Length);
            return(data);
        }
Пример #13
0
        private static ResultMetaData GetSessionAttributesMetaData()
        {
            ResultMetaData data = ResultMetaData.NewResultMetaData(4);

            for (int i = 0; i < 4; i++)
            {
                data.columns[i] = new ColumnBase(null, null, null, null);
            }
            data.columns[0].SetType(SqlType.SqlInteger);
            data.columns[1].SetType(SqlType.SqlInteger);
            data.columns[2].SetType(SqlType.SqlBoolean);
            data.columns[3].SetType(SqlType.SqlVarchar);
            data.PrepareData();
            return(data);
        }
Пример #14
0
        public static Result NewBatchedExecuteResponse(int[] updateCounts, Result generatedResult, Result e)
        {
            Result result = NewResult(0x10);

            result.AddChainedResult(generatedResult);
            result.AddChainedResult(e);
            SqlType[] types = new SqlType[] { SqlType.SqlInteger };
            result.MetaData = ResultMetaData.NewSimpleResultMetaData(types);
            object[][] table = new object[updateCounts.Length][];
            for (int i = 0; i < updateCounts.Length; i++)
            {
                table[i] = new object[] { updateCounts[i] };
            }
            ((RowSetNavigatorClient)result.navigator).SetData(table);
            return(result);
        }
Пример #15
0
 public void SetGeneratedKeys(int[] generatedIndexes, string[] generatedNames)
 {
     this._generateKeys     = 1;
     this.GeneratedMetaData = ResultMetaData.NewGeneratedColumnsMetaData(generatedIndexes, generatedNames);
 }