Exemplo n.º 1
0
        public override int ExecuteNonQuery()
        {
            Bind();

            if (IsQueryStatement())
            {
                throw new CubridException("Invalid Query Type for ExecuteNonQuery");
            }

            ExecuteInternal();

            if (statementType == CubridStatementype.CallStoredProcedure)
            {
                con.Stream.RequestFetch(handle);
                con.Stream.ReadInt(); // always 1

                int         colCount = GetOutModeParameterCount() + 1;
                ResultTuple tuple    = new ResultTuple(colCount);
                con.Stream.ReadResultTupleSP(tuple, colCount, con);
                //Console.WriteLine(tuple.ToString());

                int k = 1;
                for (int i = 0; i < parameters.Length; i++)
                {
                    if (parameters[i].Direction == ParameterDirection.Output ||
                        parameters[i].Direction == ParameterDirection.InputOutput)
                    {
                        parameters[i].Value = tuple[k];
                        k++;
                    }
                }
            }

            return(resultCount);
        }
Exemplo n.º 2
0
        internal void ReadResultTupleSP(ResultTuple tuple, int colCount, CubridConnection con)
        {
            tuple.Index = ReadInt();
            tuple.Oid   = ReadOid();

            for (int i = 0; i < colCount; i++)
            {
                int    size = ReadInt();
                object val;

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

                    type = (CubridDataType)ReadByte();
                    size--;

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

                tuple[i] = val;
            }
            Debug.WriteLine(tuple);
        }
Exemplo n.º 3
0
 internal CubridDataReader(CubridCommand stmt, int handle, int count, ColumnMetaData[] columnInfos)
 {
     this.stmt           = stmt;
     this.con            = (CubridConnection)stmt.Connection;
     this.handle         = handle;
     resultCount         = count;
     this.columnMetaData = columnInfos;
     current             = 0;
     resultTuple         = new ResultTuple(columnInfos.Length);
 }
Exemplo n.º 4
0
 internal CubridDataReader(CubridCommand stmt, int handle, int count, ColumnMetaData[] columnInfos)
 {
     this.stmt = stmt;
     this.con = (CubridConnection) stmt.Connection;
     this.handle = handle;
     resultCount = count;
     this.columnMetaData = columnInfos;
     current = 0;
     resultTuple = new ResultTuple(columnInfos.Length);
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public override int ExecuteNonQuery()
        {
            Bind();

            if (IsQueryStatement())
            {
                throw new CubridException("Invalid Query Type for ExecuteNonQuery");
            }

            ExecuteInternal();

            if (statementType == CubridStatementype.CallStoredProcedure)
            {
                con.Stream.RequestFetch(handle);
                con.Stream.ReadInt(); // always 1

                int colCount = GetOutModeParameterCount() + 1;
                ResultTuple tuple = new ResultTuple(colCount);
                con.Stream.ReadResultTupleSP(tuple, colCount, con);
                //Console.WriteLine(tuple.ToString());

                int k = 1;
                for (int i = 0; i < parameters.Length; i++)
                {
                    if (parameters[i].Direction == ParameterDirection.Output ||
                        parameters[i].Direction == ParameterDirection.InputOutput)
                    {
                        parameters[i].Value = tuple[k];
                        k++;
                    }
                }
            }

            return resultCount;
        }
Exemplo n.º 7
0
        internal void ReadResultTupleSP(ResultTuple tuple, int colCount, CubridConnection con)
        {
            tuple.Index = ReadInt();
            tuple.Oid = ReadOid();

            for (int i = 0; i < colCount; i++)
            {
                int size = ReadInt();
                object val;

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

                    type = (CubridDataType)ReadByte();
                    size--;

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

                tuple[i] = val;
            }
            Debug.WriteLine(tuple);
        }
Exemplo n.º 8
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);
        }