本文整理汇总了C#中IDbParameters类的典型用法代码示例。如果您正苦于以下问题:C# IDbParameters类的具体用法?C# IDbParameters怎么用?C# IDbParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDbParameters类属于命名空间,在下文中一共展示了IDbParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IDbCommandCreatorFactory
/// <summary>
/// Initializes a new instance of the <see cref="IDbCommandCreatorFactory"/> class.
/// </summary>
public IDbCommandCreatorFactory(IDbProvider dbProvider, CommandType commandType, string sql, IDbParameters declaredParameters)
{
this.dbProvider = dbProvider;
this.sql = sql;
this.commandType = commandType;
this.declaredParameters = declaredParameters;
}
示例2: CopyParameters
/// <summary>
/// Copies the parameters from IDbParameters to the parameter collection in IDbCommand
/// </summary>
/// <param name="command">The command.</param>
/// <param name="springParamCollection">The spring param collection.</param>
public static void CopyParameters(IDbCommand command, IDbParameters springParamCollection)
{
if (springParamCollection != null)
{
IDataParameterCollection collection = springParamCollection.DataParameterCollection;
foreach (IDbDataParameter parameter in collection)
{
IDbDataParameter pClone = (IDbDataParameter)((ICloneable)parameter).Clone();
command.Parameters.Add(pClone);
}
}
}
示例3: ExecuteQueryAll
public DataTable ExecuteQueryAll(string tableName, IDbParameters parameters,string paramMark)
{
string query = "SELECT * FROM " + tableName;
if(parameters.Count > 0)
{
query += " WHERE ";
}
int countParams = 0;
foreach (IDataParameter dbParameter in parameters.DataParameterCollection)
{
countParams++;
if (countParams > 1) query += " AND ";
string columnName = dbParameter.ParameterName;
if(columnName.StartsWith("@")) columnName = columnName.Substring(1);
query += " " + columnName + "=" + paramMark + dbParameter.ParameterName;
}
return AdoTemplate.DataTableCreateWithParams(CommandType.Text, query, parameters);
}
示例4: DataAdapterFillCallback
public DataAdapterFillCallback(DataTable dataTable,
CommandType commandType,
string sql,
ITableMappingCollection mappingCollection,
IDataAdapterSetter dataAdapterSetter,
IDataSetFillLifecycleProcessor fillLifecycleProcessor,
IDbParameters parameters)
{
containsDataSet = false;
this.dataTable = dataTable;
this.commandType = commandType;
this.sql = sql;
this.mappingCollection = mappingCollection;
this.dataAdapterSetter = dataAdapterSetter;
this.fillLifecycleProcessor = fillLifecycleProcessor;
this.parameters = parameters;
}
示例5: DataTableUpdate
public virtual int DataTableUpdate(DataTable dataTable,
string tableName,
CommandType insertCommandtype, string insertSql, IDbParameters insertParameters,
CommandType updateCommandtype, string updateSql, IDbParameters updateParameters,
CommandType deleteCommandtype, string deleteSql, IDbParameters deleteParameters,
IDataAdapterSetter dataAdapterSetter)
{
ValidateUpdateArguments(dataTable, tableName);
ITableMappingCollection mappingCollection = DoCreateMappingCollection(new string[] { tableName });
return DataTableUpdate(dataTable, mappingCollection,
insertCommandtype, insertSql, insertParameters,
updateCommandtype, updateSql, updateParameters,
deleteCommandtype, deleteSql, deleteParameters,
dataAdapterSetter);
}
示例6: QueryForObjectDelegate
/// <summary>
/// Execute a query with the specified command text and parameters, mapping a single result row
/// to an object via a RowMapper.
/// </summary>
/// <param name="cmdType">The command type.</param>
/// <param name="cmdText">The command text to execute.</param>
/// <param name="rowMapperDelegate">delegate that will map one object per row</param>
/// <param name="parameters">The parameter collection to use in the query.</param>
/// <returns>The single mapped object.</returns>
/// <exception cref="Spring.Dao.IncorrectResultSizeDataAccessException">
/// If the query does not return exactly one row.
/// </exception>
/// <exception cref="Spring.Dao.DataAccessException">
/// If there is any problem executing the query.
/// </exception>
public virtual object QueryForObjectDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate, IDbParameters parameters)
{
IList results = QueryWithRowMapperDelegate(cmdType, cmdText, rowMapperDelegate, parameters);
return DataAccessUtils.RequiredUniqueResultSet(results);
}
示例7: QueryWithRowMapperDelegate
public virtual IList QueryWithRowMapperDelegate(CommandType cmdType, string cmdText, RowMapperDelegate rowMapperDelegate,
IDbParameters parameters)
{
return (IList)QueryWithResultSetExtractor(cmdType, cmdText, new RowMapperResultSetExtractor(rowMapperDelegate), parameters);
}
示例8: QueryWithRowCallback
public virtual void QueryWithRowCallback(CommandType cmdType, string cmdText, IRowCallback rowCallback, IDbParameters parameters)
{
QueryWithResultSetExtractor(cmdType, cmdText, new RowCallbackResultSetExtractor(rowCallback), parameters);
}
示例9: ExecuteNonQuery
/// <summary>
/// Executes a non query returning the number of rows affected.
/// </summary>
/// <param name="cmdType">The command type.</param>
/// <param name="cmdText">The command text to execute.</param>
/// <param name="parameters">The parameter collection to map.</param>
/// <returns>The number of rows affected.</returns>
public virtual int ExecuteNonQuery(CommandType cmdType, string cmdText,
IDbParameters parameters)
{
#region Instrumentation
if (LOG.IsDebugEnabled)
{
LOG.Debug("Executing NonQuery. " + cmdType + "[" + cmdText + "]");
}
#endregion
return (int)Execute(new ExecuteNonQueryCallbackWithParameters(cmdType, cmdText, parameters));
}
示例10: ExecuteScalarCallbackWithParameters
public ExecuteScalarCallbackWithParameters(CommandType cmdType, string cmdText, IDbParameters dbParameters)
{
commandType = cmdType;
commandText = cmdText;
parameters = dbParameters;
}
示例11: DataSetFillWithParameters
public virtual int DataSetFillWithParameters(DataSet dataSet, CommandType commandType, string sql,
IDbParameters parameters,
ITableMappingCollection tableMapping,
IDataAdapterSetter dataAdapterSetter,
IDataSetFillLifecycleProcessor fillLifecycleProcessor)
{
ValidateFillWithParameterArguments(dataSet, sql, parameters, tableMapping);
return (int)Execute(new DataAdapterFillCallback(dataSet,
commandType, sql,
tableMapping, dataAdapterSetter, fillLifecycleProcessor, parameters));
}
示例12: DataSetCreateWithParams
public virtual DataSet DataSetCreateWithParams(CommandType commandType, string sql,
IDbParameters parameters,
ITableMappingCollection tableMapping,
IDataAdapterSetter dataAdapterSetter,
IDataSetFillLifecycleProcessor fillLifecycleProcessor)
{
DataSet dataSet = CreateDataSet();
DataSetFillWithParameters(dataSet, commandType, sql, parameters, tableMapping, dataAdapterSetter, fillLifecycleProcessor);
return dataSet;
}
示例13: DataAdapterUpdateWithCommandBuilderCallback
public DataAdapterUpdateWithCommandBuilderCallback(DataTable dataTable,
object commandBuilder,
ITableMappingCollection mappingCollection,
CommandType selectCommandType,
string selectSql,
IDbParameters selectParameters,
IDataAdapterSetter dataAdapterSetter)
{
containsDataSet = false;
this.dataTable = dataTable;
this.commandBuilder = commandBuilder;
this.mappingCollection = mappingCollection;
this.selectCommandType = selectCommandType;
this.selectSql = selectSql;
this.selectParameters = selectParameters;
this.dataAdapterSetter = dataAdapterSetter;
}
示例14: ExecuteNonQueryCallbackWithParameters
public ExecuteNonQueryCallbackWithParameters(CommandType commandType, string commandText, IDbParameters dbParameters)
{
this.commandType = commandType;
this.commandText = commandText;
parameters = dbParameters;
}
示例15: DataSetUpdateWithCommandBuilder
public virtual int DataSetUpdateWithCommandBuilder(DataSet dataSet,
CommandType commandType,
string selectSql,
IDbParameters selectParameters,
string tableName)
{
ValidateUpdateWithCommandBuilderArguments(dataSet, tableName, selectSql);
ITableMappingCollection mappingCollection = DoCreateMappingCollection(new string[] { tableName });
return (int)Execute(new DataAdapterUpdateWithCommandBuilderCallback(dataSet,
DbProvider.CreateCommandBuilder(),
mappingCollection,
commandType,
selectSql,
selectParameters,
null));
}