Exemple #1
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);
 }
        internal ColumnMetaData[] ReadColumnInfo(int count)
        {
            ColumnMetaData[] infoArray = new ColumnMetaData[count];

            for (int i = 0; i < count; i++)
            {
                ColumnMetaData info = new ColumnMetaData();

                info.Type      = (CubridDataType)ReadByte();
                info.Scale     = ReadShort();
                info.Precision = ReadInt();
                info.Name      = ReadString(ReadInt(), Encoding.ASCII);
                info.RealName  = ReadString(ReadInt(), Encoding.ASCII);
                info.Table     = ReadString(ReadInt(), Encoding.ASCII);
                info.IsNull    = (ReadByte() == 0);

                Debug.WriteLine(info);

                infoArray[i] = info;
            }

            return(infoArray);
        }
Exemple #3
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);
        }
Exemple #4
0
        internal ColumnMetaData[] ReadColumnInfo(int count)
        {
            ColumnMetaData[] infoArray = new ColumnMetaData[count];

            for (int i = 0; i < count; i++)
            {
                ColumnMetaData info = new ColumnMetaData();

                info.Type = (CubridDataType)ReadByte();
                info.Scale = ReadShort();
                info.Precision = ReadInt();
                info.Name = ReadString(ReadInt(), Encoding.ASCII);
                info.RealName = ReadString(ReadInt(), Encoding.ASCII);
                info.Table = ReadString(ReadInt(), Encoding.ASCII);
                info.IsNull = (ReadByte() == 0);

                Debug.WriteLine(info);

                infoArray[i] = info;
            }

            return infoArray;
        }