public Sql Append(Sql sql) { if (_rhs != null) _rhs.Append(sql); else _rhs = sql; return this; }
private void Build(StringBuilder sb, List<object> args, Sql lhs) { if (!String.IsNullOrEmpty(_sql)) { // Add SQL to the string if (sb.Length > 0) { sb.Append("\n"); } var sql = 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 _rhs?.Build(sb, args, this); }
private static bool Is(Sql sql, string sqltype) { return sql?._sql != null && sql._sql.StartsWith(sqltype, StringComparison.InvariantCultureIgnoreCase); }
public SqlJoinClause(Sql sql) { _sql = sql; }
public void Delete(Sql sql, Connection db, Action<int> callback = null) { ExecuteNonQuery(sql, db, callback); }
public void ExecuteNonQuery(Sql sql, Connection db, Action<int> callback = null) { var query = new SQLiteQuery { Sql = sql, Connection = db, CallbackNonQuery = callback, NonQuery = true }; lock (_syncroot) _queue.Enqueue(query); _workevent.Set(); }
public void Query(Sql sql, Connection db, Action<List<Dictionary<string, object>>> callback) { var query = new SQLiteQuery { Sql = sql, Connection = db, Callback = callback }; lock (_syncroot) _queue.Enqueue(query); _workevent.Set(); }