SQLite

Check-in [b540984915]
Login

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

Overview
Comment:Fix OOM error reporting in the json1_group_object() SQL function. Remove an unreachable branch from the JSON1 logic.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b54098491531cd26ed461275ef4aae3d3ec9065e
User & Date: drh 2016-11-07 18:18:08.418
Context
2016-11-23
20:31
Fix OOM error reporting in the json1_group_object() SQL function. Remove an unreachable branch from the JSON1 logic. (check-in: 6492e57e65 user: drh tags: branch-3.15)
2016-11-08
00:30
Tweaks to speedtest1.c to better reflect mobile usage based on findings in the "Pocket Data" paper by Kennedy, Ajay, Challen, and Ziarek. (check-in: b5733cae3c user: drh tags: trunk)
2016-11-07
18:18
Fix OOM error reporting in the json1_group_object() SQL function. Remove an unreachable branch from the JSON1 logic. (check-in: b540984915 user: drh tags: trunk)
15:15
Replace some unreachable branches from the JSON1 extension with assert(). (check-in: 145cd13e3c user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to ext/misc/json1.c.
1658
1659
1660
1661
1662
1663
1664
1665

1666
1667
1668
1669
1670
1671
1672
1658
1659
1660
1661
1662
1663
1664

1665
1666
1667
1668
1669
1670
1671
1672







-
+







}
static void jsonObjectFinal(sqlite3_context *ctx){
  JsonString *pStr;
  pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0);
  if( pStr ){
    jsonAppendChar(pStr, '}');
    if( pStr->bErr ){
      if( pStr->bErr==0 ) sqlite3_result_error_nomem(ctx);
      if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx);
      assert( pStr->bStatic );
    }else{
      sqlite3_result_text(ctx, pStr->zBuf, pStr->nUsed,
                          pStr->bStatic ? SQLITE_TRANSIENT : sqlite3_free);
      pStr->bStatic = 1;
    }
  }else{
1936
1937
1938
1939
1940
1941
1942
1943

1944
1945

1946
1947
1948
1949
1950
1951
1952
1936
1937
1938
1939
1940
1941
1942

1943
1944

1945
1946
1947
1948
1949
1950
1951
1952







-
+

-
+







        jsonEachComputePath(p, &x, p->sParse.aUp[p->i]);
        jsonResult(&x);
        break;
      }
      /* For json_each() path and root are the same so fall through
      ** into the root case */
    }
    case JEACH_ROOT: {
    default: {
      const char *zRoot = p->zRoot;
       if( zRoot==0 ) zRoot = "$";
      if( zRoot==0 ) zRoot = "$";
      sqlite3_result_text(ctx, zRoot, -1, SQLITE_STATIC);
      break;
    }
    case JEACH_JSON: {
      assert( i==JEACH_JSON );
      sqlite3_result_text(ctx, p->sParse.zJson, -1, SQLITE_STATIC);
      break;