/// <summary> /// Executes a Query SQL Command against the database and returns the results in a streaming fashion /// </summary> /// <param name="sqlCmd">SQL Command</param> public override System.Data.Common.DbDataReader ExecuteStreamingQuery(string sqlCmd) { //Get Thread ID int thread = Thread.CurrentThread.ManagedThreadId; //Create the SQL Command VirtuosoCommand cmd = new VirtuosoCommand(sqlCmd, this._dbConnections[thread]); if (this._dbTrans[thread] != null) { //Add to the Transaction if required cmd.Transaction = this._dbTrans[thread]; } //Return the Data Reader return cmd.ExecuteReader(); }
private void DoGetDataTest (TestCaseResult result, string text, int column, CommandBehavior behavior, Selector selector, Sequence sequence) { VirtuosoCommand cmd = null; VirtuosoDataReader dr = null; try { cmd = new VirtuosoCommand (text, connection); dr = cmd.ExecuteReader (behavior); CheckGetData (result, dr, column, selector, sequence); } finally { if (dr != null) dr.Close (); if (cmd != null) cmd.Dispose (); } }
// Используется для организации запросов внутри транзакции private IEnumerable<object[]> RunQuery(string sql, VirtuosoCommand runcommand) { runcommand.CommandText = sql; var reader = runcommand.ExecuteReader(); int ncols = reader.FieldCount; object[] data = new object[ncols]; while (reader.Read()) { reader.GetValues(data); yield return data; } reader.Close(); }