Fossil SCM
On the /repo_stat1 page, provide an option to show the sqlite_stat1 data in a tabular format.
Commit
3c68f7d44549d58b6344a9b24c5eef86aa23a309b51baadc29fd4f1e7c68bc75
Parent
724f781594c3731…
1 file changed
+20
-3
+20
-3
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -768,32 +768,49 @@ | ||
| 768 | 768 | ** WEBPAGE: repo_stat1 |
| 769 | 769 | ** |
| 770 | 770 | ** Show the sqlite_stat1 table for the repository schema |
| 771 | 771 | */ |
| 772 | 772 | void repo_stat1_page(void){ |
| 773 | + int bTabular; | |
| 773 | 774 | login_check_credentials(); |
| 774 | 775 | if( !g.perm.Admin ){ login_needed(0); return; } |
| 776 | + bTabular = PB("tabular"); | |
| 775 | 777 | |
| 776 | 778 | style_set_current_feature("stat"); |
| 777 | 779 | style_header("Repository STAT1 Table"); |
| 778 | 780 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 779 | 781 | style_submenu_element("Stat", "stat"); |
| 780 | 782 | style_submenu_element("Schema", "repo_schema"); |
| 783 | + style_submenu_checkbox("tabular", "Tabular", 0, 0); | |
| 781 | 784 | if( db_table_exists("repository","sqlite_stat1") ){ |
| 782 | 785 | Stmt q; |
| 783 | 786 | db_prepare(&q, |
| 784 | 787 | "SELECT tbl, idx, stat FROM repository.sqlite_stat1" |
| 785 | 788 | " ORDER BY tbl, idx"); |
| 786 | - @ <pre> | |
| 789 | + if( bTabular ){ | |
| 790 | + @ <table border="1" cellpadding="0" cellspacing="0"> | |
| 791 | + @ <tr><th>Table<th>Index<th>Stat | |
| 792 | + }else{ | |
| 793 | + @ <pre> | |
| 794 | + } | |
| 787 | 795 | while( db_step(&q)==SQLITE_ROW ){ |
| 788 | 796 | const char *zTab = db_column_text(&q,0); |
| 789 | 797 | const char *zIdx = db_column_text(&q,1); |
| 790 | 798 | const char *zStat = db_column_text(&q,2); |
| 791 | 799 | char *zUrl = href("%R/repo_schema?n=%t",zTab); |
| 792 | - @ INSERT INTO sqlite_stat1 VALUES('%z(zUrl)%h(zTab)</a>','%h(zIdx)','%h(zStat)'); | |
| 800 | + if( bTabular ){ | |
| 801 | + @ <tr><td>%z(zUrl)%h(zTab)</a><td>%h(zIdx)<td>%h(zStat) | |
| 802 | + }else{ | |
| 803 | + @ INSERT INTO sqlite_stat1 \ | |
| 804 | + @ VALUES('%z(zUrl)%h(zTab)</a>','%h(zIdx)','%h(zStat)'); | |
| 805 | + } | |
| 793 | 806 | } |
| 794 | - @ </pre> | |
| 807 | + if( bTabular ){ | |
| 808 | + @ </table> | |
| 809 | + }else{ | |
| 810 | + @ </pre> | |
| 811 | + } | |
| 795 | 812 | db_finalize(&q); |
| 796 | 813 | } |
| 797 | 814 | style_finish_page(); |
| 798 | 815 | } |
| 799 | 816 | |
| 800 | 817 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -768,32 +768,49 @@ | |
| 768 | ** WEBPAGE: repo_stat1 |
| 769 | ** |
| 770 | ** Show the sqlite_stat1 table for the repository schema |
| 771 | */ |
| 772 | void repo_stat1_page(void){ |
| 773 | login_check_credentials(); |
| 774 | if( !g.perm.Admin ){ login_needed(0); return; } |
| 775 | |
| 776 | style_set_current_feature("stat"); |
| 777 | style_header("Repository STAT1 Table"); |
| 778 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 779 | style_submenu_element("Stat", "stat"); |
| 780 | style_submenu_element("Schema", "repo_schema"); |
| 781 | if( db_table_exists("repository","sqlite_stat1") ){ |
| 782 | Stmt q; |
| 783 | db_prepare(&q, |
| 784 | "SELECT tbl, idx, stat FROM repository.sqlite_stat1" |
| 785 | " ORDER BY tbl, idx"); |
| 786 | @ <pre> |
| 787 | while( db_step(&q)==SQLITE_ROW ){ |
| 788 | const char *zTab = db_column_text(&q,0); |
| 789 | const char *zIdx = db_column_text(&q,1); |
| 790 | const char *zStat = db_column_text(&q,2); |
| 791 | char *zUrl = href("%R/repo_schema?n=%t",zTab); |
| 792 | @ INSERT INTO sqlite_stat1 VALUES('%z(zUrl)%h(zTab)</a>','%h(zIdx)','%h(zStat)'); |
| 793 | } |
| 794 | @ </pre> |
| 795 | db_finalize(&q); |
| 796 | } |
| 797 | style_finish_page(); |
| 798 | } |
| 799 | |
| 800 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -768,32 +768,49 @@ | |
| 768 | ** WEBPAGE: repo_stat1 |
| 769 | ** |
| 770 | ** Show the sqlite_stat1 table for the repository schema |
| 771 | */ |
| 772 | void repo_stat1_page(void){ |
| 773 | int bTabular; |
| 774 | login_check_credentials(); |
| 775 | if( !g.perm.Admin ){ login_needed(0); return; } |
| 776 | bTabular = PB("tabular"); |
| 777 | |
| 778 | style_set_current_feature("stat"); |
| 779 | style_header("Repository STAT1 Table"); |
| 780 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 781 | style_submenu_element("Stat", "stat"); |
| 782 | style_submenu_element("Schema", "repo_schema"); |
| 783 | style_submenu_checkbox("tabular", "Tabular", 0, 0); |
| 784 | if( db_table_exists("repository","sqlite_stat1") ){ |
| 785 | Stmt q; |
| 786 | db_prepare(&q, |
| 787 | "SELECT tbl, idx, stat FROM repository.sqlite_stat1" |
| 788 | " ORDER BY tbl, idx"); |
| 789 | if( bTabular ){ |
| 790 | @ <table border="1" cellpadding="0" cellspacing="0"> |
| 791 | @ <tr><th>Table<th>Index<th>Stat |
| 792 | }else{ |
| 793 | @ <pre> |
| 794 | } |
| 795 | while( db_step(&q)==SQLITE_ROW ){ |
| 796 | const char *zTab = db_column_text(&q,0); |
| 797 | const char *zIdx = db_column_text(&q,1); |
| 798 | const char *zStat = db_column_text(&q,2); |
| 799 | char *zUrl = href("%R/repo_schema?n=%t",zTab); |
| 800 | if( bTabular ){ |
| 801 | @ <tr><td>%z(zUrl)%h(zTab)</a><td>%h(zIdx)<td>%h(zStat) |
| 802 | }else{ |
| 803 | @ INSERT INTO sqlite_stat1 \ |
| 804 | @ VALUES('%z(zUrl)%h(zTab)</a>','%h(zIdx)','%h(zStat)'); |
| 805 | } |
| 806 | } |
| 807 | if( bTabular ){ |
| 808 | @ </table> |
| 809 | }else{ |
| 810 | @ </pre> |
| 811 | } |
| 812 | db_finalize(&q); |
| 813 | } |
| 814 | style_finish_page(); |
| 815 | } |
| 816 | |
| 817 |