mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-21 09:00:59 +03:00
Add OP_Affinity opcodes to the VMs generated by sqlite3_index_writer().
FossilOrigin-Name: b9b38cb8e21826ddfb4c87a1f166ad33c3c7b6eb
This commit is contained in:
@@ -478,6 +478,7 @@ int sqlite3_index_writer(
|
||||
Vdbe *v = 0;
|
||||
int regRec; /* Register to assemble record in */
|
||||
int *aiCol = 0;
|
||||
const char *zAffinity = 0; /* Affinity string for the current index */
|
||||
|
||||
sqlite3_mutex_enter(db->mutex);
|
||||
sqlite3BtreeEnterAll(db);
|
||||
@@ -499,6 +500,7 @@ int sqlite3_index_writer(
|
||||
goto index_writer_out;
|
||||
}
|
||||
pTab = pIdx->pTable;
|
||||
zAffinity = sqlite3IndexAffinityStr(v, pIdx);
|
||||
|
||||
/* Populate the two output variables, *pnCol and *pnAiCol. */
|
||||
*pnCol = pIdx->nColumn;
|
||||
@@ -548,7 +550,7 @@ int sqlite3_index_writer(
|
||||
regRec = ++pParse->nMem;
|
||||
|
||||
if( bDelete==0 ){
|
||||
sqlite3VdbeAddOp3(v, OP_MakeRecord, 1, pIdx->nColumn, regRec);
|
||||
sqlite3VdbeAddOp4(v, OP_MakeRecord, 1, pIdx->nColumn, regRec, zAffinity, 0);
|
||||
|
||||
/* If this is a UNIQUE index, check the constraint. */
|
||||
if( pIdx->onError ){
|
||||
@@ -561,6 +563,7 @@ int sqlite3_index_writer(
|
||||
sqlite3VdbeAddOp2(v, OP_IdxInsert, 0, regRec);
|
||||
}else{
|
||||
/* Code the IdxDelete to remove the entry from the b-tree index. */
|
||||
sqlite3VdbeAddOp4(v, OP_Affinity, 0, pIdx->nColumn, 0, zAffinity, 0);
|
||||
sqlite3VdbeAddOp3(v, OP_IdxDelete, 0, 1, pIdx->nColumn);
|
||||
}
|
||||
sqlite3FinishCoding(pParse);
|
||||
|
||||
Reference in New Issue
Block a user