diff options
author | stephan <stephan@noemail.net> | 2024-09-23 17:06:06 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2024-09-23 17:06:06 +0000 |
commit | d69b4249ffea7614e94ca23b0ca15a6ebec8972d (patch) | |
tree | 1592b4ab20b8b80645fa36e33a6186d491c042f9 /ext/session/sqlite3session.c | |
parent | 8ade1d2f974c5755db3ed13a9f372c6853f59cd1 (diff) | |
parent | 5e419c10484b11535649e7dad02739bc2c993be0 (diff) | |
download | sqlite-d69b4249ffea7614e94ca23b0ca15a6ebec8972d.tar.gz sqlite-d69b4249ffea7614e94ca23b0ca15a6ebec8972d.zip |
Merge current trunk into this branch.
FossilOrigin-Name: ed47d7f9a44b2af8ab7dd956495e71ea9a159cec438d1909f7022254a779e068
Diffstat (limited to 'ext/session/sqlite3session.c')
-rw-r--r-- | ext/session/sqlite3session.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ext/session/sqlite3session.c b/ext/session/sqlite3session.c index 7a8132bfa..5bab39b67 100644 --- a/ext/session/sqlite3session.c +++ b/ext/session/sqlite3session.c @@ -1757,16 +1757,19 @@ static void sessionPreupdateOneChange( for(i=0; i<(pTab->nCol-pTab->bRowid); i++){ sqlite3_value *p = 0; if( op!=SQLITE_INSERT ){ - TESTONLY(int trc = ) pSession->hook.xOld(pSession->hook.pCtx, i, &p); - assert( trc==SQLITE_OK ); + /* This may fail if the column has a non-NULL default and was added + ** using ALTER TABLE ADD COLUMN after this record was created. */ + rc = pSession->hook.xOld(pSession->hook.pCtx, i, &p); }else if( pTab->abPK[i] ){ TESTONLY(int trc = ) pSession->hook.xNew(pSession->hook.pCtx, i, &p); assert( trc==SQLITE_OK ); } - /* This may fail if SQLite value p contains a utf-16 string that must - ** be converted to utf-8 and an OOM error occurs while doing so. */ - rc = sessionSerializeValue(0, p, &nByte); + if( rc==SQLITE_OK ){ + /* This may fail if SQLite value p contains a utf-16 string that must + ** be converted to utf-8 and an OOM error occurs while doing so. */ + rc = sessionSerializeValue(0, p, &nByte); + } if( rc!=SQLITE_OK ) goto error_out; } if( pTab->bRowid ){ @@ -5660,6 +5663,9 @@ static int sessionChangesetExtendRecord( sessionAppendBlob(pOut, aRec, nRec, &rc); if( rc==SQLITE_OK && pTab->pDfltStmt==0 ){ rc = sessionPrepareDfltStmt(pGrp->db, pTab, &pTab->pDfltStmt); + if( rc==SQLITE_OK && SQLITE_ROW!=sqlite3_step(pTab->pDfltStmt) ){ + rc = sqlite3_errcode(pGrp->db); + } } for(ii=nCol; rc==SQLITE_OK && ii<pTab->nCol; ii++){ int eType = sqlite3_column_type(pTab->pDfltStmt, ii); @@ -5676,6 +5682,7 @@ static int sessionChangesetExtendRecord( } if( SQLITE_OK==sessionBufferGrow(pOut, 8, &rc) ){ sessionPutI64(&pOut->aBuf[pOut->nBuf], iVal); + pOut->nBuf += 8; } break; } |