#region Apache Notice /***************************************************************************** * $Header: $ * $Revision: $ * $Date: $ * * iBATIS.NET Data Mapper * Copyright (C) 2004 - Gilles Bayon * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ********************************************************************************/ #endregion #region Imports using System; using System.Collections; using IBatisNet.Common; using IBatisNet.DataMapper.Commands; using IBatisNet.DataMapper.Configuration.Statements; #endregion namespace IBatisNet.DataMapper.MappedStatements { /// /// /// public delegate void ExecuteEventHandler(object sender, ExecuteEventArgs e); /// /// Summary description for IMappedStatement. /// public interface IMappedStatement { #region Event /// /// Event launch on exceute query /// event ExecuteEventHandler Execute; #endregion #region Properties /// /// The IPreparedCommand to use /// IPreparedCommand PreparedCommand { get; } /// /// Name used to identify the MappedStatement amongst the others. /// This the name of the SQL statment by default. /// string Name { get; } /// /// The SQL statment used by this MappedStatement /// IStatement Statement { get; } /// /// The SqlMap used by this MappedStatement /// SqlMapper SqlMap { get; } #endregion #region ExecuteQueryForMap /// /// Executes the SQL and retuns all rows selected in a map that is keyed on the property named /// in the keyProperty parameter. The value at each key will be the value of the property specified /// in the valueProperty parameter. If valueProperty is null, the entire result object will be entered. /// /// The session used to execute the statement /// The object used to set the parameters in the SQL. /// The property of the result object to be used as the key. /// The property of the result object to be used as the value (or null) /// A hashtable of object containing the rows keyed by keyProperty. ///If a transaction is not in progress, or the database throws an exception. IDictionary ExecuteQueryForMap( IDalSession session, object parameterObject, string keyProperty, string valueProperty ); #endregion #region ExecuteUpdate /// /// Execute an update statement. Also used for delete statement. /// Return the number of row effected. /// /// The session used to execute the statement. /// The object used to set the parameters in the SQL. /// The number of row effected. int ExecuteUpdate(IDalSession session, object parameterObject ); #endregion #region ExecuteInsert /// /// Execute an insert statement. Fill the parameter object with /// the ouput parameters if any, also could return the insert generated key /// /// The session /// The parameter object used to fill the statement. /// Can return the insert generated key. object ExecuteInsert(IDalSession session, object parameterObject ); #endregion #region ExecuteQueryForList /// /// Executes the SQL and and fill a strongly typed collection. /// /// The session used to execute the statement. /// The object used to set the parameters in the SQL. /// A strongly typed collection of result objects. void ExecuteQueryForList(IDalSession session, object parameterObject, IList resultObject ); /// /// Executes the SQL and retuns a subset of the rows selected. /// /// The session used to execute the statement. /// The object used to set the parameters in the SQL. /// The number of rows to skip over. /// The maximum number of rows to return. /// A List of result objects. IList ExecuteQueryForList( IDalSession session, object parameterObject, int skipResults, int maxResults ); /// /// Executes the SQL and retuns all rows selected. This is exactly the same as /// calling ExecuteQueryForList(session, parameterObject, NO_SKIPPED_RESULTS, NO_MAXIMUM_RESULTS). /// /// The session used to execute the statement. /// The object used to set the parameters in the SQL. /// A List of result objects. IList ExecuteQueryForList( IDalSession session, object parameterObject ); #endregion #region ExecuteForObject /// /// Executes an SQL statement that returns a single row as an Object. /// /// The session used to execute the statement. /// The object used to set the parameters in the SQL. /// The object object ExecuteQueryForObject( IDalSession session, object parameterObject ); /// /// Executes an SQL statement that returns a single row as an Object of the type of /// the resultObject passed in as a parameter. /// /// The session used to execute the statement. /// The object used to set the parameters in the SQL. /// The result object. /// The object object ExecuteQueryForObject( IDalSession session, object parameterObject, object resultObject ); #endregion #region Delegate /// /// Runs a query with a custom object that gets a chance /// to deal with each row as it is processed. /// /// The session used to execute the statement. /// The object used to set the parameters in the SQL. /// param> /// IList ExecuteQueryForRowDelegate( IDalSession session, object parameterObject, SqlMapper.RowDelegate rowDelegate ); /// /// Runs a query with a custom object that gets a chance /// to deal with each row as it is processed. /// /// The session used to execute the statement /// The object used to set the parameters in the SQL. /// The property of the result object to be used as the key. /// The property of the result object to be used as the value (or null) /// /// A hashtable of object containing the rows keyed by keyProperty. /// If a transaction is not in progress, or the database throws an exception. IDictionary ExecuteQueryForMapWithRowDelegate( IDalSession session, object parameterObject, string keyProperty, string valueProperty, SqlMapper.DictionaryRowDelegate rowDelegate ); #endregion } }