Beispiel #1
0
        /// <summary>
        /// SQL 'FROM' clause extensions. Add new 'FROM' in clause.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="phrases">The 'FROM' phrases.</param>
        /// <returns>The command.</returns>
        public static APSqlSelectCommand from_add(this APSqlSelectCommand command, IEnumerable <APSqlFromPhrase> phrases)
        {
            if (command.FromClause == null || command.FromClause.Next == null)
            {
                command.FromClause = new APSqlFromClause(phrases);
            }
            else
            {
                APSqlFromPhrase exist = command.FromClause.Last as APSqlFromPhrase;
                exist.SetNext(phrases);
            }

            return(command);
        }
Beispiel #2
0
        /// <summary>
        /// SQL 'FROM' clause extensions. Add new 'FROM' in clause.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="phrases">The 'FROM' phrases.</param>
        /// <returns>The command.</returns>
        public static APSqlDeleteCommand from_add(this APSqlDeleteCommand command, params APSqlFromPhrase[] phrases)
        {
            if (command.FromClause == null || command.FromClause.Next == null)
            {
                command.FromClause = new APSqlFromClause(phrases);
            }
            else
            {
                APSqlFromPhrase exist = command.FromClause.Last as APSqlFromPhrase;
                exist.SetNext(phrases);
            }

            return(command);
        }
		/// <summary>
		/// SQL 'FROM' clause extensions. Add new 'FROM' in clause.
		/// </summary>
		/// <param name="command">The command.</param>
		/// <param name="phrase">The 'FROM' phrase.</param>
		/// <returns>The command.</returns>
		public static APSqlDeleteCommand from_add(this APSqlDeleteCommand command, APSqlFromPhrase phrase)
		{
			if (command.FromClause == null || command.FromClause.Next == null)
			{
				command.FromClause = new APSqlFromClause(phrase);
			}
			else
			{
				APSqlFromPhrase exist = command.FromClause.Last as APSqlFromPhrase;
				exist.SetNext(phrase);
			}

			return command;
		}
Beispiel #4
0
        private void WriteFrom(ParserWriter writer, APSqlFromClause clause, OracleCommand dbCmd)
        {
            if (clause != null && clause.Next != null)
            {
                writer.WriteLine();
                writer.WriteDirect("FROM");
                APSqlFromPhrase phrase  = clause.Next;
                bool            isFirst = true;

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

                        writer.Write(phrase.TableName);
                        if (phrase.AliasName != null)
                        {
                            writer.Write(phrase.AliasName);
                        }
                    }
                    else
                    {
                        writer.Write(GetJoinTypeString(phrase.JoinType));
                        writer.Write(phrase.TableName);
                        if (phrase.AliasName != null)
                        {
                            writer.Write(phrase.AliasName);
                        }
                        if (phrase.JoinType != APSqlJoinType.Cross && phrase.JoinOnPhrase != null)
                        {
                            WriteJoinOn(writer, phrase.JoinOnPhrase, dbCmd);
                        }
                    }

                    phrase = phrase.Next as APSqlFromPhrase;
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// Create a 'FROM' clause with one 'FROM' phrase.
 /// </summary>
 /// <param name="phrase">'FROM' phrase.</param>
 public APSqlFromClause(APSqlFromPhrase phrase)
 {
     SetNext(phrase);
 }
Beispiel #6
0
 /// <summary>
 /// SQL 'FROM' clause extensions.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="phrase">The 'FROM' phrase.</param>
 /// <returns>The command.</returns>
 public static APSqlSelectCommand from(this APSqlSelectCommand command, APSqlFromPhrase phrase)
 {
     command.FromClause = new APSqlFromClause(phrase);
     return(command);
 }
		/// <summary>
		/// SQL 'FROM' clause extensions.
		/// </summary>
		/// <param name="command">The command.</param>
		/// <param name="phrase">The 'FROM' phrase.</param>
		/// <returns>The command.</returns>
		public static APSqlUpdateCommand from(this APSqlUpdateCommand command, APSqlFromPhrase phrase)
		{
			command.FromClause = new APSqlFromClause(phrase);
			return command;
		}
Beispiel #8
0
		/// <summary>
		/// Create a 'FROM' clause with one 'FROM' phrase.
		/// </summary>
		/// <param name="phrase">'FROM' phrase.</param>
		public APSqlFromClause(APSqlFromPhrase phrase)
		{
			SetNext(phrase);
		}