/ Check-in [907fd3aa]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Always load the schema before starting tab-completion.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental-namelist
Files: files | file ages | folders
SHA3-256: 907fd3aab6205ac042d60c6455418a99b45efe954b3510597d54462cdbd12bfd
User & Date: drh 2017-07-06 22:40:47
Context
2017-07-07
14:54
Fix an obsolete comment on the sqlite3_namelist() function implementation. Closed-Leaf check-in: f4229857 user: drh tags: experimental-namelist
2017-07-06
22:40
Always load the schema before starting tab-completion. check-in: 907fd3aa user: drh tags: experimental-namelist
20:08
Tab-completion now also works using readline/editline. check-in: c906739f user: drh tags: experimental-namelist
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

  3605   3605   */
  3606   3606   static char *readline_completion_generator(const char *text, int state){
  3607   3607     static char **azCompletions = 0;
  3608   3608     static int iCompletion = 0;
  3609   3609     char *zRet;
  3610   3610     if( state==0 ){
  3611   3611       sqlite3_free(azCompletions);
         3612  +    sqlite3_exec(globalDb, "PRAGMA page_count", 0, 0, 0); /* Load the schema */
  3612   3613       azCompletions = sqlite3_namelist(globalDb, text, -1, 0);
  3613   3614       iCompletion = 0;
  3614   3615     }
  3615   3616     zRet = azCompletions[iCompletion++];
  3616   3617     if( zRet==0 ){
  3617   3618       sqlite3_free(azCompletions);
  3618   3619       azCompletions = 0;
................................................................................
  3636   3637     char **az;
  3637   3638     char zBuf[1000];
  3638   3639     if( nLine>sizeof(zBuf)-30 ) return;
  3639   3640     if( zLine[0]=='.' ) return;
  3640   3641     for(i=nLine-1; i>=0 && (isalnum(zLine[i]) || zLine[i]=='_'); i--){}
  3641   3642     if( i==nLine-1 ) return;
  3642   3643     iStart = i+1;
         3644  +  sqlite3_exec(globalDb, "PRAGMA page_count", 0, 0, 0); /* Load the schema */
  3643   3645     az = sqlite3_namelist(globalDb, &zLine[iStart], -1, &n);
  3644   3646     if( n>0 ){
  3645   3647       qsort(az, n, sizeof(az[0]),(int(*)(const void*,const void*))sqlite3_stricmp);
  3646   3648       memcpy(zBuf, zLine, iStart);
  3647   3649       for(i=0; az[i]; i++){
  3648   3650         n = (int)strlen(az[i]);
  3649   3651         if( iStart+n+1 >= sizeof(zBuf) ) continue;