SQLite

Check-in [93f42586cc]
Login

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

Overview
Comment:If an error occurs in the compile-time evaluation of an application-defined function, then propagate back out the exact error code, not just the generic SQLITE_ERROR.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | stat4-function
Files: files | file ages | folders
SHA1: 93f42586cc9db63c5a4599ce06630e60204a5bc9
User & Date: drh 2015-03-12 18:38:51.338
Context
2015-03-12
21:02
Always disallow functions as the DEFAULT of a column. Add assert()s and (Closed-Leaf check-in: a991bb1a9e user: drh tags: stat4-function)
18:38
If an error occurs in the compile-time evaluation of an application-defined function, then propagate back out the exact error code, not just the generic SQLITE_ERROR. (check-in: 93f42586cc user: drh tags: stat4-function)
06:46
The valueFromFunction() routine is better able to handle OOM errors. Omit unreachable branches. (check-in: 8fb6bd9be5 user: drh tags: stat4-function)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbemem.c.
1206
1207
1208
1209
1210
1211
1212

1213


1214
1215
1216
1217
1218
1219
1220

  memset(&ctx, 0, sizeof(ctx));
  ctx.pOut = pVal;
  ctx.pFunc = pFunc;
  pFunc->xFunc(&ctx, nVal, apVal);
  if( ctx.isError ){
    rc = ctx.isError;

    if( pCtx ) sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));


  }else{
    sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
    if( rc==SQLITE_OK ){
      rc = sqlite3VdbeChangeEncoding(pVal, enc);
    }
    if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){
      rc = SQLITE_TOOBIG;







>
|
>
>







1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223

  memset(&ctx, 0, sizeof(ctx));
  ctx.pOut = pVal;
  ctx.pFunc = pFunc;
  pFunc->xFunc(&ctx, nVal, apVal);
  if( ctx.isError ){
    rc = ctx.isError;
    if( pCtx ){
      sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
      pCtx->pParse->rc = rc;
    }
  }else{
    sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
    if( rc==SQLITE_OK ){
      rc = sqlite3VdbeChangeEncoding(pVal, enc);
    }
    if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){
      rc = SQLITE_TOOBIG;