From: Michael D. <mik...@us...> - 2005-01-31 03:25:48
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11156/NHibernate/Engine Modified Files: IBatcher.cs Log Message: implemented IDisposable on IBatcher. Index: IBatcher.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/IBatcher.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IBatcher.cs 24 Jan 2005 03:33:30 -0000 1.6 --- IBatcher.cs 31 Jan 2005 03:25:39 -0000 1.7 *************** *** 6,37 **** { /// <summary> ! /// Manages <see cref="IDbCommand">IDbCommands</see> and <see cref="IDataReader">IDataReaders</see> for a session. /// </summary> /// <remarks> ! /// <para> /// Abstracts ADO.NET batching to maintain the illusion that a single logical batch /// exists for the whole session, even when batching is disabled. /// Provides transparent <c>IDbCommand</c> caching. ! /// </para> ! /// <para> /// This will be useful once ADO.NET gets support for batching. Until that point /// no code exists that will do batching, but this will provide a good point to do /// error checking and making sure the correct number of rows were affected. ! /// </para> /// </remarks> ! //TODO: add IDisposable ! public interface IBatcher { /// <summary> ! /// Get a prepared statement for using in loading / querying. /// </summary> ! /// <param name="sql"></param> /// <param name="scrollable">TODO: not sure how to use this yet</param> /// <remarks> /// If not explicitly released by <c>CloseQueryStatement()</c>, it will be /// released when the session is closed or disconnected. ! /// /// This does NOT add anything to the batch - it only creates the IDbCommand and /// does NOT cause the batch to execute... /// </remarks> IDbCommand PrepareQueryCommand( SqlString sql, bool scrollable ); --- 6,43 ---- { /// <summary> ! /// Manages <see cref="IDbCommand"/>s and <see cref="IDataReader"/>s ! /// for an <see cref="ISession"/>. /// </summary> /// <remarks> ! /// <p> /// Abstracts ADO.NET batching to maintain the illusion that a single logical batch /// exists for the whole session, even when batching is disabled. /// Provides transparent <c>IDbCommand</c> caching. ! /// </p> ! /// <p> /// This will be useful once ADO.NET gets support for batching. Until that point /// no code exists that will do batching, but this will provide a good point to do /// error checking and making sure the correct number of rows were affected. ! /// </p> /// </remarks> ! public interface IBatcher : IDisposable { /// <summary> ! /// Get an <see cref="IDbCommand"/> for using in loading / querying. /// </summary> ! /// <param name="sql">The <see cref="SqlString"/> to convert to an <see cref="IDbCommand"/>.</param> /// <param name="scrollable">TODO: not sure how to use this yet</param> + /// <returns> + /// An <see cref="IDbCommand"/> that is ready to be executed. + /// </returns> /// <remarks> + /// <p> /// If not explicitly released by <c>CloseQueryStatement()</c>, it will be /// released when the session is closed or disconnected. ! /// </p> ! /// <p> /// This does NOT add anything to the batch - it only creates the IDbCommand and /// does NOT cause the batch to execute... + /// </p> /// </remarks> IDbCommand PrepareQueryCommand( SqlString sql, bool scrollable ); *************** *** 39,43 **** /// <summary> /// Closes the <see cref="IDbCommand"/> & the <see cref="IDataReader"/> that was ! /// opened with <c>PrepareQueryCommand</c>. /// </summary> /// <param name="cmd">The <see cref="IDbCommand"/> to close.</param> --- 45,49 ---- /// <summary> /// Closes the <see cref="IDbCommand"/> & the <see cref="IDataReader"/> that was ! /// opened with the method <c>PrepareQueryCommand</c>. /// </summary> /// <param name="cmd">The <see cref="IDbCommand"/> to close.</param> *************** *** 46,72 **** /// <summary> ! /// Get a non-batchable prepared statement to use for inserting / deleting / updating. ! /// Must be explicitly released by <c>CloseStatement()</c> /// </summary> ! /// <param name="sql">The SqlString to convert to an IDbCommand.</param> ! /// <returns></returns> IDbCommand PrepareCommand( SqlString sql ); /// <summary> ! /// Close a IDbCommand opened using <c>PrepareStatement()</c> /// </summary> ! /// <param name="cm">The <see cref="IDbCommand"/> to ensure is closed.</param> /// <param name="reader">The <see cref="IDataReader"/> to ensure is closed.</param> ! void CloseCommand( IDbCommand cm, IDataReader reader ); /// <summary> ! /// Get a batchable prepared statement to use for inserting / deleting / updating /// (might be called many times before a single call to <c>ExecuteBatch()</c> /// </summary> /// <remarks> /// After setting parameters, call <c>AddToBatch()</c> - do not execute the statement ! /// explicitly /// </remarks> ! /// <param name="sql"></param> /// <returns></returns> IDbCommand PrepareBatchCommand( SqlString sql ); --- 52,81 ---- /// <summary> ! /// Get a non-batchable an <see cref="IDbCommand"/> to use for inserting / deleting / updating. ! /// Must be explicitly released by <c>CloseCommand()</c> /// </summary> ! /// <param name="sql">The <see cref="SqlString"/> to convert to an <see cref="IDbCommand"/>.</param> ! /// <returns> ! /// An <see cref="IDbCommand"/> that is ready to have the parameter values set ! /// and then executed. ! /// </returns> IDbCommand PrepareCommand( SqlString sql ); /// <summary> ! /// Close a <see cref="IDbCommand"/> opened using <c>PrepareCommand()</c> /// </summary> ! /// <param name="cmd">The <see cref="IDbCommand"/> to ensure is closed.</param> /// <param name="reader">The <see cref="IDataReader"/> to ensure is closed.</param> ! void CloseCommand( IDbCommand cmd, IDataReader reader ); /// <summary> ! /// Get a batchable <see cref="IDbCommand"/> to use for inserting / deleting / updating /// (might be called many times before a single call to <c>ExecuteBatch()</c> /// </summary> /// <remarks> /// After setting parameters, call <c>AddToBatch()</c> - do not execute the statement ! /// explicitly. /// </remarks> ! /// <param name="sql">The <see cref="SqlString"/> to convert to an <see cref="IDbCommand"/>.</param> /// <returns></returns> IDbCommand PrepareBatchCommand( SqlString sql ); *************** *** 76,80 **** /// for a single <c>PrepareBatchStatement()</c>) /// </summary> ! /// <param name="expectedRowCount"></param> /// <remarks> /// A negative number in expectedRowCount means that you don't know how many rows to --- 85,89 ---- /// for a single <c>PrepareBatchStatement()</c>) /// </summary> ! /// <param name="expectedRowCount">The number of rows that should be affected when the query is run.</param> /// <remarks> /// A negative number in expectedRowCount means that you don't know how many rows to *************** *** 88,95 **** void ExecuteBatch(); - // TODO: how applicable is this??? /// <summary> /// Close any query statements that were left lying around /// </summary> void CloseCommands(); --- 97,107 ---- void ExecuteBatch(); /// <summary> /// Close any query statements that were left lying around /// </summary> + /// <remarks> + /// Use this method instead of <c>Dispose</c> if the <see cref="IBatcher"/> + /// can be used again. + /// </remarks> void CloseCommands(); |