multi-db-orm
Advanced tools
Comparing version
@@ -66,3 +66,3 @@ const { MultiDbORM } = require("./multidb"); | ||
for (const key in filter) { | ||
where += `${key} = '${filter[key]}' AND `; | ||
where += `"${key}" = '${filter[key]}' AND `; | ||
} | ||
@@ -74,6 +74,6 @@ where += "1 = 1"; | ||
if (options.apply.ineq) { | ||
where += ` AND ${options.apply.field} ${options.apply.ineq.op} '${options.apply.ineq.value}'`; | ||
where += ` AND "${options.apply.field}" ${options.apply.ineq.op} '${options.apply.ineq.value}'`; | ||
} | ||
if (options.apply.sort) { | ||
sort = `ORDER BY ${options.apply.field} ${options.apply.sort}`; | ||
sort = `ORDER BY "${options.apply.field}" ${options.apply.sort}`; | ||
} | ||
@@ -83,3 +83,3 @@ } else if (options.sort) { | ||
for (let i = 0; i < options.sort.length; i++) { | ||
sort += ` ${options.sort[i].field} ${options.sort[i].order}`; | ||
sort += ` "${options.sort[i].field}" ${options.sort[i].order}`; | ||
if (i < options.sort.length - 1) { | ||
@@ -108,3 +108,3 @@ sort += ", "; | ||
for (const key in filter) { | ||
where += `${key} = '${filter[key]}' AND `; | ||
where += `"${key}" = '${filter[key]}' AND `; | ||
} | ||
@@ -139,5 +139,5 @@ where += "1 = 1"; | ||
if (key.toLowerCase().trim() === "id") { | ||
cols += `${key} ${type} PRIMARY KEY NOT NULL ,`; | ||
cols += `"${key}" ${type} PRIMARY KEY NOT NULL ,`; | ||
} else { | ||
cols += `${key} ${type},`; | ||
cols += `"${key}" ${type},`; | ||
} | ||
@@ -161,3 +161,3 @@ } | ||
for (const key in object) { | ||
cols = cols + `${key},`; | ||
cols = cols + `"${key}",`; | ||
let val = object[key]; | ||
@@ -196,3 +196,3 @@ if (typeof val == "object") val = JSON.stringify(object[key]); | ||
for (const key in filter) { | ||
where += `${key} = '${filter[key]}' AND `; | ||
where += `"${key}" = '${filter[key]}' AND `; | ||
} | ||
@@ -205,3 +205,3 @@ for (const key in object) { | ||
vals += `${key} = ${val},`; | ||
vals += `"${key}" = ${val},`; | ||
} | ||
@@ -226,3 +226,3 @@ where += "1 = 1"; | ||
for (const key in filter) { | ||
where += `${key} = '${filter[key]}' AND `; | ||
where += `"${key}" = '${filter[key]}' AND `; | ||
} | ||
@@ -229,0 +229,0 @@ where += "1 = 1"; |
{ | ||
"name": "multi-db-orm", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "CRUD , Backup , Restore and Migration library for multiple databases", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
77468
0.03%