mirror of
https://github.com/frappe/books.git
synced 2025-01-11 18:38:47 +00:00
log errors
This commit is contained in:
parent
8144761004
commit
ddfd9a7e11
@ -154,24 +154,26 @@ module.exports = class sqliteDatabase extends Database {
|
|||||||
await frappe.db.run('delete from SingleValue where parent=?', name)
|
await frappe.db.run('delete from SingleValue where parent=?', name)
|
||||||
}
|
}
|
||||||
|
|
||||||
getAll({ doctype, fields, filters, start, limit, order_by = 'modified', order = 'desc' } = {}) {
|
getAll({ doctype, fields, filters, start, limit, orderBy = 'modified', order = 'desc' } = {}) {
|
||||||
if (!fields) {
|
if (!fields) {
|
||||||
fields = frappe.getMeta(doctype).getKeywordFields();
|
fields = frappe.getMeta(doctype).getKeywordFields();
|
||||||
}
|
}
|
||||||
if (typeof fields === 'string') {
|
if (typeof fields === 'string') {
|
||||||
fields = [fields];
|
fields = [fields];
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let conditions = this.getFilterConditions(filters);
|
let conditions = this.getFilterConditions(filters);
|
||||||
let query = `select ${fields.join(", ")}
|
let query = `select ${fields.join(", ")}
|
||||||
from ${doctype}
|
from ${doctype}
|
||||||
${conditions.conditions ? "where" : ""} ${conditions.conditions}
|
${conditions.conditions ? "where" : ""} ${conditions.conditions}
|
||||||
${order_by ? ("order by " + order_by) : ""} ${order_by ? (order || "asc") : ""}
|
${orderBy ? ("order by " + orderBy) : ""} ${orderBy ? (order || "asc") : ""}
|
||||||
${limit ? ("limit " + limit) : ""} ${start ? ("offset " + start) : ""}`;
|
${limit ? ("limit " + limit) : ""} ${start ? ("offset " + start) : ""}`;
|
||||||
|
|
||||||
this.conn.all(query, conditions.values,
|
this.conn.all(query, conditions.values,
|
||||||
(err, rows) => {
|
(err, rows) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
console.error(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
resolve(rows);
|
resolve(rows);
|
||||||
@ -184,9 +186,7 @@ module.exports = class sqliteDatabase extends Database {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.conn.run(query, params, (err) => {
|
this.conn.run(query, params, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (debug) {
|
console.error(err);
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
|
Loading…
Reference in New Issue
Block a user