/ Check-in [8d670973]
Login

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

Overview
Comment:Adjust filename creation in test_sqllog.c so that it uses leading zeros on counters, so that files appear in order when sorted lexicographically.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8d670973595bd01ffc9b2ab53b965e6d6d22c573
User & Date: drh 2017-01-04 14:53:53
Context
2017-01-05
07:58
Ensure that the sqlite3_value_text() interface returns a buffer that is long enough to hold the complete string plus the zero terminator even when the input is a zeroblob. Fix for a problem detected by OSS-Fuzz. check-in: 2dc7eeb5 user: drh tags: trunk
2017-01-04
20:13
Possible fix for [30027b61]. There may still be problems surrounding foreign key processing. check-in: 71ccb1f4 user: dan tags: replace-fix
14:53
Adjust filename creation in test_sqllog.c so that it uses leading zeros on counters, so that files appear in order when sorted lexicographically. check-in: 8d670973 user: drh tags: trunk
13:09
Performance enhancements in the printf implementation. check-in: 82e4001b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_sqllog.c.

   309    309       if( zInit==0 ){
   310    310         int rc;
   311    311         sqlite3 *copy = 0;
   312    312         int iDb;
   313    313   
   314    314         /* Generate a file-name to use for the copy of this database */
   315    315         iDb = sqllogglobal.iNextDb++;
   316         -      zInit = sqlite3_mprintf("%s_%d.db", sqllogglobal.zPrefix, iDb);
          316  +      zInit = sqlite3_mprintf("%s_%02d.db", sqllogglobal.zPrefix, iDb);
   317    317   
   318    318         /* Create the backup */
   319    319         assert( sqllogglobal.bRec==0 );
   320    320         sqllogglobal.bRec = 1;
   321    321         rc = sqlite3_open(zInit, &copy);
   322    322         if( rc==SQLITE_OK ){
   323    323           sqlite3_backup *pBak;
................................................................................
   372    372       /* If it is still NULL, have global.zPrefix point to a copy of 
   373    373       ** environment variable $ENVIRONMENT_VARIABLE1_NAME.  */
   374    374       if( sqllogglobal.zPrefix[0]==0 ){
   375    375         FILE *fd;
   376    376         char *zVar = getenv(ENVIRONMENT_VARIABLE1_NAME);
   377    377         if( zVar==0 || strlen(zVar)+10>=(sizeof(sqllogglobal.zPrefix)) ) return;
   378    378         sqlite3_snprintf(sizeof(sqllogglobal.zPrefix), sqllogglobal.zPrefix,
   379         -                        "%s/sqllog_%d", zVar, getProcessId());
          379  +                        "%s/sqllog_%05d", zVar, getProcessId());
   380    380         sqlite3_snprintf(sizeof(sqllogglobal.zIdx), sqllogglobal.zIdx,
   381    381                           "%s.idx", sqllogglobal.zPrefix);
   382    382         if( getenv(ENVIRONMENT_VARIABLE2_NAME) ){
   383    383           sqllogglobal.bReuse = atoi(getenv(ENVIRONMENT_VARIABLE2_NAME));
   384    384         }
   385    385         fd = fopen(sqllogglobal.zIdx, "w");
   386    386         if( fd ) fclose(fd);
   387    387       }
   388    388   
   389    389       /* Open the log file */
   390         -    zLog = sqlite3_mprintf("%s_%d.sql", sqllogglobal.zPrefix, p->iLog);
          390  +    zLog = sqlite3_mprintf("%s_%05d.sql", sqllogglobal.zPrefix, p->iLog);
   391    391       p->fd = fopen(zLog, "w");
   392    392       sqlite3_free(zLog);
   393    393       if( p->fd==0 ){
   394    394         sqlite3_log(SQLITE_IOERR, "sqllogOpenlog(): Failed to open log file");
   395    395       }
   396    396     }
   397    397   }