Class: Dbviewer::Api::QueriesController

Inherits:
BaseController show all
Defined in:
app/controllers/dbviewer/api/queries_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#render_error, #render_success

Methods included from ErrorHandling

#handle_database_error, #log_error

Methods included from DatabaseOperations

#calculate_schema_size, #current_table?, #database_manager, #execute_query, #export_table_to_csv, #fetch_database_analytics, #fetch_filtered_record_count, #fetch_mini_erd_for_table, #fetch_table_columns, #fetch_table_metadata, #fetch_table_record_count, #fetch_table_records, #fetch_table_relationships, #fetch_tables_with_stats, #get_database_name, #prepare_query, #safe_quote_table_name, #table_query_operations

Instance Method Details

#recentObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/dbviewer/api/queries_controller.rb', line 4

def recent
  @recent_queries = if Dbviewer.configuration.enable_query_logging
    Dbviewer::Logger.instance.recent_queries(limit: 10)
  else
    []
  end

  render_success({
    enabled: Dbviewer.configuration.enable_query_logging,
    queries: @recent_queries
  })
end