Skip to content

Commit

Permalink
Providing a execute method on a specific connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
russ authored and anykeyh committed Jun 24, 2018
1 parent 9c45705 commit ec3f645
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/clear/sql/sql.cr
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ module Clear
log_query(sql) { Clear::SQL.connection("default").exec(sql) }
end

# Execute a SQL request on a specific connection.
#
# Usage:
# Clear::SQL.execute("seconddatabase", "SELECT 1 FROM users")
def execute(connection : Symbolic, sql)
log_query(sql) { Clear::SQL.connection(connection).exec(sql) }
end

# :nodoc:
def sel_str(s : Selectable)
s.is_a?(Symbolic) ? s.to_s : s.to_sql
Expand Down

0 comments on commit ec3f645

Please sign in to comment.