void IResultWriter.AfterExecuteReader(int fieldCount)
        {
            _logResultWriter.AfterExecuteReader(fieldCount);

            var fileName = Path.GetTempFileName() + ".xlsx";

            _excelPackage = new ExcelPackage(new FileInfo(fileName));
        }
    private void ExecuteReader(AsyncDataAdapterCommand asyncDataAdapterCommand, IDbCommand command)
    {
        _resultWriter.BeforeExecuteReader(asyncDataAdapterCommand);
        IDataReader dataReader = null;

        try
        {
            dataReader = command.ExecuteReader();
            var fieldCount = dataReader.FieldCount;
            _resultWriter.AfterExecuteReader(fieldCount);
            var tableIndex = 0;

            while (!_thread.IsStopRequested)
            {
                if (fieldCount > 0)
                {
                    var schemaTable = dataReader.GetSchemaTable();
                    if (schemaTable != null)
                    {
                        Log.Trace("schemaTable:\r\n{0}", schemaTable.ToStringTableString());
                        if (asyncDataAdapterCommand.Query != null)
                        {
                            Parser.ParseResult(asyncDataAdapterCommand.Query.Results[tableIndex], out var name, out var fieldName);
                            schemaTable.TableName = name;
                        }
                    }

                    ReadTable(dataReader, schemaTable, tableIndex);
                }

                if (_rowCount >= _maxRecords || !dataReader.NextResult())
                {
                    break;
                }

                tableIndex++;
            }
        }
        finally
        {
            if (dataReader != null)
            {
                dataReader.Close();
                var recordsAffected = dataReader.RecordsAffected;
                _resultWriter.AfterCloseReader(recordsAffected);
            }
        }
    }
Example #3
0
 void IResultWriter.AfterExecuteReader(int fieldCount) => _logResultWriter.AfterExecuteReader(fieldCount);
Example #4
0
 void IResultWriter.AfterExecuteReader(int fieldCount)
 {
     _logResultWriter.AfterExecuteReader(fieldCount);
     DataSet = new DataSet();
 }
Example #5
0
 void IResultWriter.AfterExecuteReader(int fieldCount)
 {
     _logResultWriter.AfterExecuteReader(fieldCount);
     isJsonAuto = fieldCount == 1;
 }