UnQL

Check-in [9432de00a5]
Login

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

Overview
Comment:Base test infrastructure working. Added "make test" to the makefile.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9432de00a59955404e4b39be6f6c2ffb59b5e4e9
User & Date: drh 2011-06-27 14:08:13
Context
2011-06-27
16:01
Begin adding support for the expression list in between SELECT and FROM. check-in: 6d55502945 user: drh tags: trunk
14:08
Base test infrastructure working. Added "make test" to the makefile. check-in: 9432de00a5 user: drh tags: trunk
12:49
Enhance the shell with parser and command tracing and "echo". check-in: d780db9196 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to main.mk.

68
69
70
71
72
73
74






75
76
77
78
79
80
81
   $(TOP)/src/xjd1.h \
   $(TOP)/src/xjd1Int.h

# This is the default Makefile target.
#
all:	xjd1







# The shell program
#
xjd1:	libxjd1.a $(TOP)/src/shell.c
	$(TCCX) -o xjd1 $(TOP)/src/shell.c libxjd1.a $(AUXLIB)

# The library
#







>
>
>
>
>
>







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
   $(TOP)/src/xjd1.h \
   $(TOP)/src/xjd1Int.h

# This is the default Makefile target.
#
all:	xjd1


# Run all tests
#
test:	xjd1
	./xjd1 $(TOP)/test/all.test

# The shell program
#
xjd1:	libxjd1.a $(TOP)/src/shell.c
	$(TCCX) -o xjd1 $(TOP)/src/shell.c libxjd1.a $(AUXLIB)

# The library
#

Changes to src/conn.c.

80
81
82
83
84
85
86














87
88
89
90
91
92
93
*/
int xjd1_errcode(xjd1 *pConn){
  return pConn ? pConn->errCode : XJD1_ERROR;
}
const char *xjd1_errmsg(xjd1 *pConn){
  if( pConn==0 ) return "out of memory";
  return xjd1StringText(&pConn->errMsg);














}

/* Remove a reference to a database connection.  When the last reference
** is removed and the database is closed, then memory is deallocated.
*/
PRIVATE void xjd1Unref(xjd1 *pConn){
  pConn->nRef--;







>
>
>
>
>
>
>
>
>
>
>
>
>
>







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
*/
int xjd1_errcode(xjd1 *pConn){
  return pConn ? pConn->errCode : XJD1_ERROR;
}
const char *xjd1_errmsg(xjd1 *pConn){
  if( pConn==0 ) return "out of memory";
  return xjd1StringText(&pConn->errMsg);
}
const char *xjd1_errcode_name(xjd1 *pConn){
  const char *z = "???";
  switch( xjd1_errcode(pConn) ){
    case XJD1_OK:        z = "OK";         break;
    case XJD1_ERROR:     z = "ERROR";      break;
    case XJD1_MISUSE:    z = "MISUSE";     break;
    case XJD1_NOMEM:     z = "NOMEM";      break;
    case XJD1_UNKNOWN:   z = "UNKNOWN";    break;
    case XJD1_SYNTAX:    z = "SYNTAX";     break;
    case XJD1_ROW:       z = "ROW";        break;
    case XJD1_DONE:      z = "DONE";       break;
  }
  return z;
}

/* Remove a reference to a database connection.  When the last reference
** is removed and the database is closed, then memory is deallocated.
*/
PRIVATE void xjd1Unref(xjd1 *pConn){
  pConn->nRef--;

Changes to src/shell.c.

202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
...
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
...
354
355
356
357
358
359
360













361


362
363
364
365
366
367
368
369
370
371







372
373
374
375
376
377
378
...
385
386
387
388
389
390
391

392
393
394
395
396
397
398
...
431
432
433
434
435
436
437











438
439
440
441
442
443
444
...
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473




474
475
476
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
...
532
533
534
535
536
537
538




539
540
541
542
543
544
545
...
562
563
564
565
566
567
568



569
570
571
572
573
**                characters.
**
**     [^...]     Matches one character not in the enclosed list.
**
**      '#'       Matches any sequence of one or more digits with an
**                optional + or - sign in front
*/
static int strglob(const char *zGlob, const char *z){
  int c, c2;
  int invert;
  int seen;

  while( (c = (*(zGlob++)))!=0 ){
    if( c=='*' ){
      while( (c=(*(zGlob++))) == '*' || c=='?' ){
        if( c=='?' && (*(z++))==0 ) return 0;
      }
      if( c==0 ){
        return 1;
      }else if( c=='[' ){
        while( *z && strglob(zGlob-1,z)==0 ){
          z++;
        }
        return (*z)!=0;
      }
      while( (c2 = (*(z++)))!=0 ){
        while( c2!=c ){
          c2 = *(z++);
          if( c2==0 ) return 0;
        }
        if( strglob(zGlob,z) ) return 1;
      }
      return 0;
    }else if( c=='?' ){
      if( (*(z++))==0 ) return 0;
    }else if( c=='[' ){
      int prior_c = 0;
      seen = 0;
................................................................................
      while( z[0]>='0' && z[0]<='9' ){ z++; }
    }else{
      if( c!=(*(z++)) ) return 0;
    }
  }
  return *z==0;
}

/*
** Command:  .result PATTERN
*/
static void shellResult(Shell *p, int argc, char **argv){
  if( argc>=2 ){
    char *zRes = xjd1StringText(&p->testOut);
    if( zRes==0 ) zRes = "";
    p->nTest++;
    if( strcmp(argv[1], zRes) ){
      p->nErr++;
      fprintf(stderr, " Test failed: %s\n Expected: [%s]\n      Got: [%s]\n",
        p->zTestCase, argv[1], zRes);
    }
  }
}
/*
** Command:  .glob PATTERN
*/
static void shellGlob(Shell *p, int argc, char **argv){
  if( argc>=2 ){
    char *zRes = xjd1StringText(&p->testOut);
    if( zRes==0 ) zRes = "";
    p->nTest++;
    if( strglob(argv[1], zRes) ){
      p->nErr++;
      fprintf(stderr, " Test failed: %s\n Expected: [%s]\n      Got: [%s]\n",
        p->zTestCase, argv[1], zRes);
    }
  }
}
/*
** Command:  .notglob PATTERN
*/
static void shellNotGlob(Shell *p, int argc, char **argv){
  if( argc>=2 ){
    char *zRes = xjd1StringText(&p->testOut);
    if( zRes==0 ) zRes = "";
    p->nTest++;
    if( strglob(argv[1], zRes)==0 ){
      p->nErr++;
      fprintf(stderr, " Test failed: %s\n Expected: [%s]\n      Got: [%s]\n",
        p->zTestCase, argv[1], zRes);
    }
  }
}

/*
** Command:  .open FILENAME
*/
static void shellOpenDB(Shell *p, int argc, char **argv){
  if( argc>=2 ){
................................................................................

/*
** Command:  .read FILENAME
** Read and process text from a file.
*/
static void shellRead(Shell *p, int argc, char **argv){
  if( argc>=2 ){













    processOneFile(p, argv[1]);


  }
}

/*
** Command:  .breakpoint
** A place to seet a breakpoint
*/
static void shellBreakpoint(Shell *p, int argc, char **argv){
  /* no-op */
}








/*
** Process a command intended for this shell - not for the database.
*/
static void processMetaCommand(Shell *p){
  char *z;
  int n;
................................................................................
    const char *zHelp;                  /* Help string */
  } cmds[] = {
    { "quit",       shellQuit,        ".quit"               },
    { "testcase",   shellTestcase,    ".testcase NAME"      },
    { "result",     shellResult,      ".result TEXT"        },
    { "glob",       shellGlob,        ".glob PATTERN"       },
    { "notglob",    shellNotGlob,     ".notglob PATTERN"    },

    { "read",       shellRead,        ".read FILENAME"      },
    { "open",       shellOpenDB,      ".open DATABASE"      },
    { "new",        shellNewDB,       ".new DATABASE"       },
    { "set",        shellSet,         ".set FLAG"           },
    { "clear",      shellClear,       ".clear FLAG"         },
    { "breakpoint", shellBreakpoint,  ".breakpoint"         },
  };
................................................................................
  if( i>=sizeof(cmds)/sizeof(cmds[0]) ){
    p->nErr++;
    fprintf(stderr, "%s:%d: unknown command \".%s\"\n", 
            p->zFile, p->nLine, azArg[0]);
  }
  xjd1StringTruncate(&p->inBuf);
}












/*
** Run a single statment.
*/
static void processOneStatement(Shell *p, const char *zCmd){
  xjd1_stmt *pStmt;
  int N, rc;
................................................................................
      rc = xjd1_stmt_step(pStmt);
      if( rc==XJD1_ROW ){
        const char *zValue;
        xjd1_stmt_value(pStmt, &zValue);
        if( p->zTestCase[0]==0 ){
          printf("%s\n", zValue);
        }else{
          if( xjd1StringLen(&p->testOut)>0 ){
            xjd1StringAppend(&p->testOut, " ", 1);
          }
          xjd1StringAppend(&p->testOut, zValue, -1);
        }
      }
    }while( rc==XJD1_ROW );
    xjd1_stmt_delete(pStmt);
  }else{




    fprintf(stderr, "%s:%d: ERROR: %s\n",
            p->zFile, p->nLine, xjd1_errmsg(p->pDb));
    p->nErr++;
  }
}

/*
** Process one or more database commands
*/
static void processScript(Shell *p){
  char *z, c;
  int i;
  if( p->pDb==0 ) return;




  while( xjd1StringLen(&p->inBuf) ){
    z = xjd1StringText(&p->inBuf);














    for(i=0; z[i]; i++){
      if( z[i]!=';' ) continue;
      c = z[i+1];
      z[i+1] = 0;
      if( !xjd1_complete(z) ){
        z[i+1] = c;
        continue;
      }
      processOneStatement(p, z);
      z[i+1] = c;
      while( shellIsSpace(z[i+1]) ){ i++; }
      xjd1StringRemovePrefix(&p->inBuf, i+1);

      break;
    }

  }
}

/*
** Process a single file of input by reading the text of the file and
** sending statements into the XJD1 database connection.
*/
................................................................................
  p->nLine = 0;
  while( !feof(p->pIn) ){
    if( p->isTTY ){
      printf("%s", xjd1StringLen(&p->inBuf)>0 ? " ...> " : "xjd1> ");
    }
    if( fgets(zLine, sizeof(zLine), p->pIn)==0 ) break;
    p->nLine++;




    xjd1StringAppend(&p->inBuf, zLine, -1);
    zIn = xjd1StringText(&p->inBuf);
    if( zIn[0]=='.' ){
      processMetaCommand(p);
    }else{
      processScript(p);
    }
................................................................................
  if( argc>1 ){
    for(i=1; i<argc; i++){
      processOneFile(&s, argv[i]);
    }
  }else{
    processOneFile(&s, "-");
  }



  if( s.pDb ) xjd1_close(s.pDb);
  xjd1StringClear(&s.inBuf);
  xjd1StringClear(&s.testOut);
  return 0;
}







|












|









|







 







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>










>
>
>
>
>
>
>







 







>







 







>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
|





>
>
>
>












|
>
>
>
>


>
>
>
>
>
>
>
>
>
>
>
>
>
>
|











>


>







 







>
>
>
>







 







>
>
>





202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
...
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311










312
313
314
315
316
317
318
...
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
...
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
...
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
...
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
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
...
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
...
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
**                characters.
**
**     [^...]     Matches one character not in the enclosed list.
**
**      '#'       Matches any sequence of one or more digits with an
**                optional + or - sign in front
*/
static int strnotglob(const char *zGlob, const char *z){
  int c, c2;
  int invert;
  int seen;

  while( (c = (*(zGlob++)))!=0 ){
    if( c=='*' ){
      while( (c=(*(zGlob++))) == '*' || c=='?' ){
        if( c=='?' && (*(z++))==0 ) return 0;
      }
      if( c==0 ){
        return 1;
      }else if( c=='[' ){
        while( *z && strnotglob(zGlob-1,z)==0 ){
          z++;
        }
        return (*z)!=0;
      }
      while( (c2 = (*(z++)))!=0 ){
        while( c2!=c ){
          c2 = *(z++);
          if( c2==0 ) return 0;
        }
        if( strnotglob(zGlob,z) ) return 1;
      }
      return 0;
    }else if( c=='?' ){
      if( (*(z++))==0 ) return 0;
    }else if( c=='[' ){
      int prior_c = 0;
      seen = 0;
................................................................................
      while( z[0]>='0' && z[0]<='9' ){ z++; }
    }else{
      if( c!=(*(z++)) ) return 0;
    }
  }
  return *z==0;
}
static int strglob(const char *zGlob, const char *z){
  return !strnotglob(zGlob,z);
}

/*
** Verify the output from a test.
*/
static void shellResultCheck(
  Shell *p,
  int argc,
  char **argv,
  int(*xCmp)(const char*,const char*)
){
  const char *zAns = argc>=2 ? argv[1] : "";
  const char *zRes = xjd1StringText(&p->testOut);
  if( zRes==0 ) zRes = "";
  p->nTest++;
  if( xCmp(zAns, zRes) ){
    p->nErr++;
    fprintf(stderr, " Test failed: %s.%s\n Expected: [%s]\n      Got: [%s]\n",
      p->zFile, p->zTestCase, argv[1], zRes);
  }
}

/* Command:  .result PATTERN */
static void shellResult(Shell *p, int argc, char **argv){
  shellResultCheck(p,argc,argv,strcmp);
}
/* Command:  .glob PATTERN */
static void shellGlob(Shell *p, int argc, char **argv){
  shellResultCheck(p,argc,argv,strglob);
}
/* Command:  .notglob PATTERN */
static void shellNotGlob(Shell *p, int argc, char **argv){
  shellResultCheck(p,argc,argv,strnotglob);










}

/*
** Command:  .open FILENAME
*/
static void shellOpenDB(Shell *p, int argc, char **argv){
  if( argc>=2 ){
................................................................................

/*
** Command:  .read FILENAME
** Read and process text from a file.
*/
static void shellRead(Shell *p, int argc, char **argv){
  if( argc>=2 ){
    int nErr = p->nErr;
    String newFile;
    char *zNew;
    xjd1StringInit(&newFile, 0, 0);
    if( argv[1][0]=='/' || strcmp(p->zFile,"-")==0 ){
      xjd1StringAppend(&newFile, argv[1], 0);
    }else{
      int i, j;
      for(i=j=0; p->zFile[i]; i++){ if( p->zFile[i]=='/' ) j = i; }
      xjd1StringAppendF(&newFile, "%.*s/%s", j, p->zFile, argv[1]);
    }
    zNew = xjd1StringText(&newFile);
    printf("BEGIN %s\n", zNew);
    processOneFile(p, zNew);
    printf("END %s - %d new errors\n", zNew, p->nErr - nErr);
    xjd1StringClear(&newFile);
  }
}

/*
** Command:  .breakpoint
** A place to seet a breakpoint
*/
static void shellBreakpoint(Shell *p, int argc, char **argv){
  /* no-op */
}

/*
** Command:  .puts TEXT
*/
static void shellPuts(Shell *p, int argc, char **argv){
  if( argc>=2 ) printf("%s\n", argv[1]);
}

/*
** Process a command intended for this shell - not for the database.
*/
static void processMetaCommand(Shell *p){
  char *z;
  int n;
................................................................................
    const char *zHelp;                  /* Help string */
  } cmds[] = {
    { "quit",       shellQuit,        ".quit"               },
    { "testcase",   shellTestcase,    ".testcase NAME"      },
    { "result",     shellResult,      ".result TEXT"        },
    { "glob",       shellGlob,        ".glob PATTERN"       },
    { "notglob",    shellNotGlob,     ".notglob PATTERN"    },
    { "puts",       shellPuts,        ".puts TEXT"          },
    { "read",       shellRead,        ".read FILENAME"      },
    { "open",       shellOpenDB,      ".open DATABASE"      },
    { "new",        shellNewDB,       ".new DATABASE"       },
    { "set",        shellSet,         ".set FLAG"           },
    { "clear",      shellClear,       ".clear FLAG"         },
    { "breakpoint", shellBreakpoint,  ".breakpoint"         },
  };
................................................................................
  if( i>=sizeof(cmds)/sizeof(cmds[0]) ){
    p->nErr++;
    fprintf(stderr, "%s:%d: unknown command \".%s\"\n", 
            p->zFile, p->nLine, azArg[0]);
  }
  xjd1StringTruncate(&p->inBuf);
}

/*
** Append text to the end of the testOut string.  If there is already
** text in the testOut buffer, prepent a space first.
*/
static void appendTestOut(Shell *p, const char *z, int n){
  if( xjd1StringLen(&p->testOut)>0 ){
    xjd1StringAppend(&p->testOut, " ", 1);
  }
  xjd1StringAppend(&p->testOut, z, n);
}

/*
** Run a single statment.
*/
static void processOneStatement(Shell *p, const char *zCmd){
  xjd1_stmt *pStmt;
  int N, rc;
................................................................................
      rc = xjd1_stmt_step(pStmt);
      if( rc==XJD1_ROW ){
        const char *zValue;
        xjd1_stmt_value(pStmt, &zValue);
        if( p->zTestCase[0]==0 ){
          printf("%s\n", zValue);
        }else{



          appendTestOut(p, zValue, -1);
        }
      }
    }while( rc==XJD1_ROW );
    xjd1_stmt_delete(pStmt);
  }else{
    if( p->zTestCase[0] ){
      appendTestOut(p, xjd1_errcode_name(p->pDb), -1);
      appendTestOut(p, xjd1_errmsg(p->pDb), -1);
    }
    fprintf(stderr, "%s:%d: ERROR: %s\n",
            p->zFile, p->nLine, xjd1_errmsg(p->pDb));
    p->nErr++;
  }
}

/*
** Process one or more database commands
*/
static void processScript(Shell *p){
  char *z, c;
  int i;
  if( p->pDb==0 ){
    if( p->shellFlags & SHELL_ECHO ) printf("%s", xjd1StringText(&p->inBuf));
    xjd1StringTruncate(&p->inBuf);
    return;
  }
  while( xjd1StringLen(&p->inBuf) ){
    z = xjd1StringText(&p->inBuf);
    for(i=0; shellIsSpace(z[i]); i++){}
    if( z[i]=='-' && z[i+1]=='-' ){
      for(i+=2; z[i] && z[i]!='\n'; i++){}
      if( p->shellFlags & SHELL_ECHO ){
        printf("%.*s\n", i, z);
      }
      while( shellIsSpace(z[i]) ) i++;
      xjd1StringRemovePrefix(&p->inBuf, i);
      break;
    }
    if( z[i]==0 ){
      xjd1StringTruncate(&p->inBuf);
      break;
    }
    for(; z[i]; i++){
      if( z[i]!=';' ) continue;
      c = z[i+1];
      z[i+1] = 0;
      if( !xjd1_complete(z) ){
        z[i+1] = c;
        continue;
      }
      processOneStatement(p, z);
      z[i+1] = c;
      while( shellIsSpace(z[i+1]) ){ i++; }
      xjd1StringRemovePrefix(&p->inBuf, i+1);
      i = 0;
      break;
    }
    if( i>0 ) break;
  }
}

/*
** Process a single file of input by reading the text of the file and
** sending statements into the XJD1 database connection.
*/
................................................................................
  p->nLine = 0;
  while( !feof(p->pIn) ){
    if( p->isTTY ){
      printf("%s", xjd1StringLen(&p->inBuf)>0 ? " ...> " : "xjd1> ");
    }
    if( fgets(zLine, sizeof(zLine), p->pIn)==0 ) break;
    p->nLine++;
    if( zLine[0]=='.' && xjd1StringLen(&p->inBuf) ){
      fprintf(stderr, "%s:%d: missing ';'\n", p->zFile, p->nLine);
      xjd1StringTruncate(&p->inBuf);
    }
    xjd1StringAppend(&p->inBuf, zLine, -1);
    zIn = xjd1StringText(&p->inBuf);
    if( zIn[0]=='.' ){
      processMetaCommand(p);
    }else{
      processScript(p);
    }
................................................................................
  if( argc>1 ){
    for(i=1; i<argc; i++){
      processOneFile(&s, argv[i]);
    }
  }else{
    processOneFile(&s, "-");
  }
  if( s.nTest ){
    printf("%d errors from %d tests\n", s.nErr, s.nTest);
  }
  if( s.pDb ) xjd1_close(s.pDb);
  xjd1StringClear(&s.inBuf);
  xjd1StringClear(&s.testOut);
  return 0;
}

Changes to src/xjd1.h.

55
56
57
58
59
60
61

62
63
64
65
66
67
68

/* Operators for xjd1_config() */
#define XJD1_CONFIG_PARSERTRACE    1

/* Report on recent errors */
int xjd1_errcode(xjd1*);
const char *xjd1_errmsg(xjd1*);


/* Create a new prepared statement */
int xjd1_stmt_new(xjd1*, const char*, xjd1_stmt**, int*);
int xjd1_stmt_delete(xjd1_stmt*);
int xjd1_stmt_config(xjd1_stmt*, int, ...);

/* Process a prepared statement */







>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

/* Operators for xjd1_config() */
#define XJD1_CONFIG_PARSERTRACE    1

/* Report on recent errors */
int xjd1_errcode(xjd1*);
const char *xjd1_errmsg(xjd1*);
const char *xjd1_errcode_name(xjd1*);

/* Create a new prepared statement */
int xjd1_stmt_new(xjd1*, const char*, xjd1_stmt**, int*);
int xjd1_stmt_delete(xjd1_stmt*);
int xjd1_stmt_config(xjd1_stmt*, int, ...);

/* Process a prepared statement */

Added test/all.test.







>
>
>
1
2
3
-- Run all test scripts
--
.read base01.test

Added test/base01.test.



































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- Basic sanity checking.
--
.new t1.db
.testcase 100
CREATE DATASET abc;
CREATE DATASET def;
INSERT INTO abc VALUE {"name":"abc"};
INSERT INTO def VALUE {"name":"def"};
.result

.testcase 110
SELECT FROM abc;
.result {"name":"abc"}

.testcase 120
SELECT FROM def;
.result {"name":"def"}