コード例 #1
0
        internal void PrepareInternal(string sql, PrepareOption flag)
        {
            con.ReconnectIfNeed();

            CubridStream stream = con.Stream;

            stream.RequestPrepare(sql, flag);

            handle = stream.ResponseCode;
            resultCacheLifetime = stream.ReadInt();
            statementType       = (CubridStatementype)stream.ReadByte();
            bindCount           = stream.ReadInt();
            isUpdateable        = (stream.ReadByte() == 1);
            columnCount         = stream.ReadInt();

            Debug.WriteLine("handle = " + handle);
            Debug.WriteLine("resultCacheLifetime = " + resultCacheLifetime);
            Debug.WriteLine("statementType = " + statementType);
            Debug.WriteLine("bindCount = " + bindCount);
            Debug.WriteLine("isUpdateable = " + isUpdateable);
            Debug.WriteLine("columnCount = " + columnCount);

            columnInfos = stream.ReadColumnInfo(columnCount);

            if (bindCount > 0)
            {
                parameters = new CubridParameter[bindCount];
            }

            if (statementType == CubridStatementype.CallStoredProcedure)
            {
                columnCount = bindCount + 1;
            }
        }
コード例 #2
0
        internal void GetOutResultSet(int handle)
        {
            CubridStream stream = con.Stream;

            this.handle = stream.RequestOutResultSet(handle); //TODO: check to need to free old handle

            statementType = (CubridStatementype)stream.ReadByte();
            resultCount   = stream.ReadInt();
            isUpdateable  = (stream.ReadByte() == 1);
            columnCount   = stream.ReadInt();

            Debug.WriteLine("handle = " + handle);
            Debug.WriteLine("statementType = " + statementType);
            Debug.WriteLine("isUpdateable = " + isUpdateable);
            Debug.WriteLine("columnCount = " + columnCount);

            columnInfos = stream.ReadColumnInfo(columnCount);
        }
コード例 #3
0
        internal bool NextResult()
        {
            CubridStream stream = con.Stream;

            int totalTupleCount = stream.RequestNextResult(handle);

            CubridStatementype commandTypeIs = (CubridStatementype)stream.ReadByte();
            bool isUpdatable  = (stream.ReadByte() == 1) ? true : false;
            int  columnNumber = stream.ReadInt();

            columnInfos = stream.ReadColumnInfo(columnNumber);


            if (commandTypeIs == CubridStatementype.Select)
            {
                cursor = new CubridDataReader(this, handle, totalTupleCount, columnInfos);
            }

            return(true);
        }
コード例 #4
0
ファイル: CubridCommand.cs プロジェクト: dong1/testsize
        internal void PrepareInternal(string sql, PrepareOption flag)
        {
            con.ReconnectIfNeed();

            CubridStream stream = con.Stream;

            stream.RequestPrepare(sql, flag);

            handle = stream.ResponseCode;
            resultCacheLifetime = stream.ReadInt();
            statementType = (CubridStatementype)stream.ReadByte();
            bindCount = stream.ReadInt();
            isUpdateable = (stream.ReadByte() == 1);
            columnCount = stream.ReadInt();

            Debug.WriteLine("handle = " + handle);
            Debug.WriteLine("resultCacheLifetime = " + resultCacheLifetime);
            Debug.WriteLine("statementType = " + statementType);
            Debug.WriteLine("bindCount = " + bindCount);
            Debug.WriteLine("isUpdateable = " + isUpdateable);
            Debug.WriteLine("columnCount = " + columnCount);

            columnInfos = stream.ReadColumnInfo(columnCount);

            if (bindCount > 0)
            {
                parameters = new CubridParameter[bindCount];
            }

            if (statementType == CubridStatementype.CallStoredProcedure)
            {
                columnCount = bindCount + 1;
            }
        }
コード例 #5
0
ファイル: CubridCommand.cs プロジェクト: dong1/testsize
        internal void GetOutResultSet(int handle)
        {
            CubridStream stream = con.Stream;

            this.handle = stream.RequestOutResultSet(handle); //TODO: check to need to free old handle

            statementType = (CubridStatementype)stream.ReadByte();
            resultCount = stream.ReadInt();
            isUpdateable = (stream.ReadByte() == 1);
            columnCount = stream.ReadInt();

            Debug.WriteLine("handle = " + handle);
            Debug.WriteLine("statementType = " + statementType);
            Debug.WriteLine("isUpdateable = " + isUpdateable);
            Debug.WriteLine("columnCount = " + columnCount);

            columnInfos = stream.ReadColumnInfo(columnCount);
        }
コード例 #6
0
        internal void ReadResultTuple(ResultTuple tuple, ColumnMetaData[] columnInfos, CubridStatementype stmtType, CubridConnection con)
        {
            tuple.Index = ReadInt();
            tuple.Oid   = ReadOid();

            for (int j = 0; j < columnInfos.Length; j++)
            {
                int    size = ReadInt();
                object val;

                if (size <= 0)
                {
                    val = null;
                }
                else
                {
                    CubridDataType type = CubridDataType.Null;

                    if (stmtType == CubridStatementype.Call ||
                        stmtType == CubridStatementype.Evaluate ||
                        stmtType == CubridStatementype.CallStoredProcedure ||
                        columnInfos[j].Type == CubridDataType.Null)
                    {
                        type = (CubridDataType)ReadByte();
                        size--;
                    }
                    else
                    {
                        type = columnInfos[j].Type;
                    }

                    val = ReadValue(j, type, size, con);
                }

                tuple[j] = val;
                tuple[columnInfos[j].Name] = val;
            }

            Debug.WriteLine(tuple);
        }
コード例 #7
0
ファイル: CubridStream.cs プロジェクト: dong1/testsize
        internal void ReadResultTuple(ResultTuple tuple, ColumnMetaData[] columnInfos, CubridStatementype stmtType, CubridConnection con)
        {
            tuple.Index = ReadInt();
            tuple.Oid = ReadOid();

            for (int j = 0; j < columnInfos.Length; j++)
            {
                int size = ReadInt();
                object val;

                if (size <= 0)
                {
                    val = null;
                }
                else
                {
                    CubridDataType type = CubridDataType.Null;

                    if (stmtType == CubridStatementype.Call
                        || stmtType == CubridStatementype.Evaluate
                        || stmtType == CubridStatementype.CallStoredProcedure
                        || columnInfos[j].Type == CubridDataType.Null)
                    {
                        type = (CubridDataType)ReadByte();
                        size--;
                    }
                    else
                    {
                        type = columnInfos[j].Type;
                    }

                    val = ReadValue(j, type, size, con);
                }

                tuple[j] = val;
                tuple[columnInfos[j].Name] = val;
            }

            Debug.WriteLine(tuple);
        }