spice-couchbase 2.0.28 → 2.0.29
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 +1 -1
- package/src/index.js +14 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -531,12 +531,25 @@ module.exports = class Database {
|
|
|
531
531
|
return response.rows;
|
|
532
532
|
}
|
|
533
533
|
|
|
534
|
-
async query(query, query_scope = "cluster") {
|
|
534
|
+
/* async query(query, query_scope = "cluster") {
|
|
535
535
|
let scope = query_scope || this.query_scope;
|
|
536
536
|
if (scope == "cluster") {
|
|
537
537
|
return await this.cluster.query(query);
|
|
538
538
|
} else {
|
|
539
539
|
return await this.scope.query(query);
|
|
540
540
|
}
|
|
541
|
+
} */
|
|
542
|
+
|
|
543
|
+
async query(query, query_scope = "cluster") {
|
|
544
|
+
let scope = query_scope || this.query_scope;
|
|
545
|
+
|
|
546
|
+
// Escape the query string
|
|
547
|
+
const sanitizedQuery = couchbase.N1qlQuery.fromString(query).toString();
|
|
548
|
+
|
|
549
|
+
if (scope === "cluster") {
|
|
550
|
+
return await this.cluster.query(sanitizedQuery);
|
|
551
|
+
} else {
|
|
552
|
+
return await this.scope.query(sanitizedQuery);
|
|
553
|
+
}
|
|
541
554
|
}
|
|
542
555
|
};
|