Fossil SCM

Improvements to the /admin_sql page.

drh 2022-02-11 16:00 trunk
Commit 6325f81d0605d7acf3002923c499d612b26f44f68b04d72e05899387f8cb44fb
1 file changed +3 -4
+3 -4
--- src/setup.c
+++ src/setup.c
@@ -1731,13 +1731,11 @@
17311731
zQ = sqlite3_mprintf(
17321732
"SELECT sql FROM repository.sqlite_schema"
17331733
" WHERE sql IS NOT NULL ORDER BY name");
17341734
go = 1;
17351735
}else if( P("tablelist") ){
1736
- zQ = sqlite3_mprintf(
1737
- "SELECT name FROM repository.sqlite_schema WHERE type='table'"
1738
- " ORDER BY name");
1736
+ zQ = sqlite3_mprintf("SELECT*FROM pragma_table_list ORDER BY schema, name");
17391737
go = 1;
17401738
}
17411739
if( go ){
17421740
sqlite3_stmt *pStmt;
17431741
int rc;
@@ -1746,10 +1744,11 @@
17461744
int nRow = 0;
17471745
int i;
17481746
@ <hr />
17491747
login_verify_csrf_secret();
17501748
sqlite3_set_authorizer(g.db, raw_sql_query_authorizer, 0);
1749
+ search_sql_setup(g.db);
17511750
rc = sqlite3_prepare_v2(g.db, zQ, -1, &pStmt, &zTail);
17521751
if( rc!=SQLITE_OK ){
17531752
@ <div class="generalError">%h(sqlite3_errmsg(g.db))</div>
17541753
sqlite3_finalize(pStmt);
17551754
}else if( pStmt==0 ){
@@ -1759,11 +1758,11 @@
17591758
rc = sqlite3_finalize(pStmt);
17601759
if( rc ){
17611760
@ <div class="generalError">%h(sqlite3_errmsg(g.db))</div>
17621761
}
17631762
}else{
1764
- @ <table border=1>
1763
+ @ <table border="1" cellpadding="4" cellspacing="0">
17651764
while( sqlite3_step(pStmt)==SQLITE_ROW ){
17661765
if( nRow==0 ){
17671766
@ <tr>
17681767
for(i=0; i<nCol; i++){
17691768
@ <th>%h(sqlite3_column_name(pStmt, i))</th>
17701769
--- src/setup.c
+++ src/setup.c
@@ -1731,13 +1731,11 @@
1731 zQ = sqlite3_mprintf(
1732 "SELECT sql FROM repository.sqlite_schema"
1733 " WHERE sql IS NOT NULL ORDER BY name");
1734 go = 1;
1735 }else if( P("tablelist") ){
1736 zQ = sqlite3_mprintf(
1737 "SELECT name FROM repository.sqlite_schema WHERE type='table'"
1738 " ORDER BY name");
1739 go = 1;
1740 }
1741 if( go ){
1742 sqlite3_stmt *pStmt;
1743 int rc;
@@ -1746,10 +1744,11 @@
1746 int nRow = 0;
1747 int i;
1748 @ <hr />
1749 login_verify_csrf_secret();
1750 sqlite3_set_authorizer(g.db, raw_sql_query_authorizer, 0);
 
1751 rc = sqlite3_prepare_v2(g.db, zQ, -1, &pStmt, &zTail);
1752 if( rc!=SQLITE_OK ){
1753 @ <div class="generalError">%h(sqlite3_errmsg(g.db))</div>
1754 sqlite3_finalize(pStmt);
1755 }else if( pStmt==0 ){
@@ -1759,11 +1758,11 @@
1759 rc = sqlite3_finalize(pStmt);
1760 if( rc ){
1761 @ <div class="generalError">%h(sqlite3_errmsg(g.db))</div>
1762 }
1763 }else{
1764 @ <table border=1>
1765 while( sqlite3_step(pStmt)==SQLITE_ROW ){
1766 if( nRow==0 ){
1767 @ <tr>
1768 for(i=0; i<nCol; i++){
1769 @ <th>%h(sqlite3_column_name(pStmt, i))</th>
1770
--- src/setup.c
+++ src/setup.c
@@ -1731,13 +1731,11 @@
1731 zQ = sqlite3_mprintf(
1732 "SELECT sql FROM repository.sqlite_schema"
1733 " WHERE sql IS NOT NULL ORDER BY name");
1734 go = 1;
1735 }else if( P("tablelist") ){
1736 zQ = sqlite3_mprintf("SELECT*FROM pragma_table_list ORDER BY schema, name");
 
 
1737 go = 1;
1738 }
1739 if( go ){
1740 sqlite3_stmt *pStmt;
1741 int rc;
@@ -1746,10 +1744,11 @@
1744 int nRow = 0;
1745 int i;
1746 @ <hr />
1747 login_verify_csrf_secret();
1748 sqlite3_set_authorizer(g.db, raw_sql_query_authorizer, 0);
1749 search_sql_setup(g.db);
1750 rc = sqlite3_prepare_v2(g.db, zQ, -1, &pStmt, &zTail);
1751 if( rc!=SQLITE_OK ){
1752 @ <div class="generalError">%h(sqlite3_errmsg(g.db))</div>
1753 sqlite3_finalize(pStmt);
1754 }else if( pStmt==0 ){
@@ -1759,11 +1758,11 @@
1758 rc = sqlite3_finalize(pStmt);
1759 if( rc ){
1760 @ <div class="generalError">%h(sqlite3_errmsg(g.db))</div>
1761 }
1762 }else{
1763 @ <table border="1" cellpadding="4" cellspacing="0">
1764 while( sqlite3_step(pStmt)==SQLITE_ROW ){
1765 if( nRow==0 ){
1766 @ <tr>
1767 for(i=0; i<nCol; i++){
1768 @ <th>%h(sqlite3_column_name(pStmt, i))</th>
1769

Keyboard Shortcuts

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