Exemplo n.º 1
0
		public void Compile(ObjectExpression oe)
		{
			_maps = oe.Mappings;
			_provider = oe.Mappings.provider;

			_nextAliasIndex = 0;
			_parameterTable = new OPathParameterTable();

			// generate the database-specific query statement (and the parameter table at the same time)
			using( StringWriter writer = new StringWriter(new StringBuilder(500)) )
			{
				WriteSqlQuery(writer, oe.Expression);
				writer.Write(_provider.LineTerminator);
				_sqlQuery = writer.ToString();
			}

			SetParameterOrder(oe);

			// all or none of the parameters have to be provided
			if( _parameterTable != null )
			{
				if( _parameterTable.Count != oe.ParameterCount )
				{
					throw new Exception("Number of parameters in the expression does not match number of parameters in the OPathQuery.");
				}
			}

#if DEBUG
			//Debug.WriteLine(_sqlQuery);
			//Debug.WriteLine("");
#endif
		}
Exemplo n.º 2
0
        public void Compile(ObjectExpression oe)
        {
            _maps     = oe.Mappings;
            _provider = oe.Mappings.provider;

            _nextAliasIndex = 0;
            _parameterTable = new OPathParameterTable();

            // generate the database-specific query statement (and the parameter table at the same time)
            using (StringWriter writer = new StringWriter(new StringBuilder(500)))
            {
                WriteSqlQuery(writer, oe.Expression);
                writer.Write(_provider.LineTerminator);
                _sqlQuery = writer.ToString();
            }

            SetParameterOrder(oe);

            // all or none of the parameters have to be provided
            if (_parameterTable != null)
            {
                if (_parameterTable.Count != oe.ParameterCount)
                {
                    throw new Exception("Number of parameters in the expression does not match number of parameters in the OPathQuery.");
                }
            }

#if DEBUG
            //Debug.WriteLine(_sqlQuery);
            //Debug.WriteLine("");
#endif
        }
Exemplo n.º 3
0
		internal CompiledQuery(ObjectExpression oe)
		{
			_objectExpression = oe;
			_objectType = oe.ObjectType;
			this.baseQuery = oe.baseQuery;
			this.parameterCount = oe.ParameterCount;

			OPathCompiler compiler = new OPathCompiler();
			compiler.Compile(oe);

			_sqlQuery = compiler.SqlQuery;
			this.parameterTable = compiler.ParameterTable;
		}