Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fixes to json_each() and json_tree(). Improved json_parse() debugging output. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
fc1b24f316af07a64672f6edc14ebcff |
User & Date: | drh 2015-08-23 02:42:30.942 |
Context
2015-08-23
| ||
20:44 | Fix minor glitches in the json1.c extension, mostly having to do with OOM behavior. (check-in: cc5204149c user: drh tags: trunk) | |
02:42 | Fixes to json_each() and json_tree(). Improved json_parse() debugging output. (check-in: fc1b24f316 user: drh tags: trunk) | |
2015-08-22
| ||
19:39 | Add the json_valid() function to the json1.c extension. Fix various minor problems in the json1.c extension. (check-in: 380a97345b user: drh tags: trunk) | |
Changes
Changes to ext/misc/json1.c.
︙ | |||
191 192 193 194 195 196 197 | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - - - - - - - - | if( (p->nUsed + N >= p->nAlloc) && jsonGrow(p, N) ) return; va_start(ap, zFormat); sqlite3_vsnprintf(N, p->zBuf+p->nUsed, zFormat, ap); va_end(ap); p->nUsed += (int)strlen(p->zBuf+p->nUsed); } |
︙ | |||
464 465 466 467 468 469 470 | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | - - - + + - | char c = z[i]; if( c!='\\' && z[i+1] ){ zOut[j++] = c; }else{ c = z[++i]; if( c=='u' && z[1] ){ u32 v = 0, k; |
︙ | |||
674 675 676 677 678 679 680 | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | - + + + + + | continue; } if( c=='e' || c=='E' ){ if( pParse->zJson[j-1]<'0' ) return -1; if( seenE ) return -1; seenDP = seenE = 1; c = pParse->zJson[j+1]; |
︙ | |||
833 834 835 836 837 838 839 | 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | - + | return pNode; } }else if( zPath[0]=='[' && isdigit(zPath[1]) ){ if( pRoot->eType!=JSON_ARRAY ) return 0; i = 0; zPath++; while( isdigit(zPath[0]) ){ |
︙ | |||
926 927 928 929 930 931 932 | 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | - + - - + + - | sqlite3_context *ctx, int argc, sqlite3_value **argv ){ JsonString s; /* Output string - not real JSON */ JsonParse x; /* The parse */ u32 i; |
︙ | |||
1414 1415 1416 1417 1418 1419 1420 | 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 | - - + + + + - + - - - + + + + + + | /* Advance the cursor to the next element for json_tree() */ static int jsonEachNext(sqlite3_vtab_cursor *cur){ JsonEachCursor *p = (JsonEachCursor*)cur; if( p->bRecursive ){ if( p->i==0 ){ p->i = 1; |
︙ | |||
1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 | 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 | + - + - + | sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ int i /* Which column to return */ ){ JsonEachCursor *p = (JsonEachCursor*)cur; JsonNode *pThis = &p->sParse.aNode[p->i]; switch( i ){ case JEACH_KEY: { if( p->i==0 ) break; if( p->eType==JSON_OBJECT ){ jsonReturn(pThis, ctx, 0); }else if( p->eType==JSON_ARRAY ){ u32 iKey; if( p->bRecursive ){ if( p->iRowid==0 ) break; |
︙ | |||
1668 1669 1670 1671 1672 1673 1674 | 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 | + - + | } }else{ pNode = p->sParse.aNode; } p->i = (int)(pNode - p->sParse.aNode); p->eType = pNode->eType; if( p->eType>=JSON_ARRAY ){ pNode->u.iKey = 0; |
︙ |