mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-02 05:54:29 +03:00
Enhance the sqlite3VdbeMultiLoad() interface to automatically generate the
OP_ResultRow opcode on PRAGMA implementations, for a small reduction in the library footprint. FossilOrigin-Name: c46f0f076c674891e20240bad56693d891aedc43004bcf980a5d199515f23413
This commit is contained in:
@@ -242,6 +242,9 @@ int sqlite3VdbeLoadString(Vdbe *p, int iDest, const char *zStr){
|
||||
** "s" character in zTypes[], the register is a string if the argument is
|
||||
** not NULL, or OP_Null if the value is a null pointer. For each "i" character
|
||||
** in zTypes[], the register is initialized to an integer.
|
||||
**
|
||||
** If the input string does not end with "X" then an OP_ResultRow instruction
|
||||
** is generated for the values inserted.
|
||||
*/
|
||||
void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){
|
||||
va_list ap;
|
||||
@@ -251,12 +254,15 @@ void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){
|
||||
for(i=0; (c = zTypes[i])!=0; i++){
|
||||
if( c=='s' ){
|
||||
const char *z = va_arg(ap, const char*);
|
||||
sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest++, 0, z, 0);
|
||||
sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest+i, 0, z, 0);
|
||||
}else if( c=='i' ){
|
||||
sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest+i);
|
||||
}else{
|
||||
assert( c=='i' );
|
||||
sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest++);
|
||||
goto skip_op_resultrow;
|
||||
}
|
||||
}
|
||||
sqlite3VdbeAddOp2(p, OP_ResultRow, iDest, i);
|
||||
skip_op_resultrow:
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user