Ejemplo n.º 1
0
        private void WriteSelect(ParserWriter writer, APSqlSelectCommand command)
        {
            writer.WriteDirect("SELECT");

            if (command.SelectMode == APSqlSelectMode.DISTINCT)
            {
                writer.Write("DISTINCT");
            }

            APSqlSelectPhrase phrase = command.SelectExprClause.Next as APSqlSelectPhrase;
            bool isFirst             = true;

            while (phrase != null)
            {
                if (!isFirst)
                {
                    writer.Write(',');
                }
                else
                {
                    isFirst = false;
                }

                WriteSelectExpression(writer, phrase.Expr);
                if (!string.IsNullOrEmpty(phrase.Alias))
                {
                    writer.Write("AS " + JudgeAliasName(phrase.Alias));
                }


                phrase = phrase.Next as APSqlSelectPhrase;
            }
        }
Ejemplo n.º 2
0
        private void WriteInsertWithSubQuery(ParserWriter writer, APSqlInsertCommand command)
        {
            writer.WriteDirect("INSERT INTO");
            writer.Write(command.TableDef.TableName);

            if (command.SelectClause != null)
            {
                writer.Write("(");

                APSqlSelectPhrase phrase = command.SelectClause.Next as APSqlSelectPhrase;
                bool isFirst             = true;
                while (phrase != null)
                {
                    if (!isFirst)
                    {
                        writer.Write(',');
                    }
                    else
                    {
                        isFirst = false;
                    }

                    WriteSelectExpression(writer, phrase.Expr);

                    phrase = phrase.Next as APSqlSelectPhrase;
                }

                writer.Write(")");
            }
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Create a new 'SELECT' clause with 'SELECT' phrase.
		/// </summary>
		/// <param name="phrase">The 'SELECT' phrase.</param>
		public APSqlSelectClause(APSqlSelectPhrase phrase)
		{
			SetNext(phrase);
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Create a new 'SELECT' command with 'SELECT' phrase.
		/// </summary>
		/// <param name="phrase">The 'SELECT' phrase.</param>
		public APSqlSelectCommand(APSqlSelectPhrase phrase)
		{
			_selectExprClause = new APSqlSelectClause(phrase);
		}
Ejemplo n.º 5
0
		/// <summary>
		/// Create a new 'SELECT' command with 'SELECT' phrase.
		/// </summary>
		/// <param name="phrase">The 'SELECT' phrase.</param>
		public static APSqlSelectCommand select(APSqlSelectPhrase phrase)
		{
			return new APSqlSelectCommand(phrase);
		}
Ejemplo n.º 6
0
 /// <summary>
 /// Create a new 'SELECT' command with 'SELECT' phrase.
 /// </summary>
 /// <param name="phrase">The 'SELECT' phrase.</param>
 public APSqlSelectCommand(APSqlSelectPhrase phrase)
 {
     _selectExprClause = new APSqlSelectClause(phrase);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Create a new 'SELECT' clause with 'SELECT' phrase.
 /// </summary>
 /// <param name="phrase">The 'SELECT' phrase.</param>
 public APSqlSelectClause(APSqlSelectPhrase phrase)
 {
     SetNext(phrase);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Create a new 'SELECT' command with 'SELECT' phrase.
 /// </summary>
 /// <param name="phrase">The 'SELECT' phrase.</param>
 public static APSqlSelectCommand select(APSqlSelectPhrase phrase)
 {
     return(new APSqlSelectCommand(phrase));
 }