public override void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { TypedValue typedValue = queryParameters.NamedParameters[name]; string backTrackId = GetIdsForBackTrack(session.Factory).First(); // just the first because IType suppose the oders in certain sequence foreach (int position in sqlQueryParametersList.GetEffectiveParameterLocations(backTrackId)) { ExpectedType.NullSafeSet(command, GetPagingValue(typedValue.Value, session.Factory.Dialect, queryParameters), position + singleSqlParametersOffset, session); } }
public void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { IType type = keyType; object value = queryParameters.PositionalParameterValues[queryParameterPosition]; string backTrackId = GetIdsForBackTrack(session.Factory).First(); // just the first because IType suppose the oders in certain sequence int position = sqlQueryParametersList.GetEffectiveParameterLocations(backTrackId).Single(); // an HQL positional parameter can't appear more than once type.NullSafeSet(command, value, position + singleSqlParametersOffset, session); }
public void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { TypedValue typedValue = queryParameters.NamedParameters[name]; string backTrackId = GetIdsForBackTrack(session.Factory).First(); foreach (int position in sqlQueryParametersList.GetEffectiveParameterLocations(backTrackId)) { ExpectedType.NullSafeSet(command, typedValue.Value, position + singleSqlParametersOffset, session); } }
public void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { string backTrackId = GetIdsForBackTrack(session.Factory).First(); // just the first because IType suppose the oders in certain sequence // The same filterName-parameterName can appear more than once in the whole query object value = session.GetFilterParameterValue(filterParameterFullName); foreach (int position in multiSqlQueryParametersList.GetEffectiveParameterLocations(backTrackId)) { ExpectedType.NullSafeSet(command, value, position, session); } }
public void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { // The QuerySkipParameterSpecification is unique so we can use multiSqlQueryParametersList var effectiveParameterLocations = multiSqlQueryParametersList.GetEffectiveParameterLocations(limitParametersNameForThisQuery).ToArray(); if (effectiveParameterLocations.Length > 0) { // if the dialect does not support variable limits the parameter may was removed int value = Loader.Loader.GetOffsetUsingDialect(queryParameters.RowSelection, session.Factory.Dialect) ?? queryParameters.RowSelection.FirstRow; int position = effectiveParameterLocations[0]; type.NullSafeSet(command, value, position, session); } }
public void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { // The QueryTakeParameterSpecification is unique so we can use multiSqlQueryParametersList var effectiveParameterLocations = multiSqlQueryParametersList.GetEffectiveParameterLocations(limitParametersNameForThisQuery).ToArray(); if (effectiveParameterLocations.Any()) { // if the dialect does not support variable limits the parameter may was removed int value = queryParameters.RowSelection.MaxRows; int position = effectiveParameterLocations.Single(); type.NullSafeSet(command, value, position, session); } }
public override void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { IType type = ExpectedType; object value = queryParameters.PositionalParameterValues[hqlPosition]; string backTrackId = GetIdsForBackTrack(session.Factory).First(); // just the first because IType suppose the oders in certain sequence // an HQL positional parameter can appear more than once because a custom HQL-Function can duplicate it foreach (int position in sqlQueryParametersList.GetEffectiveParameterLocations(backTrackId)) { type.NullSafeSet(command, GetPagingValue(value, session.Factory.Dialect, queryParameters), position + singleSqlParametersOffset, session); } }
public static SqlType[] GetQueryParameterTypes(this IEnumerable<IParameterSpecification> parameterSpecs, IList<Parameter> sqlQueryParametersList, ISessionFactoryImplementor factory) { // NOTE: if you have a NullReferenceException probably is because the IParameterSpecification does not have the ExpectedType; use ResetEffectiveExpectedType before call this method. // due to IType.NullSafeSet(System.Data.IDbCommand , object, int, ISessionImplementor) the SqlType[] is supposed to be in a certain sequence. // here we can check and evetually Assert (see AssertionFailure) the supposition because each individual Parameter has its BackTrackId. // Currently we just take the first BackTrackId of each IParameterSpecification IEnumerable<IType> typesSequence = from typeLocation in from specification in parameterSpecs let firstParameterId = specification.GetIdsForBackTrack(factory).First() let effectiveParameterLocations = sqlQueryParametersList.GetEffectiveParameterLocations(firstParameterId) from location in effectiveParameterLocations select new {Location = location, Type = specification.ExpectedType} group typeLocation by typeLocation.Location into locations orderby locations.Key select locations.First().Type; return typesSequence.SelectMany(t => t.SqlTypes(factory)).ToArray(); }
public void Bind(IDbCommand command, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session) { int position = sqlQueryParametersList.GetEffectiveParameterLocations(IdBackTrack).Single(); // version parameter can't appear more than once type.NullSafeSet(command, type.Seed(session), position, session); }