@duckdb/duckdb-wasm 0.1.9 → 0.1.11

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.
@@ -15081,14 +15081,14 @@ return true;`);
15081
15081
  close() {
15082
15082
  this.bindings.closePrepared(this.connectionId, this.statementId);
15083
15083
  }
15084
- query(params) {
15084
+ query(...params) {
15085
15085
  const buffer = this.bindings.runPrepared(this.connectionId, this.statementId, params);
15086
15086
  const reader = arrow2.RecordBatchReader.from(buffer);
15087
15087
  console.assert(reader.isSync());
15088
15088
  console.assert(reader.isFile());
15089
15089
  return arrow2.Table.from(reader);
15090
15090
  }
15091
- send(params) {
15091
+ send(...params) {
15092
15092
  const header = this.bindings.sendPrepared(this.connectionId, this.statementId, params);
15093
15093
  const iter = new ResultStreamIterator(this.bindings, this.connectionId, header);
15094
15094
  const reader = arrow2.RecordBatchReader.from(iter);
@@ -20757,14 +20757,14 @@ return true;`);
20757
20757
  async close() {
20758
20758
  await this.bindings.closePrepared(this.connectionId, this.statementId);
20759
20759
  }
20760
- async run(params) {
20760
+ async query(...params) {
20761
20761
  const buffer = await this.bindings.runPrepared(this.connectionId, this.statementId, params);
20762
20762
  const reader = arrow4.RecordBatchReader.from(buffer);
20763
20763
  console.assert(reader.isSync());
20764
20764
  console.assert(reader.isFile());
20765
20765
  return arrow4.Table.from(reader);
20766
20766
  }
20767
- async send(params) {
20767
+ async send(...params) {
20768
20768
  const header = await this.bindings.sendPrepared(this.connectionId, this.statementId, params);
20769
20769
  const iter = new AsyncResultStreamIterator(this.bindings, this.connectionId, header);
20770
20770
  const reader = await arrow4.RecordBatchReader.from(iter);
@@ -21198,7 +21198,7 @@ return true;`);
21198
21198
 
21199
21199
  // package.json
21200
21200
  var name = "@duckdb/duckdb-wasm";
21201
- var version = "0.1.9";
21201
+ var version = "0.1.11";
21202
21202
  var description = "DuckDB powered by WebAssembly";
21203
21203
  var license = "MPL-2.0";
21204
21204
  var repository = {
@@ -21407,13 +21407,13 @@ return true;`);
21407
21407
  describe("Prepared Statement", () => {
21408
21408
  it("Materialized", async () => {
21409
21409
  const stmt = conn.prepare("SELECT v::INTEGER + ? AS v FROM generate_series(0, 10000) as t(v);");
21410
- const result = stmt.query([234]);
21410
+ const result = stmt.query(234);
21411
21411
  expect(result.length).toBe(10001);
21412
21412
  stmt.close();
21413
21413
  });
21414
21414
  it("Streaming", async () => {
21415
21415
  const stmt = conn.prepare("SELECT v::INTEGER + ? AS v FROM generate_series(0, 10000) as t(v);");
21416
- const stream = stmt.send([234]);
21416
+ const stream = stmt.send(234);
21417
21417
  let size = 0;
21418
21418
  for (const batch of stream) {
21419
21419
  size += batch.length;
@@ -21434,51 +21434,11 @@ return true;`);
21434
21434
  i VARCHAR(11) DEFAULT NULL
21435
21435
  )`);
21436
21436
  const stmt = conn.prepare("INSERT INTO typecheck VALUES(?,?,?,?,?,?,?,?,?)");
21437
- expect(() => stmt.query([true, 100, 1e4, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi"])).not.toThrow();
21438
- expect(() => stmt.query([
21439
- "test",
21440
- 100,
21441
- 1e4,
21442
- 1e6,
21443
- 5e9,
21444
- 0.5,
21445
- Math.PI,
21446
- "hello world",
21447
- "hi"
21448
- ])).toThrow();
21449
- expect(() => stmt.query([
21450
- true,
21451
- 1e4,
21452
- 1e4,
21453
- 1e6,
21454
- 5e9,
21455
- 0.5,
21456
- Math.PI,
21457
- "hello world",
21458
- "hi"
21459
- ])).toThrow();
21460
- expect(() => stmt.query([
21461
- true,
21462
- 100,
21463
- 1e6,
21464
- 1e6,
21465
- 5e9,
21466
- 0.5,
21467
- Math.PI,
21468
- "hello world",
21469
- "hi"
21470
- ])).toThrow();
21471
- expect(() => stmt.query([
21472
- true,
21473
- 100,
21474
- 1e4,
21475
- 5e9,
21476
- 5e9,
21477
- 0.5,
21478
- Math.PI,
21479
- "hello world",
21480
- "hi"
21481
- ])).toThrow();
21437
+ expect(() => stmt.query(true, 100, 1e4, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi")).not.toThrow();
21438
+ expect(() => stmt.query("test", 100, 1e4, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi")).toThrow();
21439
+ expect(() => stmt.query(true, 1e4, 1e4, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi")).toThrow();
21440
+ expect(() => stmt.query(true, 100, 1e6, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi")).toThrow();
21441
+ expect(() => stmt.query(true, 100, 1e4, 5e9, 5e9, 0.5, Math.PI, "hello world", "hi")).toThrow();
21482
21442
  conn.close();
21483
21443
  });
21484
21444
  });
@@ -21533,15 +21493,15 @@ return true;`);
21533
21493
  describe("Prepared Statement", () => {
21534
21494
  it("Materialized", async () => {
21535
21495
  const conn = await adb2().connect();
21536
- const stmt = await conn.prepare("SELECT v::INTEGER + ? AS v FROM generate_series(0, 10000) as t(v);");
21537
- const result = await stmt.run([234]);
21496
+ const stmt = await conn.prepare("SELECT v + ? FROM generate_series(0, 10000) as t(v);");
21497
+ const result = await stmt.query(234);
21538
21498
  expect(result.length).toBe(10001);
21539
21499
  await stmt.close();
21540
21500
  });
21541
21501
  it("Streaming", async () => {
21542
21502
  const conn = await adb2().connect();
21543
21503
  const stmt = await conn.prepare("SELECT v::INTEGER + ? AS v FROM generate_series(0, 10000) as t(v);");
21544
- const stream = await stmt.send([234]);
21504
+ const stream = await stmt.send(234);
21545
21505
  let size = 0;
21546
21506
  for await (const batch of stream) {
21547
21507
  size += batch.length;
@@ -21573,56 +21533,16 @@ return true;`);
21573
21533
  expect(throwed).toBe(true);
21574
21534
  };
21575
21535
  expectToThrow(async () => {
21576
- await stmt.run([
21577
- "test",
21578
- 100,
21579
- 1e4,
21580
- 1e6,
21581
- 5e9,
21582
- 0.5,
21583
- Math.PI,
21584
- "hello world",
21585
- "hi"
21586
- ]);
21536
+ await stmt.query("test", 100, 1e4, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi");
21587
21537
  });
21588
21538
  expectToThrow(async () => {
21589
- await stmt.run([
21590
- true,
21591
- 1e4,
21592
- 1e4,
21593
- 1e6,
21594
- 5e9,
21595
- 0.5,
21596
- Math.PI,
21597
- "hello world",
21598
- "hi"
21599
- ]);
21539
+ await stmt.query(true, 1e4, 1e4, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi");
21600
21540
  });
21601
21541
  expectToThrow(async () => {
21602
- await stmt.run([
21603
- true,
21604
- 100,
21605
- 1e6,
21606
- 1e6,
21607
- 5e9,
21608
- 0.5,
21609
- Math.PI,
21610
- "hello world",
21611
- "hi"
21612
- ]);
21542
+ await stmt.query(true, 100, 1e6, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi");
21613
21543
  });
21614
21544
  expectToThrow(async () => {
21615
- await stmt.run([
21616
- true,
21617
- 100,
21618
- 1e4,
21619
- 5e9,
21620
- 5e9,
21621
- 0.5,
21622
- Math.PI,
21623
- "hello world",
21624
- "hi"
21625
- ]);
21545
+ await stmt.query(true, 100, 1e4, 5e9, 5e9, 0.5, Math.PI, "hello world", "hi");
21626
21546
  });
21627
21547
  await conn.close();
21628
21548
  });