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

Make MEM_IntReal a completely independent type, meaning a floating point

value stored as an integer.  This fixes a problem with arithmetic within
arguments to string functions on indexes of expressions.  But it is a big
change and needs lots of new testcase() macros for MC/DC and so it is
initially put on this branch.

FossilOrigin-Name: dba836e31cb29d339b4520acb06188a892a52e45c50aba9742966b01108e251a
This commit is contained in:
drh
2019-05-02 21:36:26 +00:00
parent de7109e61b
commit 169f077e07
7 changed files with 80 additions and 63 deletions

View File

@@ -266,7 +266,7 @@ int sqlite3_value_type(sqlite3_value* pVal){
SQLITE_NULL, /* 0x1d */
SQLITE_INTEGER, /* 0x1e */
SQLITE_NULL, /* 0x1f */
SQLITE_BLOB, /* 0x20 */
SQLITE_FLOAT, /* 0x20 */
SQLITE_NULL, /* 0x21 */
SQLITE_TEXT, /* 0x22 */
SQLITE_NULL, /* 0x23 */
@@ -304,10 +304,10 @@ int sqlite3_value_type(sqlite3_value* pVal){
int eType = SQLITE_BLOB;
if( pVal->flags & MEM_Null ){
eType = SQLITE_NULL;
}else if( pVal->flags & MEM_Int ){
eType = (pVal->flags & MEM_IntReal) ? SQLITE_FLOAT : SQLITE_INTEGER;
}else if( pVal->flags & MEM_Real ){
}else if( pVal->flags & (MEM_Real|MEM_IntReal) ){
eType = SQLITE_FLOAT;
}else if( pVal->flags & MEM_Int ){
eType = SQLITE_INTEGER;
}else if( pVal->flags & MEM_Str ){
eType = SQLITE_TEXT;
}
@@ -1849,7 +1849,7 @@ int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){
}else if( iIdx>=p->pUnpacked->nField ){
*ppValue = (sqlite3_value *)columnNullValue();
}else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){
if( pMem->flags & MEM_Int ){
if( pMem->flags & (MEM_Int|MEM_IntReal) ){
sqlite3VdbeMemRealify(pMem);
}
}