sql: refactor sql_atoi64()
We are going to allow using unsigned values in SQL and extend range of INTEGER type. Hence, we should be able to parse and operate on integers in range of [2^63, 2^64 - 1]. Current mechanism which involves sql_atoi64() function doesn't allow this. Let's refactor this function: firstly, get rid of manual parsing and use strtoll() and strtoull() functions from standard library. Then, let's return sign of parsed literal. In case of success now function returns 0, -1 otherwise. This patch also inlines sql_dec_or_hex_to_i64() to place of its only usage: it makes code cleaner and more straightforward. Needed for #3810 Needed for #4015
Showing
- src/box/sql/expr.c 35 additions, 20 deletionssrc/box/sql/expr.c
- src/box/sql/sqlInt.h 10 additions, 37 deletionssrc/box/sql/sqlInt.h
- src/box/sql/util.c 27 additions, 108 deletionssrc/box/sql/util.c
- src/box/sql/vdbe.c 4 additions, 2 deletionssrc/box/sql/vdbe.c
- src/box/sql/vdbemem.c 11 additions, 5 deletionssrc/box/sql/vdbemem.c
- test/sql-tap/func.test.lua 4 additions, 4 deletionstest/sql-tap/func.test.lua
- test/sql/integer-overflow.result 5 additions, 1 deletiontest/sql/integer-overflow.result
Loading
Please register or sign in to comment