Esempio n. 1
0
        private void WriteHaving(ParserWriter writer, APSqlWhereClause clause, OracleCommand dbCmd)
        {
            if (clause != null && clause.Next != null)
            {
                writer.WriteLine();
                writer.WriteDirect("HAVING");

                APSqlWherePhrase phrase = clause.Next as APSqlWherePhrase;

                if (phrase.Next == null)
                {
                    if (phrase is APSqlConditionAndPhrase)
                    {
                        WriteConditionPhrase(writer, (phrase as APSqlConditionAndPhrase).Child, APSqlConditionJoinType.AND, dbCmd);
                        return;
                    }
                    else if (phrase is APSqlConditionOrPhrase)
                    {
                        WriteConditionPhrase(writer, (phrase as APSqlConditionOrPhrase).Child, APSqlConditionJoinType.OR, dbCmd);
                        return;
                    }
                }
                WriteConditionPhrase(writer, phrase, APSqlConditionJoinType.AND, dbCmd);
            }
        }
Esempio n. 2
0
        private void WriteWhere(ParserWriter writer, APSqlWhereClause clause, OracleCommand dbCmd, int?maxReturnCount = null)
        {
            bool standardWhere = clause != null && clause.Next != null;

            if (standardWhere || maxReturnCount != null)
            {
                writer.WriteLine();
                writer.WriteDirect("WHERE");

                if (standardWhere)
                {
                    APSqlWherePhrase phrase = clause.Next as APSqlWherePhrase;

                    if (phrase.Next == null)
                    {
                        if (phrase is APSqlConditionAndPhrase)
                        {
                            WriteConditionPhrase(writer, (phrase as APSqlConditionAndPhrase).Child, APSqlConditionJoinType.AND, dbCmd);
                            return;
                        }
                        else if (phrase is APSqlConditionOrPhrase)
                        {
                            WriteConditionPhrase(writer, (phrase as APSqlConditionOrPhrase).Child, APSqlConditionJoinType.OR, dbCmd);
                            return;
                        }
                    }
                    WriteConditionPhrase(writer, phrase, APSqlConditionJoinType.AND, dbCmd);
                }
                if (maxReturnCount != null)
                {
                    if (standardWhere)
                    {
                        writer.Write("AND");
                    }
                    writer.Write("ROWNUM <= " + maxReturnCount.Value);
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// SQL 'HAVING' clause extensions.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="clause">The 'HAVING' clause.</param>
 /// <returns>The command.</returns>
 public static APSqlSelectCommand having(this APSqlSelectCommand command, APSqlWhereClause clause)
 {
     command.HavingClause = clause;
     return(command);
 }
Esempio n. 4
0
 /// <summary>
 /// SQL 'WHERE' clause extensions.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="clause">The 'WHERE' clause.</param>
 /// <returns>The command.</returns>
 public static APSqlSelectCommand where (this APSqlSelectCommand command, APSqlWhereClause clause)
 {
     command.WhereClause = clause;
     return(command);
 }
		/// <summary>
		/// SQL 'WHERE' clause extensions.
		/// </summary>
		/// <param name="command">The command.</param>
		/// <param name="clause">The 'WHERE' clause.</param>
		/// <returns>The command.</returns>
		public static APSqlUpdateCommand where(this APSqlUpdateCommand command, APSqlWhereClause clause)
		{
			command.WhereClause = clause;
			return command;
		}
Esempio n. 6
0
		private void WriteHaving(ParserWriter writer, APSqlWhereClause clause, SqlCommand dbCmd)
		{
			if (clause != null && clause.Next != null)
			{
				writer.WriteLine();
				writer.WriteDirect("HAVING");

				APSqlWherePhrase phrase = clause.Next as APSqlWherePhrase;

				if (phrase.Next == null)
				{
					if (phrase is APSqlConditionAndPhrase)
					{
						WriteConditionPhrase(writer, (phrase as APSqlConditionAndPhrase).Child, APSqlConditionJoinType.AND, dbCmd);
						return;
					}
					else if (phrase is APSqlConditionOrPhrase)
					{
						WriteConditionPhrase(writer, (phrase as APSqlConditionOrPhrase).Child, APSqlConditionJoinType.OR, dbCmd);
						return;
					}
				}
				WriteConditionPhrase(writer, phrase, APSqlConditionJoinType.AND, dbCmd);
			}
		}
Esempio n. 7
0
		private void WriteWhere(ParserWriter writer, APSqlWhereClause clause, OracleCommand dbCmd, int? maxReturnCount = null)
		{
			bool standardWhere = clause != null && clause.Next != null;
			if (standardWhere || maxReturnCount != null)
			{
				writer.WriteLine();
				writer.WriteDirect("WHERE");

				if (standardWhere)
				{
					APSqlWherePhrase phrase = clause.Next as APSqlWherePhrase;

					if (phrase.Next == null)
					{
						if (phrase is APSqlConditionAndPhrase)
						{
							WriteConditionPhrase(writer, (phrase as APSqlConditionAndPhrase).Child, APSqlConditionJoinType.AND, dbCmd);
							return;
						}
						else if (phrase is APSqlConditionOrPhrase)
						{
							WriteConditionPhrase(writer, (phrase as APSqlConditionOrPhrase).Child, APSqlConditionJoinType.OR, dbCmd);
							return;
						}
					}
					WriteConditionPhrase(writer, phrase, APSqlConditionJoinType.AND, dbCmd);
				}
				if (maxReturnCount != null)
				{
					if (standardWhere)
						writer.Write("AND");
					writer.Write("ROWNUM <= " + maxReturnCount.Value);
				}
			}
		}