public bool Equals(PositionalParameterSpecification other)
		{
			if (ReferenceEquals(null, other))
			{
				return false;
			}
			if (ReferenceEquals(this, other))
			{
				return true;
			}
			return other.hqlPosition == hqlPosition;
		}
		private IEnumerable<IParameterSpecification> CreateParameterSpecificationsAndAssignBackTrack(IEnumerable<Parameter> sqlPatameters)
		{
			var specifications = new List<IParameterSpecification>();
			int position = 0;
			var parameters = sqlPatameters.ToArray();
			for (var sqlParameterPos = 0; sqlParameterPos < parameters.Length;)
			{
				var specification = new PositionalParameterSpecification(1, 0, position++) {ExpectedType = UniqueKeyType};
				var paramTrackers = specification.GetIdsForBackTrack(Factory);
				foreach (var paramTracker in paramTrackers)
				{
					parameters[sqlParameterPos++].BackTrack = paramTracker;
				}
				specifications.Add(specification);
			}
			return specifications;
		}
		protected virtual IEnumerable<IParameterSpecification> CreateParameterSpecificationsAndAssignBackTrack(IEnumerable<Parameter> sqlPatameters)
		{
			// This implementation can manage even the case of batch-loading
			var specifications = new List<IParameterSpecification>();
			int position = 0;
			var parameters = sqlPatameters.ToArray();
			for (var sqlParameterPos = 0; sqlParameterPos < parameters.Length; )
			{
				var specification = new PositionalParameterSpecification(1, 0, position++) { ExpectedType = KeyType };
				var paramTrackers = specification.GetIdsForBackTrack(Factory);
				foreach (var paramTracker in paramTrackers)
				{
					parameters[sqlParameterPos++].BackTrack = paramTracker;
				}
				specifications.Add(specification);
			}
			return specifications;
		}
		public SqlString GetPositionalParameter()
		{
			var parameterSpecification = new PositionalParameterSpecification(1, 0, GetPositionalParameterPosition());
			var parameter = Parameter.Placeholder;
			parameter.BackTrack = parameterSpecification.GetIdsForBackTrack(Factory).First();
			collectedParameters.Add(parameterSpecification);
			return new SqlString(parameter);
		}
示例#5
0
		IASTNode GeneratePositionalParameter(IASTNode inputNode)
		{
			if (_namedParameters.Count > 0)
			{
				// NH TODO: remove this limitation
				throw new SemanticException("cannot define positional parameter after any named parameters have been defined");
			}
			ParameterNode parameter = (ParameterNode)adaptor.Create(PARAM, "?");
			PositionalParameterSpecification paramSpec = new PositionalParameterSpecification(
					inputNode.Line,
					inputNode.CharPositionInLine,
					_positionalParameterCount++
			);
			parameter.HqlParameterSpecification = paramSpec;
			_parameters.Add(paramSpec);
			return parameter;
		}
示例#6
0
			public void OrdinalParameter(int position)
			{
				var paramSpec = new PositionalParameterSpecification(1, position, positionalParameterCount++);
				var parameter = Parameter.Placeholder;
				parameter.BackTrack = paramSpec.GetIdsForBackTrack(factory).First();
				parametersSpecifications.Add(paramSpec);
				result.Add(parameter);
			}