1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Allow integers and floating point numbers to compare equal.

FossilOrigin-Name: 0fe2e465ba931d4bceaf171693d2ee7af45a5f96840e65e9d4ee4a2e60f155d8
This commit is contained in:
drh
2022-06-17 16:32:21 +00:00
parent 63880362ed
commit ea64cb31a5
3 changed files with 18 additions and 8 deletions

View File

@ -218,7 +218,17 @@ static char *fuzz_invariant_sql(sqlite3_stmt *pStmt, int iCnt){
*/
static int sameValue(sqlite3_stmt *pS1, int i1, sqlite3_stmt *pS2, int i2){
int x = 1;
if( sqlite3_column_type(pS1,i1)!=sqlite3_column_type(pS2,i2) ) return 0;
int t1 = sqlite3_column_type(pS1,i1);
int t2 = sqlite3_column_type(pS2,i2);
if( t1!=t2 ){
if( (t1==SQLITE_INTEGER && t2==SQLITE_FLOAT)
|| (t1==SQLITE_FLOAT && t2==SQLITE_INTEGER)
){
/* Comparison of numerics is ok */
}else{
return 0;
}
}
switch( sqlite3_column_type(pS1,i1) ){
case SQLITE_INTEGER: {
x = sqlite3_column_int64(pS1,i1)==sqlite3_column_int64(pS2,i2);