workers-qb 1.6.5 → 1.6.6

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/dist/index.js CHANGED
@@ -712,26 +712,20 @@ var DOQB = class extends QueryBuilder {
712
712
  }
713
713
  execute(query) {
714
714
  return this.loggerWrapper(query, this.options.logger, () => {
715
+ let cursor;
715
716
  if (query.arguments) {
716
- let stmt = this.db.prepare(query.query);
717
- const result = stmt(...query.arguments);
718
- if (query.fetchType == "ONE" /* ONE */) {
719
- return {
720
- results: Array.from(result)[0]
721
- };
722
- }
723
- return {
724
- results: Array.from(result)
725
- };
717
+ cursor = this.db.exec(query.query, ...query.arguments);
718
+ } else {
719
+ cursor = this.db.exec(query.query);
726
720
  }
727
- const cursor = this.db.exec(query.query);
721
+ const result = cursor.toArray();
728
722
  if (query.fetchType == "ONE" /* ONE */) {
729
723
  return {
730
- results: Array.from(cursor)[0]
724
+ results: result.length > 0 ? result[0] : void 0
731
725
  };
732
726
  }
733
727
  return {
734
- results: Array.from(cursor)
728
+ results: result
735
729
  };
736
730
  });
737
731
  }
package/dist/index.mjs CHANGED
@@ -672,26 +672,20 @@ var DOQB = class extends QueryBuilder {
672
672
  }
673
673
  execute(query) {
674
674
  return this.loggerWrapper(query, this.options.logger, () => {
675
+ let cursor;
675
676
  if (query.arguments) {
676
- let stmt = this.db.prepare(query.query);
677
- const result = stmt(...query.arguments);
678
- if (query.fetchType == "ONE" /* ONE */) {
679
- return {
680
- results: Array.from(result)[0]
681
- };
682
- }
683
- return {
684
- results: Array.from(result)
685
- };
677
+ cursor = this.db.exec(query.query, ...query.arguments);
678
+ } else {
679
+ cursor = this.db.exec(query.query);
686
680
  }
687
- const cursor = this.db.exec(query.query);
681
+ const result = cursor.toArray();
688
682
  if (query.fetchType == "ONE" /* ONE */) {
689
683
  return {
690
- results: Array.from(cursor)[0]
684
+ results: result.length > 0 ? result[0] : void 0
691
685
  };
692
686
  }
693
687
  return {
694
- results: Array.from(cursor)
688
+ results: result
695
689
  };
696
690
  });
697
691
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workers-qb",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "Zero dependencies Query Builder for Cloudflare Workers",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",