mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-08 03:22:21 +03:00
Fix for ticket #65: If an integer value is too big to be represented as a
32-bit integer, then treat it as a string. (CVS 611) FossilOrigin-Name: ad9624798edbd6d0c4652fed3d74fe87498844ff
This commit is contained in:
14
src/expr.c
14
src/expr.c
@@ -12,7 +12,7 @@
|
||||
** This file contains routines used for analyzing expressions and
|
||||
** for generating VDBE code that evaluates expressions in SQLite.
|
||||
**
|
||||
** $Id: expr.c,v 1.69 2002/06/02 18:22:06 drh Exp $
|
||||
** $Id: expr.c,v 1.70 2002/06/09 01:16:01 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@@ -824,7 +824,17 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){
|
||||
break;
|
||||
}
|
||||
case TK_INTEGER: {
|
||||
sqliteVdbeAddOp(v, OP_Integer, atoi(pExpr->token.z), 0);
|
||||
int iVal = atoi(pExpr->token.z);
|
||||
char zBuf[30];
|
||||
sprintf(zBuf,"%d",iVal);
|
||||
if( strlen(zBuf)!=pExpr->token.n
|
||||
|| strncmp(pExpr->token.z,zBuf,pExpr->token.n)!=0 ){
|
||||
/* If the integer value cannot be represented exactly in 32 bits,
|
||||
** then code it as a string instead. */
|
||||
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
||||
}else{
|
||||
sqliteVdbeAddOp(v, OP_Integer, iVal, 0);
|
||||
}
|
||||
sqliteVdbeChangeP3(v, -1, pExpr->token.z, pExpr->token.n);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user