badmfck-api-server 1.9.8 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -56,8 +56,8 @@ export declare class MysqlService extends BaseService {
|
|
56
56
|
init(): Promise<void>;
|
57
57
|
recreatePool(): Promise<void>;
|
58
58
|
onApplicationReady(): Promise<void>;
|
59
|
-
static fieldsToObject(fields: MysqlQueryField[]): MysqlQueryFieldObject;
|
60
|
-
static objectToFields(obj: MysqlQueryFieldObject): MysqlQueryField[];
|
59
|
+
static fieldsToObject(fields: MysqlQueryField[] | MysqlQueryFieldObject, ignoreSystemParameters?: boolean): MysqlQueryFieldObject;
|
60
|
+
static objectToFields(obj: MysqlQueryFieldObject | MysqlQueryField[]): MysqlQueryField[];
|
61
61
|
static prepareQuery(query: string, fields: MysqlQueryField[] | MysqlQueryFieldObject): string;
|
62
62
|
static prepareQueryFieldValue(value: string | number | boolean | null | undefined, system?: boolean): string | number | boolean | null | undefined;
|
63
63
|
execute(query: string): Promise<MysqlResult>;
|
@@ -88,7 +88,9 @@ class MysqlService extends BaseService_1.BaseService {
|
|
88
88
|
}
|
89
89
|
}
|
90
90
|
async onApplicationReady() { }
|
91
|
-
static fieldsToObject(fields) {
|
91
|
+
static fieldsToObject(fields, ignoreSystemParameters) {
|
92
|
+
if (!Array.isArray(fields))
|
93
|
+
return fields;
|
92
94
|
const obj = {};
|
93
95
|
for (let i of fields) {
|
94
96
|
if (!i.name)
|
@@ -96,18 +98,24 @@ class MysqlService extends BaseService_1.BaseService {
|
|
96
98
|
if (typeof i.value !== "object")
|
97
99
|
obj[i.name] = i.value;
|
98
100
|
else {
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
if (!ignoreSystemParameters) {
|
102
|
+
obj[i.name] = {
|
103
|
+
value: i.value,
|
104
|
+
system: i.system,
|
105
|
+
ignoreInInsert: i.ignoreInInsert,
|
106
|
+
ignoreInUpdate: i.ignoreInUpdate,
|
107
|
+
useInReplace: i.useInReplace
|
108
|
+
};
|
109
|
+
}
|
110
|
+
else
|
111
|
+
obj[i.name] = i.value;
|
106
112
|
}
|
107
113
|
}
|
108
114
|
return obj;
|
109
115
|
}
|
110
116
|
static objectToFields(obj) {
|
117
|
+
if (Array.isArray(obj))
|
118
|
+
return obj;
|
111
119
|
const fields = [];
|
112
120
|
for (let i in obj) {
|
113
121
|
if (typeof obj[i] === "object") {
|