Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Combine the implementations of the ".tables" and ".indexes" commands in the command-line shell. The ".indexes" command now puts the indexes in multiple columns, just like ".tables" and shows all indexes in all attached databases. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
def29333655691c7d54451193be13445 |
User & Date: | drh 2016-12-24 21:32:40.591 |
Context
2016-12-26
| ||
00:15 | Enhance the fuzztest utility with the --prng-seed option. Always reseed the PRNG prior to each test. (check-in: 8c5187f69d user: drh tags: trunk) | |
2016-12-24
| ||
21:32 | Combine the implementations of the ".tables" and ".indexes" commands in the command-line shell. The ".indexes" command now puts the indexes in multiple columns, just like ".tables" and shows all indexes in all attached databases. (check-in: def2933365 user: drh tags: trunk) | |
19:37 | The schema name "main" is always an acceptable alias for the primary database even if the primary database is renamed using SQLITE_DBCONFIG_MAINDBNAME. (check-in: 2f481b854f user: drh tags: trunk) | |
Changes
Changes to src/shell.c.
︙ | ︙ | |||
4086 4087 4088 4089 4090 4091 4092 | xCloser(sCtx.in); sqlite3_free(sCtx.z); sqlite3_finalize(pStmt); if( needCommit ) sqlite3_exec(p->db, "COMMIT", 0, 0, 0); }else | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 | xCloser(sCtx.in); sqlite3_free(sCtx.z); sqlite3_finalize(pStmt); if( needCommit ) sqlite3_exec(p->db, "COMMIT", 0, 0, 0); }else #ifndef SQLITE_UNTESTABLE if( c=='i' && strncmp(azArg[0], "imposter", n)==0 ){ char *zSql; char *zCollist = 0; sqlite3_stmt *pStmt; int tnum = 0; int i; |
︙ | ︙ | |||
4955 4956 4957 4958 4959 4960 4961 | display_stats(p->db, p, 0); }else{ raw_printf(stderr, "Usage: .stats ?on|off?\n"); rc = 1; } }else | | > > > > | | | | | > > > > > > > > > > > > > | < < < < < < < > > > > > > | 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 | display_stats(p->db, p, 0); }else{ raw_printf(stderr, "Usage: .stats ?on|off?\n"); rc = 1; } }else if( (c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0) || (c=='i' && (strncmp(azArg[0], "indices", n)==0 || strncmp(azArg[0], "indexes", n)==0) ) ){ sqlite3_stmt *pStmt; char **azResult; int nRow, nAlloc; char *zSql = 0; int ii; open_db(p, 0); rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0); if( rc ) return shellDatabaseError(p->db); /* Create an SQL statement to query for the list of tables in the ** main and all attached databases where the table name matches the ** LIKE pattern bound to variable "?1". */ if( c=='t' ){ zSql = sqlite3_mprintf( "SELECT name FROM sqlite_master" " WHERE type IN ('table','view')" " AND name NOT LIKE 'sqlite_%%'" " AND name LIKE ?1"); }else if( nArg>2 ){ /* It is an historical accident that the .indexes command shows an error ** when called with the wrong number of arguments whereas the .tables ** command does not. */ raw_printf(stderr, "Usage: .indexes ?LIKE-PATTERN?\n"); rc = 1; goto meta_command_exit; }else{ zSql = sqlite3_mprintf( "SELECT name FROM sqlite_master" " WHERE type='index'" " AND tbl_name LIKE ?1"); } for(ii=0; zSql && sqlite3_step(pStmt)==SQLITE_ROW; ii++){ const char *zDbName = (const char*)sqlite3_column_text(pStmt, 1); if( zDbName==0 || ii==0 ) continue; if( c=='t' ){ zSql = sqlite3_mprintf( "%z UNION ALL " "SELECT '%q.' || name FROM \"%w\".sqlite_master" " WHERE type IN ('table','view')" " AND name NOT LIKE 'sqlite_%%'" " AND name LIKE ?1", zSql, zDbName, zDbName); }else{ zSql = sqlite3_mprintf( "%z UNION ALL " "SELECT '%q.' || name FROM \"%w\".sqlite_master" " WHERE type='index'" " AND tbl_name LIKE ?1", zSql, zDbName, zDbName); } } rc = sqlite3_finalize(pStmt); if( zSql && rc==SQLITE_OK ){ zSql = sqlite3_mprintf("%z ORDER BY 1", zSql); if( zSql ) rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); } |
︙ | ︙ |