workers-qb 1.6.5 → 1.6.7
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 +10 -15
- package/dist/index.mjs +10 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -524,8 +524,9 @@ var QueryBuilder = class {
|
|
|
524
524
|
conditions = value.conditions;
|
|
525
525
|
}
|
|
526
526
|
if (typeof conditions === "string") return ` WHERE ${conditions.toString()}`;
|
|
527
|
-
if (conditions.length
|
|
528
|
-
|
|
527
|
+
if (conditions.length === 1) return ` WHERE ${conditions[0].toString()}`;
|
|
528
|
+
if (conditions.length > 1) {
|
|
529
|
+
return ` WHERE (${conditions.join(") AND (")})`;
|
|
529
530
|
}
|
|
530
531
|
return "";
|
|
531
532
|
}
|
|
@@ -712,26 +713,20 @@ var DOQB = class extends QueryBuilder {
|
|
|
712
713
|
}
|
|
713
714
|
execute(query) {
|
|
714
715
|
return this.loggerWrapper(query, this.options.logger, () => {
|
|
716
|
+
let cursor;
|
|
715
717
|
if (query.arguments) {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
return {
|
|
720
|
-
results: Array.from(result)[0]
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
return {
|
|
724
|
-
results: Array.from(result)
|
|
725
|
-
};
|
|
718
|
+
cursor = this.db.exec(query.query, ...query.arguments);
|
|
719
|
+
} else {
|
|
720
|
+
cursor = this.db.exec(query.query);
|
|
726
721
|
}
|
|
727
|
-
const
|
|
722
|
+
const result = cursor.toArray();
|
|
728
723
|
if (query.fetchType == "ONE" /* ONE */) {
|
|
729
724
|
return {
|
|
730
|
-
results:
|
|
725
|
+
results: result.length > 0 ? result[0] : void 0
|
|
731
726
|
};
|
|
732
727
|
}
|
|
733
728
|
return {
|
|
734
|
-
results:
|
|
729
|
+
results: result
|
|
735
730
|
};
|
|
736
731
|
});
|
|
737
732
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -484,8 +484,9 @@ var QueryBuilder = class {
|
|
|
484
484
|
conditions = value.conditions;
|
|
485
485
|
}
|
|
486
486
|
if (typeof conditions === "string") return ` WHERE ${conditions.toString()}`;
|
|
487
|
-
if (conditions.length
|
|
488
|
-
|
|
487
|
+
if (conditions.length === 1) return ` WHERE ${conditions[0].toString()}`;
|
|
488
|
+
if (conditions.length > 1) {
|
|
489
|
+
return ` WHERE (${conditions.join(") AND (")})`;
|
|
489
490
|
}
|
|
490
491
|
return "";
|
|
491
492
|
}
|
|
@@ -672,26 +673,20 @@ var DOQB = class extends QueryBuilder {
|
|
|
672
673
|
}
|
|
673
674
|
execute(query) {
|
|
674
675
|
return this.loggerWrapper(query, this.options.logger, () => {
|
|
676
|
+
let cursor;
|
|
675
677
|
if (query.arguments) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
return {
|
|
680
|
-
results: Array.from(result)[0]
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
return {
|
|
684
|
-
results: Array.from(result)
|
|
685
|
-
};
|
|
678
|
+
cursor = this.db.exec(query.query, ...query.arguments);
|
|
679
|
+
} else {
|
|
680
|
+
cursor = this.db.exec(query.query);
|
|
686
681
|
}
|
|
687
|
-
const
|
|
682
|
+
const result = cursor.toArray();
|
|
688
683
|
if (query.fetchType == "ONE" /* ONE */) {
|
|
689
684
|
return {
|
|
690
|
-
results:
|
|
685
|
+
results: result.length > 0 ? result[0] : void 0
|
|
691
686
|
};
|
|
692
687
|
}
|
|
693
688
|
return {
|
|
694
|
-
results:
|
|
689
|
+
results: result
|
|
695
690
|
};
|
|
696
691
|
});
|
|
697
692
|
}
|