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