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; } }
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); }
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); }
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); }