public void SetUp() { _mockery = new MockRepository(); _rowMapper = _mockery.StrictMock <IRowCallback>(); _rowMapperDelegate = _mockery.StrictMock <RowCallbackDelegate>(); _dataReader = _mockery.StrictMock <IDataReader>(); }
public void SetUp() { _mockery = new MockRepository(); _adoOperations = _mockery.StrictMock <IAdoOperations>(); _ordinalCache = _mockery.StrictMock <IDataRecordOrdinalCache>(); _rowCallback = _mockery.StrictMock <IRowCallback>(); _rowCallbackDelegate = _mockery.StrictMock <RowCallbackDelegate>(); }
public void AddRowCallback(string name, IRowCallback rowCallback) { if (Compiled) { throw new InvalidDataAccessApiUsageException("Cannot add RowCallbacks once operation is compiled"); } resultProcessors.Add(new NamedResultSetProcessor(name,rowCallback)); }
public void AddRowCallback(string name, IRowCallback rowCallback) { if (Compiled) { throw new InvalidDataAccessApiUsageException("Cannot add RowCallbacks once operation is compiled"); } resultProcessors.Add(new NamedResultSetProcessor(name, rowCallback)); }
private static IResultSetExtractor MakeResultSetExtractor( IRowCallback rowCallback, IDataRecordOrdinalCache ordinalCache, int rowsExpected) { return(new ExtendedRowCallbackResultSetExtractor(rowCallback) { OrdinalCache = ordinalCache, RowsExpected = rowsExpected }); }
/// <summary> /// Query database with given SQL command and have each row processed /// by a given <see cref="IRowCallback"/> with help of optional /// ordinal cache and/or the rows expected value for better performance. /// </summary> /// /// <param name="operations"> /// An <see cref="Spring.Data.Generic.IAdoOperations"/> object to /// perform database operation. /// </param> /// <param name="cmdType"> /// The type of command. /// </param> /// <param name="cmdText"> /// The text of command. /// </param> /// <param name="rowCallback"> /// The row callback that processes each row. /// </param> /// <param name="ordinalCache"> /// The <see cref="IDataRecordOrdinalCache"/> that caches the mapping /// from field name to field index. /// </param> /// <param name="rowsExpected"> /// Number of rows this query is expected to return. This doesn't need /// to be accurate but estimating at the higer end for best performance. /// </param> public static void QueryWithRowCallback( this IAdoOperations operations, CommandType cmdType, string cmdText, IRowCallback rowCallback, IDataRecordOrdinalCache ordinalCache, int rowsExpected) { var extractor = MakeResultSetExtractor(rowCallback, ordinalCache, rowsExpected); operations.QueryWithResultSetExtractor(cmdType, cmdText, extractor); }
/// <summary> /// Query database with given SQL command and have each row processed /// by a given <see cref="IRowCallback"/> with help of optional /// ordinal cache and/or the rows expected value for better performance. /// </summary> /// /// <param name="operations"> /// An <see cref="Spring.Data.Generic.IAdoOperations"/> object to /// perform database operation. /// </param> /// <param name="cmdType"> /// The type of command. /// </param> /// <param name="cmdText"> /// The text of command. /// </param> /// <param name="rowCallback"> /// The row callback that processes each row. /// </param> /// <param name="parameterValue"> /// The value of the parameter. /// </param> /// <param name="ordinalCache"> /// The <see cref="IDataRecordOrdinalCache"/> that caches the mapping /// from field name to field index. /// </param> /// <param name="parameterName"> /// The name of the parameter. /// </param> /// <param name="rowsExpected"> /// Number of rows this query is expected to return. This doesn't need /// to be accurate but estimating at the higer end for best performance. /// </param> /// <param name="dbType"> /// Type type of the parameter. /// </param> /// <param name="size"> /// The size of parameter. /// </param> public static void QueryWithRowCallback( this IAdoOperations operations, CommandType cmdType, string cmdText, IRowCallback rowCallback, string parameterName, Enum dbType, int size, object parameterValue, IDataRecordOrdinalCache ordinalCache, int rowsExpected) { var extractor = MakeResultSetExtractor(rowCallback, ordinalCache, rowsExpected); operations.QueryWithResultSetExtractor( cmdType, cmdText, extractor, parameterName, dbType, size, parameterValue); }
public virtual void QueryWithRowCallback(CommandType cmdType, string cmdText, IRowCallback rowCallback, IDbParameters parameters) { QueryWithResultSetExtractor(cmdType, cmdText, new RowCallbackResultSetExtractor(rowCallback), parameters); }
/// <summary> /// Execute a query given IDbCommand's type and text and provided parameter /// information, reading a /// single result set on a per-row basis with a <see cref="IRowCallback"/>. /// </summary> /// <param name="cmdType">The type of command</param> /// <param name="cmdText">The text of the query.</param> /// <param name="rowCallback">callback that will extract results /// one row at a time. /// </param> /// <param name="parameterName">The name of the parameter to map.</param> /// <param name="dbType">One of the database parameter type enumerations.</param> /// <param name="size">The length of the parameter. 0 if not applicable to parameter type.</param> /// <param name="parameterValue">The parameter value.</param> public virtual void QueryWithRowCallback(CommandType cmdType, string cmdText, IRowCallback rowCallback, string parameterName, Enum dbType, int size, object parameterValue) { QueryWithResultSetExtractor(cmdType, cmdText, new RowCallbackResultSetExtractor(rowCallback), parameterName, dbType, size, parameterValue); }
/// <summary> /// Execute a query given IDbCommand's type and text by /// passing the created IDbCommand to a ICommandSetter implementation /// that knows how to bind values to the IDbCommand, reading a /// single result set on a per-row basis with a <see cref="IRowCallback"/>. /// </summary> /// <param name="cmdType">The type of command</param> /// <param name="cmdText">The text of the query.</param> /// <param name="rowCallback">callback that will extract results /// one row at a time. /// </param> /// <param name="commandSetter">The command setter.</param> public virtual void QueryWithRowCallback(CommandType cmdType, string cmdText, IRowCallback rowCallback, ICommandSetter commandSetter) { QueryWithResultSetExtractor(cmdType, cmdText, new RowCallbackResultSetExtractor(rowCallback), commandSetter); }
public AdoRowCallbackCommandCallback(AdoTemplate adoTemplate, IRowCallback rowCallback, IDictionary returnedParameters) { this.adoTemplate = adoTemplate; this.rowCallback = rowCallback; this.returnedParameters = returnedParameters; }
/// <summary> /// Initializes a new instance of the <see cref="RowCallbackResultSetExtractor"/> class. /// </summary> /// <param name="rowCallback">The row callback.</param> public RowCallbackResultSetExtractor(IRowCallback rowCallback) { AssertUtils.ArgumentNotNull(rowCallback, "rowCallback"); this.rowCallback = rowCallback; }
/// <summary> /// Initializes a new instance of the class with a /// IRowCallback instance /// </summary> /// <param name="name">The name of the associated row callback for use with output /// result set mappers.</param> /// <param name="rowcallback">A row callback instance.</param> public NamedResultSetProcessor(string name, IRowCallback rowcallback) { this.name = name; this.rowCallback = rowcallback; }
public virtual void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback) { QueryWithCommandCreator(cc, rowCallback, null); }
/// <summary> /// Initializes a new instance of the <see cref="NamedResultSetProcessor"/> class with a /// IRowCallback instance /// </summary> /// <param name="name">The name of the associated row callback for use with output /// result set mappers.</param> /// <param name="rowcallback">A row callback instance.</param> public NamedResultSetProcessor(string name, IRowCallback rowcallback) { this.name = name; resultSetProcessor = rowcallback; }
public virtual void QueryWithCommandCreator(IDbCommandCreator cc, IRowCallback rowCallback, IDictionary returnedParameters) { if (rowCallback == null) { throw new ArgumentNullException("RowCallback must not be null"); } Execute(cc, new AdoRowCallbackCommandCallback(this, rowCallback, returnedParameters)); }
public SafeDataReaderRowCallbackResultSetExtractor(IRowCallback rowCallback) { AssertUtils.ArgumentNotNull(rowCallback, "rowCallback"); _rowCallback = rowCallback; }
/// <summary> /// Protected constructor to give subclass the flexibility of how /// callback is set. It also sets the <see cref="_rowCallback"/> to /// itself if subclass also implements <see cref="IRowCallback"/>. /// </summary> protected ExtendedRowCallbackResultSetExtractor() { _rowCallback = this as IRowCallback; }