SQLite

Check-in [9e489a71f2]
Login

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

Overview
Comment:Cleaner code and additional comments on the handling of 8+3 filenames when trying to find the name of a database file based on its journal filename, in the unix VFS.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9e489a71f2aeb1f13f9ca6f106b9144d07ca25aa
User & Date: drh 2015-12-03 20:42:28.920
Context
2015-12-03
20:50
Make the SQLITE_ENABLE_8_3_NAMES compile-time option available to sqlite3_compileoption_used(). (check-in: 06338201f3 user: drh tags: trunk)
20:42
Cleaner code and additional comments on the handling of 8+3 filenames when trying to find the name of a database file based on its journal filename, in the unix VFS. (check-in: 9e489a71f2 user: drh tags: trunk)
13:43
Make the sqlite3_status64(), sqlite3_strlike(), and sqlite3_db_cacheflush() APIs available to loadable extensions. (check-in: a78e865607 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_unix.c.
5517
5518
5519
5520
5521
5522
5523

5524



5525
5526
5527


5528
5529
5530

5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
    **   "<path to db>-journalNN"
    **   "<path to db>-walNN"
    **
    ** where NN is a decimal number. The NN naming schemes are 
    ** used by the test_multiplex.c module.
    */
    nDb = sqlite3Strlen30(zPath) - 1; 

#ifdef SQLITE_ENABLE_8_3_NAMES



    while( nDb>0 && sqlite3Isalnum(zPath[nDb]) ) nDb--;
    if( nDb==0 || zPath[nDb]!='-' ) return SQLITE_OK;
#else


    while( zPath[nDb]!='-' ){
      assert( nDb>0 );
      assert( zPath[nDb]!='\n' );

      nDb--;
    }
#endif
    memcpy(zDb, zPath, nDb);
    zDb[nDb] = '\0';

    if( 0==osStat(zDb, &sStat) ){
      *pMode = sStat.st_mode & 0777;
      *pUid = sStat.st_uid;
      *pGid = sStat.st_gid;







>
|
>
>
>
|
<

>
>
|
<
<
>


<







5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529

5530
5531
5532
5533


5534
5535
5536

5537
5538
5539
5540
5541
5542
5543
    **   "<path to db>-journalNN"
    **   "<path to db>-walNN"
    **
    ** where NN is a decimal number. The NN naming schemes are 
    ** used by the test_multiplex.c module.
    */
    nDb = sqlite3Strlen30(zPath) - 1; 
    while( zPath[nDb]!='-' ){
#ifndef SQLITE_ENABLE_8_3_NAMES
      /* In the normal case (8+3 filenames disabled) the journal filename
      ** is guaranteed to contain a '-' character. */
      assert( nDb>0 );
      assert( sqlite3Isalnum(zPath[nDb]) );

#else
      /* If 8+3 names are possible, then the journal file might not contain
      ** a '-' character.  So check for that case and return early. */
      if( nDb==0 || zPath[nDb]=='.' ) return SQLITE_OK;


#endif
      nDb--;
    }

    memcpy(zDb, zPath, nDb);
    zDb[nDb] = '\0';

    if( 0==osStat(zDb, &sStat) ){
      *pMode = sStat.st_mode & 0777;
      *pUid = sStat.st_uid;
      *pGid = sStat.st_gid;