console/content/table/metric_definitions.auto.sql
SELECT 'dynamic' AS component, sqlpage.run_sql('shell/shell.sql') AS properties;
SELECT 'breadcrumb' AS component;
SELECT 'Home' as title,sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/' AS link;
SELECT 'Console' as title,sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/console' AS link;
SELECT 'Content' as title,sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/console/content' AS link;
SELECT 'metric_definitions table' as title, '#' AS link;
SELECT 'title' AS component, 'metric_definitions (table) Content' as contents;
SET total_rows = (SELECT COUNT(*) FROM metric_definitions);
SET limit = COALESCE($limit, 50);
SET offset = COALESCE($offset, 0);
SET total_pages = ($total_rows + $limit - 1) / $limit;
SET current_page = ($offset / $limit) + 1;
SELECT 'text' AS component, '[metric_definitions (table) Schema](console/info-schema/table.sql?name=metric_definitions&stats=yes)' AS contents_md
SELECT 'text' AS component,
'- Start Row: ' || $offset || '
' ||
'- Rows per Page: ' || $limit || '
' ||
'- Total Rows: ' || $total_rows || '
' ||
'- Current Page: ' || $current_page || '
' ||
'- Total Pages: ' || $total_pages as contents_md
WHERE $stats IS NOT NULL;
-- Display uniform_resource table with pagination
SELECT 'table' AS component,
TRUE AS sort,
TRUE AS search,
TRUE AS hover,
TRUE AS striped_rows,
TRUE AS small;
SELECT * FROM metric_definitions
LIMIT $limit
OFFSET $offset;
SELECT 'text' AS component,
(SELECT CASE WHEN $current_page > 1 THEN '[Previous](?limit=' || $limit || '&offset=' || ($offset - $limit) || ')' ELSE ' END) || ' ' ||
'(Page ' || $current_page || ' of ' || $total_pages || ') ' ||
(SELECT CASE WHEN $current_page < $total_pages THEN '[Next](?limit=' || $limit || '&offset=' || ($offset + $limit) || ')' ELSE ' END)
AS contents_md;