Azavea.Open.DAO.CSV.CsvDaLayer.ExecuteQuery C# (CSharp) Method

ExecuteQuery() public method

Executes a query and invokes a method with a DataReader of results.
public ExecuteQuery ( ITransaction transaction, ClassMapping mapping, IDaQuery query, DataReaderDelegate invokeMe, Hashtable parameters ) : void
transaction ITransaction Should be null, transactions are not supported.
mapping ClassMapping Class mapping for the table we're querying against. Optional, /// but not all columns may be properly typed if it is null.
query IDaQuery The query to execute, should have come from CreateQuery.
invokeMe DataReaderDelegate The method to invoke with the IDataReader results.
parameters System.Collections.Hashtable A hashtable containing any values that need to be persisted through invoked method. /// The list of objects from the query will be placed here.
return void
        public override void ExecuteQuery(ITransaction transaction, ClassMapping mapping, IDaQuery query, DataReaderDelegate invokeMe, Hashtable parameters)
        {
            switch (_connDesc.Type)
            {
                case CsvConnectionType.Directory:
                case CsvConnectionType.FileName:
                case CsvConnectionType.Reader:
                    // These are OK.
                    break;
                default:
                    throw new LoggingException("Connection does not support querying: " + _connDesc);
            }
            CsvDataReader reader = new CsvDataReader(this, mapping, ((UnqueryableQuery)query).Criteria);
            try
            {
                invokeMe.Invoke(parameters, reader);
            }
            finally
            {
                reader.Close();
            }
        }