Beispiel #1
0
        private void Build(StringBuilder sb, List <object> args, SqlJointer lhs)
        {
            if (!String.IsNullOrEmpty(_sql))
            {
                // Add SQL to the string
                if (sb.Length > 0)
                {
                    sb.Append("\n");
                }

                var sql = Database.ProcessParams(_sql, _args, args);

                if (Is(lhs, "WHERE ") && Is(this, "WHERE "))
                {
                    sql = "AND " + sql.Substring(6);
                }
                if (Is(lhs, "ORDER BY ") && Is(this, "ORDER BY "))
                {
                    sql = ", " + sql.Substring(9);
                }

                sb.Append(sql);
            }

            // Now do rhs
            if (_rhs != null)
            {
                _rhs.Build(sb, args, this);
            }
        }
Beispiel #2
0
        public SqlJointer Append(SqlJointer sql)
        {
            if (_rhs != null)
                _rhs.Append(sql);
            else
                _rhs = sql;

            return this;
        }
Beispiel #3
0
        public SqlJointer Append(SqlJointer sql)
        {
            if (_rhs != null)
            {
                _rhs.Append(sql);
            }
            else
            {
                _rhs = sql;
            }

            return(this);
        }
Beispiel #4
0
 public SqlJoinClause(SqlJointer sql)
 {
     _sql = sql;
 }
Beispiel #5
0
        private void Build(StringBuilder sb, List<object> args, SqlJointer lhs)
        {
            if (!String.IsNullOrEmpty(_sql))
            {
                // Add SQL to the string
                if (sb.Length > 0)
                {
                    sb.Append("\n");
                }

                var sql = Database.ProcessParams(_sql, _args, args);

                if (Is(lhs, "WHERE ") && Is(this, "WHERE "))
                    sql = "AND " + sql.Substring(6);
                if (Is(lhs, "ORDER BY ") && Is(this, "ORDER BY "))
                    sql = ", " + sql.Substring(9);

                sb.Append(sql);
            }

            // Now do rhs
            if (_rhs != null)
                _rhs.Build(sb, args, this);
        }
Beispiel #6
0
 static bool Is(SqlJointer sql, string sqltype)
 {
     return sql != null && sql._sql != null && sql._sql.StartsWith(sqltype, StringComparison.InvariantCultureIgnoreCase);
 }
Beispiel #7
0
 static bool Is(SqlJointer sql, string sqltype)
 {
     return(sql != null && sql._sql != null && sql._sql.StartsWith(sqltype, StringComparison.InvariantCultureIgnoreCase));
 }
Beispiel #8
0
 public SqlJoinClause(SqlJointer sql)
 {
     _sql = sql;
 }