Fossil SCM

Add "De-ANALYZE" buttons on the schema display pages.

drh 2024-01-01 19:35 trunk
Commit 1c64373d05145244813f2dc609e9c7a4e7cda90fb02eab6f5d37add2dbf222a5
1 file changed +14 -2
+14 -2
--- src/stat.c
+++ src/stat.c
@@ -723,10 +723,15 @@
723723
){
724724
if( P("analyze")!=0 ){
725725
db_multi_exec("ANALYZE \"%w\"", zArg);
726726
}else if( P("analyze200")!=0 ){
727727
db_multi_exec("PRAGMA analysis_limit=200; ANALYZE \"%w\"", zArg);
728
+ }else if( P("deanalyze")!=0 ){
729
+ db_unprotect(PROTECT_ALL);
730
+ db_multi_exec("DELETE FROM repository.sqlite_stat1"
731
+ " WHERE tbl LIKE %Q", zArg);
732
+ db_protect_pop();
728733
}
729734
}
730735
731736
style_set_current_feature("stat");
732737
style_header("Repository Schema");
@@ -773,11 +778,12 @@
773778
}
774779
}
775780
@ <hr><form method="POST">
776781
@ <input type="submit" name="analyze" value="Run ANALYZE"><br />
777782
@ <input type="submit" name="analyze200"\
778
- @ value="Run ANALYZE with limit=200">
783
+ @ value="Run ANALYZE with limit=200"><br />
784
+ @ <input type="submit" name="deanalyze" value="De-ANALYZE">
779785
@ </form>
780786
781787
style_finish_page();
782788
}
783789
@@ -794,10 +800,14 @@
794800
795801
if( P("analyze")!=0 && cgi_csrf_safe(1) ){
796802
db_multi_exec("ANALYZE");
797803
}else if( P("analyze200")!=0 && cgi_csrf_safe(1) ){
798804
db_multi_exec("PRAGMA analysis_limit=200; ANALYZE;");
805
+ }else if( P("deanalyze")!=0 && cgi_csrf_safe(1) ){
806
+ db_unprotect(PROTECT_ALL);
807
+ db_multi_exec("DELETE FROM repository.sqlite_stat1;");
808
+ db_protect_pop();
799809
}
800810
style_set_current_feature("stat");
801811
style_header("Repository STAT1 Table");
802812
style_adunit_config(ADUNIT_RIGHT_OK);
803813
style_submenu_element("Stat", "stat");
@@ -837,11 +847,13 @@
837847
if( bTabular ){
838848
@ <input type="hidden" name="tabular" value="1">
839849
}
840850
@ <input type="submit" name="analyze" value="Run ANALYZE"><br />
841851
@ <input type="submit" name="analyze200"\
842
- @ value="Run ANALYZE with limit=200">
852
+ @ value="Run ANALYZE with limit=200"><br>
853
+ @ <input type="submit" name="deanalyze"\
854
+ @ value="De-ANALYZE">
843855
@ </form>
844856
style_finish_page();
845857
}
846858
847859
/*
848860
--- src/stat.c
+++ src/stat.c
@@ -723,10 +723,15 @@
723 ){
724 if( P("analyze")!=0 ){
725 db_multi_exec("ANALYZE \"%w\"", zArg);
726 }else if( P("analyze200")!=0 ){
727 db_multi_exec("PRAGMA analysis_limit=200; ANALYZE \"%w\"", zArg);
 
 
 
 
 
728 }
729 }
730
731 style_set_current_feature("stat");
732 style_header("Repository Schema");
@@ -773,11 +778,12 @@
773 }
774 }
775 @ <hr><form method="POST">
776 @ <input type="submit" name="analyze" value="Run ANALYZE"><br />
777 @ <input type="submit" name="analyze200"\
778 @ value="Run ANALYZE with limit=200">
 
779 @ </form>
780
781 style_finish_page();
782 }
783
@@ -794,10 +800,14 @@
794
795 if( P("analyze")!=0 && cgi_csrf_safe(1) ){
796 db_multi_exec("ANALYZE");
797 }else if( P("analyze200")!=0 && cgi_csrf_safe(1) ){
798 db_multi_exec("PRAGMA analysis_limit=200; ANALYZE;");
 
 
 
 
799 }
800 style_set_current_feature("stat");
801 style_header("Repository STAT1 Table");
802 style_adunit_config(ADUNIT_RIGHT_OK);
803 style_submenu_element("Stat", "stat");
@@ -837,11 +847,13 @@
837 if( bTabular ){
838 @ <input type="hidden" name="tabular" value="1">
839 }
840 @ <input type="submit" name="analyze" value="Run ANALYZE"><br />
841 @ <input type="submit" name="analyze200"\
842 @ value="Run ANALYZE with limit=200">
 
 
843 @ </form>
844 style_finish_page();
845 }
846
847 /*
848
--- src/stat.c
+++ src/stat.c
@@ -723,10 +723,15 @@
723 ){
724 if( P("analyze")!=0 ){
725 db_multi_exec("ANALYZE \"%w\"", zArg);
726 }else if( P("analyze200")!=0 ){
727 db_multi_exec("PRAGMA analysis_limit=200; ANALYZE \"%w\"", zArg);
728 }else if( P("deanalyze")!=0 ){
729 db_unprotect(PROTECT_ALL);
730 db_multi_exec("DELETE FROM repository.sqlite_stat1"
731 " WHERE tbl LIKE %Q", zArg);
732 db_protect_pop();
733 }
734 }
735
736 style_set_current_feature("stat");
737 style_header("Repository Schema");
@@ -773,11 +778,12 @@
778 }
779 }
780 @ <hr><form method="POST">
781 @ <input type="submit" name="analyze" value="Run ANALYZE"><br />
782 @ <input type="submit" name="analyze200"\
783 @ value="Run ANALYZE with limit=200"><br />
784 @ <input type="submit" name="deanalyze" value="De-ANALYZE">
785 @ </form>
786
787 style_finish_page();
788 }
789
@@ -794,10 +800,14 @@
800
801 if( P("analyze")!=0 && cgi_csrf_safe(1) ){
802 db_multi_exec("ANALYZE");
803 }else if( P("analyze200")!=0 && cgi_csrf_safe(1) ){
804 db_multi_exec("PRAGMA analysis_limit=200; ANALYZE;");
805 }else if( P("deanalyze")!=0 && cgi_csrf_safe(1) ){
806 db_unprotect(PROTECT_ALL);
807 db_multi_exec("DELETE FROM repository.sqlite_stat1;");
808 db_protect_pop();
809 }
810 style_set_current_feature("stat");
811 style_header("Repository STAT1 Table");
812 style_adunit_config(ADUNIT_RIGHT_OK);
813 style_submenu_element("Stat", "stat");
@@ -837,11 +847,13 @@
847 if( bTabular ){
848 @ <input type="hidden" name="tabular" value="1">
849 }
850 @ <input type="submit" name="analyze" value="Run ANALYZE"><br />
851 @ <input type="submit" name="analyze200"\
852 @ value="Run ANALYZE with limit=200"><br>
853 @ <input type="submit" name="deanalyze"\
854 @ value="De-ANALYZE">
855 @ </form>
856 style_finish_page();
857 }
858
859 /*
860

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button