Esempio n. 1
0
        public ResultSet Query(string call, params object[] parameters)
        {
            IDataReader reader = null;

            try {
                reader = TryCreateReader(call, parameters, CommandType.Text);
                return(DataReaderToResultSetMapper.Map(reader));
            } catch (Exception ex) {
                throw Provider.CreateSpecificException(ex, call);
            } finally {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
Esempio n. 2
0
        public ResultSet CallStoredProcedure(string call, params object[] parameters)
        {
            IDataReader reader = null;

            try {
                reader = TryCreateReader(call, parameters, CommandType.StoredProcedure);
                ResultSet res = DataReaderToResultSetMapper.Map(reader);
                return(res);
            } catch (Exception ex) {
                throw Provider.CreateSpecificException(ex, call);
            } finally {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
        protected ResultSet ExecuteCatchingErrors(Func <IDataReader> getReader, string call)
        {
            IDataReader reader = null;

            try {
                BeforeActionVerifyIfExistisACommandToBeExecuted();
                reader = getReader();
                return(DataReaderToResultSetMapper.Map(reader));
            }
            catch (Exception ex) {
                OnErrorVerifyIfExistisACommandToBeExecuted();
                throw Provider.CreateSpecificException(ex, call);
            }
            finally {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }