duckdb 0.6.2-dev1017.0 → 0.6.2-dev1020.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.6.2-dev1017.0",
5
+ "version": "0.6.2-dev1020.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -1050,22 +1050,23 @@ static bool TryIntegerCast(const char *buf, idx_t len, T &result, bool strict) {
1050
1050
  }
1051
1051
  return IntegerCastLoop<T, true, ALLOW_EXPONENT, OP>(buf, len, result, strict);
1052
1052
  }
1053
- // If it starts with 0x or 0X, we parse it as a hex value
1054
- else if (len > 1 && *buf == '0' && (buf[1] == 'x' || buf[1] == 'X')) {
1055
- // Skip the 0x
1056
- buf++;
1057
- len--;
1058
- return IntegerHexCastLoop<T, false, false, OP>(buf, len, result, strict);
1059
- }
1060
- // If it starts with 0b or 0B, we parse it as a binary value
1061
- else if (len > 1 && *buf == '0' && (buf[1] == 'b' || buf[1] == 'B')) {
1062
- // Skip the 0b
1063
- buf++;
1064
- len--;
1065
- return IntegerBinaryCastLoop<T, false, false, OP>(buf, len, result, strict);
1066
- } else {
1067
- return IntegerCastLoop<T, false, ALLOW_EXPONENT, OP>(buf, len, result, strict);
1053
+ if (len > 1 && *buf == '0') {
1054
+ if (buf[1] == 'x' || buf[1] == 'X') {
1055
+ // If it starts with 0x or 0X, we parse it as a hex value
1056
+ buf++;
1057
+ len--;
1058
+ return IntegerHexCastLoop<T, false, false, OP>(buf, len, result, strict);
1059
+ } else if (buf[1] == 'b' || buf[1] == 'B') {
1060
+ // If it starts with 0b or 0B, we parse it as a binary value
1061
+ buf++;
1062
+ len--;
1063
+ return IntegerBinaryCastLoop<T, false, false, OP>(buf, len, result, strict);
1064
+ } else if (strict && StringUtil::CharacterIsDigit(buf[1])) {
1065
+ // leading zeros are not allowed in strict mode
1066
+ return false;
1067
+ }
1068
1068
  }
1069
+ return IntegerCastLoop<T, false, ALLOW_EXPONENT, OP>(buf, len, result, strict);
1069
1070
  }
1070
1071
 
1071
1072
  template <typename T, bool IS_SIGNED = true>
@@ -1170,6 +1171,12 @@ static bool TryDoubleCast(const char *buf, idx_t len, T &result, bool strict) {
1170
1171
  buf++;
1171
1172
  len--;
1172
1173
  }
1174
+ if (strict && len >= 2) {
1175
+ if (buf[0] == '0' && StringUtil::CharacterIsDigit(buf[1])) {
1176
+ // leading zeros are not allowed in strict mode
1177
+ return false;
1178
+ }
1179
+ }
1173
1180
  auto endptr = buf + len;
1174
1181
  auto parse_result = duckdb_fast_float::from_chars(buf, buf + len, result);
1175
1182
  if (parse_result.ec != std::errc()) {
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.6.2-dev1017"
2
+ #define DUCKDB_VERSION "0.6.2-dev1020"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "b056090a0c"
5
+ #define DUCKDB_SOURCE_ID "46f8e0b7ce"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"