Module: PgHero::Methods::Basic
- Included in:
- Database
- Defined in:
- lib/pghero/methods/basic.rb
Instance Method Summary collapse
- #current_user ⇒ Object
- #database_name ⇒ Object
- #quote_ident(value) ⇒ Object
- #server_version ⇒ Object
- #server_version_num ⇒ Object
- #ssl_used? ⇒ Boolean
Instance Method Details
#current_user ⇒ Object
21 22 23 |
# File 'lib/pghero/methods/basic.rb', line 21 def current_user select_one("SELECT current_user") end |
#database_name ⇒ Object
17 18 19 |
# File 'lib/pghero/methods/basic.rb', line 17 def database_name select_one("SELECT current_database()") end |
#quote_ident(value) ⇒ Object
33 34 35 |
# File 'lib/pghero/methods/basic.rb', line 33 def quote_ident(value) with_connection { |c| c.quote_column_name(value) } end |
#server_version ⇒ Object
25 26 27 |
# File 'lib/pghero/methods/basic.rb', line 25 def server_version @server_version ||= select_one("SHOW server_version") end |
#server_version_num ⇒ Object
29 30 31 |
# File 'lib/pghero/methods/basic.rb', line 29 def server_version_num @server_version_num ||= select_one("SHOW server_version_num").to_i end |
#ssl_used? ⇒ Boolean
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/pghero/methods/basic.rb', line 4 def ssl_used? ssl_used = nil with_transaction(rollback: true) do begin execute("CREATE EXTENSION IF NOT EXISTS sslinfo") rescue ActiveRecord::StatementInvalid # not superuser end ssl_used = select_one("SELECT ssl_is_used()") end ssl_used end |