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); }
private void CheckType(CubridDataType type) { int collectionType = 0; collectionType = ((byte)type) & ((byte)0x60); Debug.WriteLine("collectionTypeOrNot = {0}" + collectionType); switch (collectionType) { case 0x00: this.type = type; collectionElementType = CubridDataType.Null; break; case 0x20: this.type = CubridDataType.Set; collectionElementType = (CubridDataType)(((byte)type) & ((byte)0x1F)); break; case 0x40: this.type = CubridDataType.Multiset; collectionElementType = (CubridDataType)(((byte)type) & ((byte)0x1F)); break; case 0x60: this.type = CubridDataType.Sequence; collectionElementType = (CubridDataType)(((byte)type) & ((byte)0x1F)); break; default: this.type = CubridDataType.Null; collectionElementType = CubridDataType.Null; break; } }
internal void Bind(int index, CubridDataType type, object value, ParameterDirection mode) { Bind(index, type, value); parameters[index].Mode = mode; }
internal void Bind(int index, CubridDataType type, object value) { parameters[index] = new CubridParameter(); parameters[index].Type = type; parameters[index].Value = value; }
public int Add(CubridDataType type) { return(param.Add(new CubridParameter(type))); }
internal object ReadValue(int index, CubridDataType type, int size, CubridConnection con) { switch (type) { case CubridDataType.Char: case CubridDataType.Nchar: case CubridDataType.String: case CubridDataType.Varnchar: return(ReadString(size, Encoding.Default)); case CubridDataType.Short: return(ReadShort()); case CubridDataType.Int: return(ReadInt()); case CubridDataType.Float: return(ReadFloat()); case CubridDataType.Double: case CubridDataType.Monetary: return(ReadDouble()); case CubridDataType.Date: return(ReadDate()); case CubridDataType.Time: return(ReadTime()); case CubridDataType.Timestamp: return(ReadDateTime()); case CubridDataType.Object: return(ReadOid()); case CubridDataType.Bit: case CubridDataType.Varbit: return(ReadBytes(size)); case CubridDataType.Set: case CubridDataType.Multiset: case CubridDataType.Sequence: CubridDataType baseType = (CubridDataType)ReadByte(); int count = ReadInt(); object[] seq = new object[count]; for (int i = 0; i < count; i++) { int elesize = ReadInt(); if (elesize <= 0) { seq[i] = null; } else { seq[i] = ReadValue(i, baseType, elesize, con); } } return(seq); case CubridDataType.ResultSet: int handle = ReadInt(); CubridCommand cmd = new CubridCommand(con, handle); return(cmd.GetDataReaderFromStoredProcedure()); default: return(null); //throw exception ?? } }
internal DbType SqlType2DbType(CubridDataType sqltype) { return(DbType.AnsiString); }
internal DbType SqlType2DbType(CubridDataType sqltype) { return DbType.AnsiString; }
internal object ReadValue(int index, CubridDataType type, int size, CubridConnection con) { switch (type) { case CubridDataType.Char: case CubridDataType.Nchar: case CubridDataType.String: case CubridDataType.Varnchar: return ReadString(size, Encoding.Default); case CubridDataType.Short: return ReadShort(); case CubridDataType.Int: return ReadInt(); case CubridDataType.Float: return ReadFloat(); case CubridDataType.Double: case CubridDataType.Monetary: return ReadDouble(); case CubridDataType.Date: return ReadDate(); case CubridDataType.Time: return ReadTime(); case CubridDataType.Timestamp: return ReadDateTime(); case CubridDataType.Object: return ReadOid(); case CubridDataType.Bit: case CubridDataType.Varbit: return ReadBytes(size); case CubridDataType.Set: case CubridDataType.Multiset: case CubridDataType.Sequence: CubridDataType baseType = (CubridDataType)ReadByte(); int count = ReadInt(); object[] seq = new object[count]; for (int i = 0; i < count; i++) { int elesize = ReadInt(); if(elesize <= 0) { seq[i] = null; } else { seq[i] = ReadValue(i, baseType, elesize, con); } } return seq; case CubridDataType.ResultSet: int handle = ReadInt(); CubridCommand cmd = new CubridCommand(con, handle); return cmd.GetDataReaderFromStoredProcedure(); default: return null; //throw exception ?? } }
public int Add(CubridDataType type) { return param.Add(new CubridParameter(type)); }
public CubridParameter(CubridDataType type) { this.type = type; }