mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Make sure a CAST to "NUMERIC" results in an integer if the value can be
losslessly expressed as an integer, as the documentation requires. Ticket [dd6bffbfb6e61db9]. FossilOrigin-Name: c0c90961b4fa1c1185772d04fe1915bc1a1af27ed8ddb8db1c524bf90d68ccbf
This commit is contained in:
13
src/vdbe.c
13
src/vdbe.c
@@ -285,17 +285,8 @@ static VdbeCursor *allocateCursor(
|
||||
static int alsoAnInt(Mem *pRec, double rValue, i64 *piValue){
|
||||
i64 iValue = (double)rValue;
|
||||
if( sqlite3RealSameAsInt(rValue,iValue) ){
|
||||
testcase( iValue<-2251799813685248 );
|
||||
testcase( iValue==-2251799813685248 );
|
||||
testcase( iValue==-2251799813685247 );
|
||||
testcase( iValue>-2251799813685247 && iValue<+2251799813685247 );
|
||||
testcase( iValue==+2251799813685247 );
|
||||
testcase( iValue==+2251799813685248 );
|
||||
testcase( iValue>+2251799813685248 );
|
||||
if( iValue > -2251799813685248 && iValue < 2251799813685248 ){
|
||||
*piValue = iValue;
|
||||
return 1;
|
||||
}
|
||||
*piValue = iValue;
|
||||
return 1;
|
||||
}
|
||||
return 0==sqlite3Atoi64(pRec->z, piValue, pRec->n, pRec->enc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user