本文整理汇总了C#中QueryParameters.BindParameters方法的典型用法代码示例。如果您正苦于以下问题:C# QueryParameters.BindParameters方法的具体用法?C# QueryParameters.BindParameters怎么用?C# QueryParameters.BindParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryParameters
的用法示例。
在下文中一共展示了QueryParameters.BindParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformExecuteUpdate
// DONE : H3.2 Executable query (now can be supported for named SQL query/ storedProcedure)
public int PerformExecuteUpdate(QueryParameters queryParameters, ISessionImplementor session)
{
CoordinateSharedCacheCleanup(session);
if (queryParameters.Callable)
{
throw new ArgumentException("callable not yet supported for native queries");
}
RowSelection selection = queryParameters.RowSelection;
int result;
try
{
queryParameters.ProcessFilters(customQuery.SQL, session);
SqlString sql = queryParameters.FilteredSQL;
SqlType[] sqlTypes = queryParameters.PrepareParameterTypes(sql, session.Factory, GetNamedParameterLocs, 0, false, false);
IDbCommand ps = session.Batcher.PrepareCommand(CommandType.Text, sql, sqlTypes);
try
{
if (selection != null && selection.Timeout != RowSelection.NoValue)
{
// NH Difference : set Timeout for native query
ps.CommandTimeout = selection.Timeout;
}
// NH Different behavior:
// The inital value is 0 (initialized to 1 in JAVA)
// The responsibility of parameter binding was entirely moved to QueryParameters
// to deal with positionslParameter+NamedParameter+ParameterOfFilters
queryParameters.BindParameters(ps, 0, session);
result = session.Batcher.ExecuteNonQuery(ps);
}
finally
{
if (ps != null)
{
session.Batcher.CloseCommand(ps, null);
}
}
}
catch (HibernateException)
{
throw;
}
catch (Exception sqle)
{
throw ADOExceptionHelper.Convert(session.Factory.SQLExceptionConverter, sqle,
"could not execute native bulk manipulation query:" + sourceQuery);
}
return result;
}