sqllogictest

Check-in [6897209ec7]
Login

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

Overview
Comment:Change the hash format to show the number of rows hashed.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6897209ec70159a57e6ce4ec29bcf512fadcb701
User & Date: drh 2008-12-01 20:39:48.000
Context
2008-12-01
20:41
Fix the select2.test output. check-in: 8d24867c8a user: drh tags: trunk
20:39
Change the hash format to show the number of rows hashed. check-in: 6897209ec7 user: drh tags: trunk
20:33
Add the select2 test. Similar to select1 but adds NULL values and omits the ORDER BY clauses. check-in: 37156697d4 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/sqllogictest.c.
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
  int rc;                              /* Result code from subroutine call */
  int nErr = 0;                        /* Number of errors */
  int nCmd = 0;                        /* Number of SQL statements processed */
  int nResult;                         /* Number of query results */
  char **azResult;                     /* Query result vector */
  Script sScript;                      /* Script parsing status */
  FILE *in;                            /* For reading script */
  int hashThreshold = 0;               /* Hash result if this long or longer */
  

  /* Add calls to the registration procedures for new database engine
  ** interfaces here
  */
  registerSqlite();
#ifndef OMIT_ODBC







|







256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
  int rc;                              /* Result code from subroutine call */
  int nErr = 0;                        /* Number of errors */
  int nCmd = 0;                        /* Number of SQL statements processed */
  int nResult;                         /* Number of query results */
  char **azResult;                     /* Query result vector */
  Script sScript;                      /* Script parsing status */
  FILE *in;                            /* For reading script */
  int hashThreshold = 0 ;              /* Hash result if this long or longer */
  

  /* Add calls to the registration procedures for new database engine
  ** interfaces here
  */
  registerSqlite();
#ifndef OMIT_ODBC
408
409
410
411
412
413
414

415
416
417
418
419
420
421
        fprintf(stderr, "%s:%d: statement error\n",
                zScriptFile, sScript.startLine);
        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);







>







408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
        fprintf(stderr, "%s:%d: statement error\n",
                zScriptFile, sScript.startLine);
        nErr++;
      }
    }else if( strcmp(sScript.azToken[0],"query")==0 ){
      int k = 0;
      int c;
      char zHash[100];

      /* 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);
477
478
479
480
481
482
483


484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532

      /* Hash the results if we are over the hash threshold */
      if( hashThreshold>0 && nResult>hashThreshold ){
        for(i=0; i<nResult; i++){
          md5_add(azResult[i]);
          md5_add("\n");
        }


      }

      if( verifyMode ){
        /* In verify mode, first skip over the ---- line if we are still
        ** pointing at it. */
        if( strcmp(sScript.zLine, "----")==0 ) nextLine(&sScript);

        /* Compare subsequent lines of the script against the results
        ** from the query.  Report an error if any differences are found.
        */
        if( hashThreshold==0 || nResult<=hashThreshold ){
          for(i=0; i<nResult && sScript.zLine[0]; nextLine(&sScript), i++){
            if( strcmp(sScript.zLine, azResult[i])!=0 ){
              fprintf(stderr,"%s:%d: wrong result\n", zScriptFile,
                      sScript.nLine);
              nErr++;
              break;
            }
          }
        }else{
          if( strcmp(sScript.zLine, md5_finish())!=0 ){
            fprintf(stderr, "%s:%d: wrong result hash\n",
                    zScriptFile, sScript.nLine);
            nErr++;
          }
        }
      }else{
        /* In completion mode, first make sure we have output an ---- line.
        ** Output such a line now if we have not already done so.
        */
        if( strcmp(sScript.zLine, "----")!=0 ){
          printf("----\n");
        }

        /* Output the results obtained by running the query
        */
        if( hashThreshold==0 || nResult<=hashThreshold ){
          for(i=0; i<nResult; i++){
            printf("%s\n", azResult[i]);
          }
        }else{
          printf("%s\n", md5_finish());
        }
        printf("\n");

        /* Skip over any existing results.  They will be ignored.
        */
        sScript.copyFlag = 0;
        while( sScript.zLine[0]!=0 && sScript.iCur<sScript.iEnd ){







>
>




















|




















|







478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535

      /* Hash the results if we are over the hash threshold */
      if( hashThreshold>0 && nResult>hashThreshold ){
        for(i=0; i<nResult; i++){
          md5_add(azResult[i]);
          md5_add("\n");
        }
        sqlite3_snprintf(sizeof(zHash), zHash,
                         "%d rows hashing to %s", nResult, md5_finish());
      }

      if( verifyMode ){
        /* In verify mode, first skip over the ---- line if we are still
        ** pointing at it. */
        if( strcmp(sScript.zLine, "----")==0 ) nextLine(&sScript);

        /* Compare subsequent lines of the script against the results
        ** from the query.  Report an error if any differences are found.
        */
        if( hashThreshold==0 || nResult<=hashThreshold ){
          for(i=0; i<nResult && sScript.zLine[0]; nextLine(&sScript), i++){
            if( strcmp(sScript.zLine, azResult[i])!=0 ){
              fprintf(stderr,"%s:%d: wrong result\n", zScriptFile,
                      sScript.nLine);
              nErr++;
              break;
            }
          }
        }else{
          if( strcmp(sScript.zLine, zHash)!=0 ){
            fprintf(stderr, "%s:%d: wrong result hash\n",
                    zScriptFile, sScript.nLine);
            nErr++;
          }
        }
      }else{
        /* In completion mode, first make sure we have output an ---- line.
        ** Output such a line now if we have not already done so.
        */
        if( strcmp(sScript.zLine, "----")!=0 ){
          printf("----\n");
        }

        /* Output the results obtained by running the query
        */
        if( hashThreshold==0 || nResult<=hashThreshold ){
          for(i=0; i<nResult; i++){
            printf("%s\n", azResult[i]);
          }
        }else{
          printf("%s\n", zHash);
        }
        printf("\n");

        /* Skip over any existing results.  They will be ignored.
        */
        sScript.copyFlag = 0;
        while( sScript.zLine[0]!=0 && sScript.iCur<sScript.iEnd ){
Changes to test/select2.test.

more than 10,000 changes