duckdb 0.3.5-dev75.0 → 0.3.5-dev750.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/src/statement.cpp CHANGED
@@ -179,7 +179,8 @@ static Napi::Value convert_chunk(Napi::Env &env, std::vector<std::string> names,
179
179
  const auto scale = duckdb::Interval::SECS_PER_DAY * duckdb::Interval::MSECS_PER_SEC;
180
180
  value = Napi::Date::New(env, double(dval.GetValue<int32_t>() * scale));
181
181
  } break;
182
- case duckdb::LogicalTypeId::TIMESTAMP: {
182
+ case duckdb::LogicalTypeId::TIMESTAMP:
183
+ case duckdb::LogicalTypeId::TIMESTAMP_TZ: {
183
184
  value = Napi::Date::New(env, double(dval.GetValue<int64_t>() / duckdb::Interval::MICROS_PER_MSEC));
184
185
  } break;
185
186
  #endif
@@ -21,7 +21,7 @@ describe("data type support", function () {
21
21
  });
22
22
  });
23
23
  it("supports INTERVAL values", function (done) {
24
- db.prepare(`SELECT
24
+ db.prepare(`SELECT
25
25
  INTERVAL 1 MINUTE as minutes,
26
26
  INTERVAL 5 DAY as days,
27
27
  INTERVAL 4 MONTH as months,
@@ -34,4 +34,25 @@ describe("data type support", function () {
34
34
  done();
35
35
  });
36
36
  });
37
+ it("supports DATE values", function (done) {
38
+ db.prepare(`SELECT '2021-01-01'::DATE as dt;`).each((err, row) => {
39
+ assert(err === null);
40
+ assert.deepEqual(row.dt, new Date(Date.UTC(2021, 0, 1)));
41
+ done();
42
+ });
43
+ });
44
+ it("supports TIMESTAMP values", function (done) {
45
+ db.prepare(`SELECT '2021-01-01T00:00:00'::TIMESTAMP as ts;`).each((err, row) => {
46
+ assert(err === null);
47
+ assert.deepEqual(row.ts, new Date(Date.UTC(2021, 0, 1)));
48
+ done();
49
+ });
50
+ });
51
+ it("supports TIMESTAMP WITH TIME ZONE values", function (done) {
52
+ db.prepare(`SELECT '2021-01-01T00:00:00Z'::TIMESTAMPTZ as tstz;`).each((err, row) => {
53
+ assert(err === null);
54
+ assert.deepEqual(row.tstz, new Date(Date.UTC(2021, 0, 1)));
55
+ done();
56
+ });
57
+ });
37
58
  });
@@ -543,7 +543,7 @@ describe('prepare', function() {
543
543
  });
544
544
  it("should aggregate approx_count_distinct(flt)", function (done) {
545
545
  db.all("SELECT approx_count_distinct(flt) as approx_count_distinct FROM foo", function (err, res) {
546
- assert.ok(res[0].approx_count_distinct >= 1000);
546
+ assert.ok(res[0].approx_count_distinct >= 950);
547
547
  done(err);
548
548
  });
549
549
  });
@@ -587,7 +587,7 @@ describe('prepare', function() {
587
587
  });
588
588
  it("should aggregate approx_count_distinct(num)", function (done) {
589
589
  db.all("SELECT approx_count_distinct(num) as approx_count_distinct FROM foo", function (err, res) {
590
- assert.ok(res[0].approx_count_distinct >= 1000);
590
+ assert.ok(res[0].approx_count_distinct >= 950);
591
591
  done(err);
592
592
  });
593
593
  });