/ Check-in [42f07775]
Login

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

Overview
Comment:Fix the CSV virtual table extension so that it works when the default character is unsigned.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 42f07775556758754e92e29a759d200d0d81d16eee83ab982b840db11292f834
User & Date: drh 2017-09-18 00:18:31
Context
2017-09-18
16:28
Add extension "mmapwarm.c". Provides function sqlite3_mmap_warm(), used to "warm up" the memory mapping used by SQLite in mmap mode to access db file content. check-in: d4a30b91 user: dan tags: mmap-warm
09:40
The out-of-bounds read on recovery fix of check-in [378afa16381a222a] caused problems for some corner-case error conditions. This alternative fix appears to work better. check-in: 74f399d8 user: drh tags: trunk
08:51
Merge latest trunk changes with this branch. Leaf check-in: 2e573350 user: dan tags: shared-mapping-hack
00:18
Fix the CSV virtual table extension so that it works when the default character is unsigned. check-in: 42f07775 user: drh tags: trunk
2017-09-17
19:45
Do not make the assumption (as check-in [4da49a95c0f07] incorrectly did) that the ExprList returned by sqlite3ExprListDup() would never be passed into sqlite3ExprListAppend(). Include a new test case that shows this sometimes does happen. check-in: 29227d00 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/csv.c.

    74     74   struct CsvReader {
    75     75     FILE *in;              /* Read the CSV text from this input stream */
    76     76     char *z;               /* Accumulated text for a field */
    77     77     int n;                 /* Number of bytes in z */
    78     78     int nAlloc;            /* Space allocated for z[] */
    79     79     int nLine;             /* Current line number */
    80     80     int bNotFirst;         /* True if prior text has been seen */
    81         -  char cTerm;            /* Character that terminated the most recent field */
           81  +  int cTerm;             /* Character that terminated the most recent field */
    82     82     size_t iIn;            /* Next unread character in the input buffer */
    83     83     size_t nIn;            /* Number of characters in the input buffer */
    84     84     char *zIn;             /* The input buffer */
    85     85     char zErr[CSV_MXERR];  /* Error message */
    86     86   };
    87     87   
    88     88   /* Initialize a CsvReader object */
................................................................................
   162    162   
   163    163   /* Return the next character of input.  Return EOF at end of input. */
   164    164   static int csv_getc(CsvReader *p){
   165    165     if( p->iIn >= p->nIn ){
   166    166       if( p->in!=0 ) return csv_getc_refill(p);
   167    167       return EOF;
   168    168     }
   169         -  return p->zIn[p->iIn++];
          169  +  return ((unsigned char*)p->zIn)[p->iIn++];
   170    170   }
   171    171   
   172    172   /* Increase the size of p->z and append character c to the end. 
   173    173   ** Return 0 on success and non-zero if there is an OOM error */
   174    174   static CSV_NOINLINE int csv_resize_and_append(CsvReader *p, char c){
   175    175     char *zNew;
   176    176     int nNew = p->nAlloc*2 + 100;

Changes to test/releasetest.tcl.

   110    110       -DSQLITE_ENABLE_OVERSIZE_CELL_CHECK=1
   111    111       -DSQLITE_ENABLE_STAT4
   112    112       -DSQLITE_ENABLE_STMT_SCANSTATUS
   113    113       --enable-json1 --enable-fts5 --enable-session
   114    114     }
   115    115     "Debug-One" {
   116    116       --disable-shared
   117         -    -O2
          117  +    -O2 -funsigned-char
   118    118       -DSQLITE_DEBUG=1
   119    119       -DSQLITE_MEMDEBUG=1
   120    120       -DSQLITE_MUTEX_NOOP=1
   121    121       -DSQLITE_TCL_DEFAULT_FULLMUTEX=1
   122    122       -DSQLITE_ENABLE_FTS3=1
   123    123       -DSQLITE_ENABLE_RTREE=1
   124    124       -DSQLITE_ENABLE_MEMSYS5=1