sqllogictest
Check-in [9c52972f34]
Not logged in

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

Overview
Comment:Change the typestring character for strings from "S" to "T".
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9c52972f3426338d6c727155112a069dbbb3ebcd
User & Date: drh 2008-11-29 22:50:21
Context
2008-11-30
00:37
First sample prototype script with its generator. check-in: c7bfa7e3cf user: drh tags: trunk
2008-11-29
22:50
Change the typestring character for strings from "S" to "T". check-in: 9c52972f34 user: drh tags: trunk
22:31
The sqllogictest program builds and runs on Linux. check-in: 2cffc96fd2 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to about.wiki.

148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
of thinking about completion mode is that it copies the script from
input to output, replacing all "----" lines and subsequent result values
with the actual results from running the query.

The <type-string> argument to the query statement is a short string
that specifies the number of result columns and the expected datatype
of each result column.  There is one character in the <type-string>
for each result column.  The characters is "S" for a string result,
"I" for an integer result, and "R" for a floating-point result.

The <sort-mode> argument is optional.  If included, it must be
one of "nosort", "rowsort", or "valuesort".  The default is "nosort".
In nosort mode, the results appear in esactly the order in which they
were received from the database engine.  The nosort mode should only
be used on queries that have an ORDER BY clause or which only have a







|







148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
of thinking about completion mode is that it copies the script from
input to output, replacing all "----" lines and subsequent result values
with the actual results from running the query.

The <type-string> argument to the query statement is a short string
that specifies the number of result columns and the expected datatype
of each result column.  There is one character in the <type-string>
for each result column.  The characters is "T" for a text result,
"I" for an integer result, and "R" for a floating-point result.

The <sort-mode> argument is optional.  If included, it must be
one of "nosort", "rowsort", or "valuesort".  The default is "nosort".
In nosort mode, the results appear in esactly the order in which they
were received from the database engine.  The nosort mode should only
be used on queries that have an ORDER BY clause or which only have a

Changes to src/sqlite3.c.

29405
29406
29407
29408
29409
29410
29411


29412
29413
29414
29415
29416
29417
29418
  /* The random check-hash initialiser */ 
  sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit);
  put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit);
  /* The initial database size */
  put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbSize);
  /* The assumed sector size for this process */
  put32bits(&zHeader[sizeof(aJournalMagic)+12], pPager->sectorSize);


  if( pPager->journalHdr==0 ){
    /* The page size */
    put32bits(&zHeader[sizeof(aJournalMagic)+16], pPager->pageSize);
  }

  for(nWrite=0; rc==SQLITE_OK&&nWrite<JOURNAL_HDR_SZ(pPager); nWrite+=nHeader){
    IOTRACE(("JHDR %p %lld %d\n", pPager, pPager->journalHdr, nHeader))







>
>







29405
29406
29407
29408
29409
29410
29411
29412
29413
29414
29415
29416
29417
29418
29419
29420
  /* The random check-hash initialiser */ 
  sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit);
  put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit);
  /* The initial database size */
  put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbSize);
  /* The assumed sector size for this process */
  put32bits(&zHeader[sizeof(aJournalMagic)+12], pPager->sectorSize);
  memset(&zHeader[sizeof(aJournalMagic)+16], 0,
         nHeader-(sizeof(aJournalMagic)+16));
  if( pPager->journalHdr==0 ){
    /* The page size */
    put32bits(&zHeader[sizeof(aJournalMagic)+16], pPager->pageSize);
  }

  for(nWrite=0; rc==SQLITE_OK&&nWrite<JOURNAL_HDR_SZ(pPager); nWrite+=nHeader){
    IOTRACE(("JHDR %p %lld %d\n", pPager, pPager->journalHdr, nHeader))

Changes to src/sqllogictest.c.

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
...
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
...
746
747
748
749
750
751
752
753
754
755
756

757
758
  while( sqlite3_step(pStmt)==SQLITE_ROW ){
    int i;
    for(i=0; zType[i]; i++){
      if( sqlite3_column_type(pStmt, i)==SQLITE_NULL ){
        appendValue(&res, "<NULL>");
      }else{
        switch( zType[i] ){
          case 'S': {
            const char *zValue = (const char*)sqlite3_column_text(pStmt, i);
            char *z;
            if( zValue[0]==0 ) zValue = "<EMPTY-STRING>";
            appendValue(&res, zValue);

            /* Convert non-printing and control characters to '@' */
            z = res.azValue[res.nUsed-1];
................................................................................
        nErr++;
      }
    }else if( strcmp(sScript.azToken[0],"query")==0 ){
      int k = 0;
      int c;

      /* Verify that the type string consists of one or more characters
      ** from the set "SIR". */
      for(k=0; (c = sScript.azToken[1][k])!=0; k++){
        if( c!='S' && c!='I' && c!='R' ){
          fprintf(stderr, "%s:%d: unknown type character '%c' in type string\n",
                  zScriptFile, sScript.startLine, c);
          nErr++;
          break;
        }
      }
      if( c!=0 ) continue;
................................................................................
  if( rc ){
    fprintf(stderr, "%s: disconnection from database failed\n", argv[0]);
    nErr++;
  }

  /* Report the number of errors and quit.
  */
  if( verifyMode ){
    printf("%s: %d errors out of %d SQL statement\n",
           zScriptFile, nErr, nCmd);
  }

  return nErr; 
}







|







 







|

|







 







|



>


166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
...
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
...
746
747
748
749
750
751
752
753
754
755
756
757
758
759
  while( sqlite3_step(pStmt)==SQLITE_ROW ){
    int i;
    for(i=0; zType[i]; i++){
      if( sqlite3_column_type(pStmt, i)==SQLITE_NULL ){
        appendValue(&res, "<NULL>");
      }else{
        switch( zType[i] ){
          case 'T': {
            const char *zValue = (const char*)sqlite3_column_text(pStmt, i);
            char *z;
            if( zValue[0]==0 ) zValue = "<EMPTY-STRING>";
            appendValue(&res, zValue);

            /* Convert non-printing and control characters to '@' */
            z = res.azValue[res.nUsed-1];
................................................................................
        nErr++;
      }
    }else if( strcmp(sScript.azToken[0],"query")==0 ){
      int k = 0;
      int c;

      /* Verify that the type string consists of one or more characters
      ** from the set "TIR". */
      for(k=0; (c = sScript.azToken[1][k])!=0; k++){
        if( c!='T' && c!='I' && c!='R' ){
          fprintf(stderr, "%s:%d: unknown type character '%c' in type string\n",
                  zScriptFile, sScript.startLine, c);
          nErr++;
          break;
        }
      }
      if( c!=0 ) continue;
................................................................................
  if( rc ){
    fprintf(stderr, "%s: disconnection from database failed\n", argv[0]);
    nErr++;
  }

  /* Report the number of errors and quit.
  */
  if( verifyMode || nErr ){
    printf("%s: %d errors out of %d SQL statement\n",
           zScriptFile, nErr, nCmd);
  }
  free(zScript);
  return nErr; 
}