1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Trim NULL values off the end of records when the SQLITE_ENABLE_TRIM_NULLS

compile-time option is used.  Increase the size of the P5 operand to 16 bits.
Fix a problem with short records in the sessions extension.

FossilOrigin-Name: 4801bd59a01dcc11a3eb9e776e7599b36f162d2a
This commit is contained in:
drh
2017-01-25 20:55:11 +00:00
11 changed files with 134 additions and 49 deletions

View File

@@ -2777,6 +2777,20 @@ case OP_MakeRecord: {
}while( zAffinity[0] );
}
#ifdef SQLITE_ENABLE_NULL_TRIM
/* NULLs can be safely trimmed from the end of the record, as long as
** as the schema format is 2 or more and none of the omitted columns
** have a non-NULL default value. Also, the record must be left with
** at least one field. If P5>0 then it will be one more than the
** index of the right-most column with a non-NULL default value */
if( pOp->p5 ){
while( (pLast->flags & MEM_Null)!=0 && nField>pOp->p5 ){
pLast--;
nField--;
}
}
#endif
/* Loop through the elements that will make up the record to figure
** out how much space is required for the new record.
*/