duckdb 0.5.2-dev1987.0 → 0.5.2-dev1997.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.5.2-dev1987.0",
5
+ "version": "0.5.2-dev1997.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -28579,7 +28579,8 @@ bool TryCastErrorMessage::Operation(string_t input, date_t &result, string *erro
28579
28579
  template <>
28580
28580
  bool TryCast::Operation(string_t input, date_t &result, bool strict) {
28581
28581
  idx_t pos;
28582
- return Date::TryConvertDate(input.GetDataUnsafe(), input.GetSize(), pos, result, strict);
28582
+ bool special = false;
28583
+ return Date::TryConvertDate(input.GetDataUnsafe(), input.GetSize(), pos, result, special, strict);
28583
28584
  }
28584
28585
 
28585
28586
  template <>
@@ -45075,7 +45076,8 @@ static bool TryConvertDateSpecial(const char *buf, idx_t len, idx_t &pos, const
45075
45076
  return true;
45076
45077
  }
45077
45078
 
45078
- bool Date::TryConvertDate(const char *buf, idx_t len, idx_t &pos, date_t &result, bool strict) {
45079
+ bool Date::TryConvertDate(const char *buf, idx_t len, idx_t &pos, date_t &result, bool &special, bool strict) {
45080
+ special = false;
45079
45081
  pos = 0;
45080
45082
  if (len == 0) {
45081
45083
  return false;
@@ -45115,6 +45117,7 @@ bool Date::TryConvertDate(const char *buf, idx_t len, idx_t &pos, date_t &result
45115
45117
  while (pos < len && StringUtil::CharacterIsSpace(buf[pos])) {
45116
45118
  pos++;
45117
45119
  }
45120
+ special = true;
45118
45121
  return pos == len;
45119
45122
  }
45120
45123
  // first parse the year
@@ -45205,7 +45208,8 @@ string Date::ConversionError(string_t str) {
45205
45208
  date_t Date::FromCString(const char *buf, idx_t len, bool strict) {
45206
45209
  date_t result;
45207
45210
  idx_t pos;
45208
- if (!TryConvertDate(buf, len, pos, result, strict)) {
45211
+ bool special = false;
45212
+ if (!TryConvertDate(buf, len, pos, result, special, strict)) {
45209
45213
  throw ConversionException(ConversionError(string(buf, len)));
45210
45214
  }
45211
45215
  return result;
@@ -48594,11 +48598,12 @@ static inline bool CharacterIsTimeZone(char c) {
48594
48598
  return StringUtil::CharacterIsAlpha(c) || StringUtil::CharacterIsDigit(c) || c == '_' || c == '/';
48595
48599
  }
48596
48600
 
48597
- bool Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &result, string_t &tz) {
48601
+ bool Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &result, bool &has_offset, string_t &tz) {
48598
48602
  idx_t pos;
48599
48603
  date_t date;
48600
48604
  dtime_t time;
48601
- if (!Date::TryConvertDate(str, len, pos, date)) {
48605
+ has_offset = false;
48606
+ if (!Date::TryConvertDate(str, len, pos, date, has_offset)) {
48602
48607
  return false;
48603
48608
  }
48604
48609
  if (pos == len) {
@@ -48629,8 +48634,10 @@ bool Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &r
48629
48634
  int hour_offset, minute_offset;
48630
48635
  if (str[pos] == 'Z') {
48631
48636
  pos++;
48637
+ has_offset = true;
48632
48638
  } else if (Timestamp::TryParseUTCOffset(str, pos, len, hour_offset, minute_offset)) {
48633
48639
  result -= hour_offset * Interval::MICROS_PER_HOUR + minute_offset * Interval::MICROS_PER_MINUTE;
48640
+ has_offset = true;
48634
48641
  } else {
48635
48642
  // Parse a time zone: / [A-Za-z0-9/_]+/
48636
48643
  if (str[pos++] != ' ') {
@@ -48660,7 +48667,9 @@ bool Timestamp::TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &r
48660
48667
 
48661
48668
  bool Timestamp::TryConvertTimestamp(const char *str, idx_t len, timestamp_t &result) {
48662
48669
  string_t tz(nullptr, 0);
48663
- return TryConvertTimestampTZ(str, len, result, tz) && !tz.GetSize();
48670
+ bool has_offset = false;
48671
+ // We don't understand TZ without an extension, so fail if one was provided.
48672
+ return TryConvertTimestampTZ(str, len, result, has_offset, tz) && !tz.GetSize();
48664
48673
  }
48665
48674
 
48666
48675
  string Timestamp::ConversionError(const string &str) {
package/src/duckdb.hpp CHANGED
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
13
  #define DUCKDB_AMALGAMATION_EXTENDED 1
14
- #define DUCKDB_SOURCE_ID "88f5329f4b"
15
- #define DUCKDB_VERSION "v0.5.2-dev1987"
14
+ #define DUCKDB_SOURCE_ID "7ce148ac3d"
15
+ #define DUCKDB_VERSION "v0.5.2-dev1997"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -19091,7 +19091,9 @@ public:
19091
19091
  //! Convert a date object to a string in the format "YYYY-MM-DD"
19092
19092
  DUCKDB_API static string ToString(date_t date);
19093
19093
  //! Try to convert text in a buffer to a date; returns true if parsing was successful
19094
- DUCKDB_API static bool TryConvertDate(const char *buf, idx_t len, idx_t &pos, date_t &result, bool strict = false);
19094
+ //! If the date was a "special" value, the special flag will be set.
19095
+ DUCKDB_API static bool TryConvertDate(const char *buf, idx_t len, idx_t &pos, date_t &result, bool &special,
19096
+ bool strict = false);
19095
19097
 
19096
19098
  //! Create a string "YYYY-MM-DD" from a specified (year, month, day)
19097
19099
  //! combination
@@ -19383,8 +19385,10 @@ public:
19383
19385
  //! Convert a string in the format "YYYY-MM-DD hh:mm:ss[.f][-+TH[:tm]]" to a timestamp object
19384
19386
  DUCKDB_API static timestamp_t FromString(const string &str);
19385
19387
  //! Convert a string where the offset can also be a time zone string: / [A_Za-z0-9/_]+/
19388
+ //! If has_offset is true, then the result is an instant that was offset from UTC
19386
19389
  //! If the tz is not empty, the result is still an instant, but the parts can be extracted and applied to the TZ
19387
- DUCKDB_API static bool TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &result, string_t &tz);
19390
+ DUCKDB_API static bool TryConvertTimestampTZ(const char *str, idx_t len, timestamp_t &result, bool &has_offset,
19391
+ string_t &tz);
19388
19392
  DUCKDB_API static bool TryConvertTimestamp(const char *str, idx_t len, timestamp_t &result);
19389
19393
  DUCKDB_API static timestamp_t FromCString(const char *str, idx_t len);
19390
19394
  //! Convert a date object to a string in the format "YYYY-MM-DD hh:mm:ss"