Exemple #1
0
        public string GetSqlJoin(SqlJoins c)
        {
            string sql = null;

            if (sqlJoinsLookup.TryGetValue(c, out sql) == false)
            {
                return(string.Empty);
            }

            return(sql);
        }
Exemple #2
0
        /// <summary>
        /// Adds a joined table to the SQL with joining this table to the base table
        /// on a common field name. BaseTable.FieldA => NewTable.FieldA
        /// </summary>
        /// <param name="tableName">The new table name being added to the SQL.</param>
        /// <param name="joinType">Join method (LEFT, RIGHT, INNER).</param>
        /// <param name="joinFieldNameA">Joining field name in the new table.</param>
        /// <param name="joiningTableName">Existing table to be joined to.</param>
        /// <param name="joinFieldNameB">Joining field name in the existing table.</param>
        public void AddTable(string tableName, SqlJoins joinType, string joinFieldNameA, string joiningTableName, string joinFieldNameB, bool doNotBracket = false)
        {
            foreach (SqlTable table in Tables)
            {
                if (table.Name == tableName)
                {
                    return;
                }
            }

            SqlTable newtable = new SqlTable();

            newtable.Name           = tableName;
            newtable.JoinType       = GetSqlJoin(joinType);
            newtable.JoinFieldNameA = joinFieldNameA;
            newtable.JoinFieldNameB = joinFieldNameB;
            newtable.JoiningTable   = joiningTableName;
            newtable.DoNotBracket   = doNotBracket;
            Tables.Add(newtable);
        }
Exemple #3
0
 /// <summary>
 /// Adds a joined table to the SQL with joining this table to the base table
 /// on a common field name. BaseTable.FieldA => NewTable.FieldA
 /// </summary>
 /// <param name="tableName">The new table name being added to the SQL.</param>
 /// <param name="joinType">Join method (LEFT, RIGHT, INNER).</param>
 /// <param name="joinFieldName">Joining field name in both tables.</param>
 public void AddTable(string tableName, SqlJoins joinType, string joinFieldName, bool doNotBracket = false)
 {
     AddTable(tableName, joinType, joinFieldName, BaseTable, joinFieldName, doNotBracket);
 }