/ 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 Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.

3605
3606
3607
3608
3609
3610
3611

3612
3613
3614
3615
3616
3617
3618
....
3636
3637
3638
3639
3640
3641
3642

3643
3644
3645
3646
3647
3648
3649
*/
static char *readline_completion_generator(const char *text, int state){
  static char **azCompletions = 0;
  static int iCompletion = 0;
  char *zRet;
  if( state==0 ){
    sqlite3_free(azCompletions);

    azCompletions = sqlite3_namelist(globalDb, text, -1, 0);
    iCompletion = 0;
  }
  zRet = azCompletions[iCompletion++];
  if( zRet==0 ){
    sqlite3_free(azCompletions);
    azCompletions = 0;
................................................................................
  char **az;
  char zBuf[1000];
  if( nLine>sizeof(zBuf)-30 ) return;
  if( zLine[0]=='.' ) return;
  for(i=nLine-1; i>=0 && (isalnum(zLine[i]) || zLine[i]=='_'); i--){}
  if( i==nLine-1 ) return;
  iStart = i+1;

  az = sqlite3_namelist(globalDb, &zLine[iStart], -1, &n);
  if( n>0 ){
    qsort(az, n, sizeof(az[0]),(int(*)(const void*,const void*))sqlite3_stricmp);
    memcpy(zBuf, zLine, iStart);
    for(i=0; az[i]; i++){
      n = (int)strlen(az[i]);
      if( iStart+n+1 >= sizeof(zBuf) ) continue;







>







 







>







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