@oino-ts/db-mariadb 0.3.4 → 0.4.1
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.
|
@@ -222,9 +222,18 @@ class OINODbMariadb extends db_1.OINODb {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
else {
|
|
225
|
-
return
|
|
225
|
+
return this.printSqlString(cellValue?.toString());
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Print a single string value as valid sql literal
|
|
230
|
+
*
|
|
231
|
+
* @param sqlString string value
|
|
232
|
+
*
|
|
233
|
+
*/
|
|
234
|
+
printSqlString(sqlString) {
|
|
235
|
+
return "\"" + sqlString.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\r", "\\r").replaceAll("\n", "\\n").replaceAll("\t", "\\t") + "\"";
|
|
236
|
+
}
|
|
228
237
|
/**
|
|
229
238
|
* Parse a single SQL result value for serialization using the context of the native data
|
|
230
239
|
* type.
|
|
@@ -219,9 +219,18 @@ export class OINODbMariadb extends OINODb {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
else {
|
|
222
|
-
return
|
|
222
|
+
return this.printSqlString(cellValue?.toString());
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Print a single string value as valid sql literal
|
|
227
|
+
*
|
|
228
|
+
* @param sqlString string value
|
|
229
|
+
*
|
|
230
|
+
*/
|
|
231
|
+
printSqlString(sqlString) {
|
|
232
|
+
return "\"" + sqlString.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\r", "\\r").replaceAll("\n", "\\n").replaceAll("\t", "\\t") + "\"";
|
|
233
|
+
}
|
|
225
234
|
/**
|
|
226
235
|
* Parse a single SQL result value for serialization using the context of the native data
|
|
227
236
|
* type.
|
|
@@ -38,6 +38,13 @@ export declare class OINODbMariadb extends OINODb {
|
|
|
38
38
|
*
|
|
39
39
|
*/
|
|
40
40
|
printCellAsSqlValue(cellValue: OINODataCell, sqlType: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Print a single string value as valid sql literal
|
|
43
|
+
*
|
|
44
|
+
* @param sqlString string value
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
printSqlString(sqlString: string): string;
|
|
41
48
|
/**
|
|
42
49
|
* Parse a single SQL result value for serialization using the context of the native data
|
|
43
50
|
* type.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oino-ts/db-mariadb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "OINO TS package for using Mariadb databases.",
|
|
5
5
|
"author": "Matias Kiviniemi (pragmatta)",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"module": "./dist/esm/index.js",
|
|
22
22
|
"types": "./dist/types/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@oino-ts/db": "^0.
|
|
24
|
+
"@oino-ts/db": "^0.4.1",
|
|
25
25
|
"mariadb": "^3.2.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
package/src/OINODbMariadb.ts
CHANGED
|
@@ -233,10 +233,21 @@ export class OINODbMariadb extends OINODb {
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
} else {
|
|
236
|
-
return
|
|
236
|
+
return this.printSqlString(cellValue?.toString())
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Print a single string value as valid sql literal
|
|
242
|
+
*
|
|
243
|
+
* @param sqlString string value
|
|
244
|
+
*
|
|
245
|
+
*/
|
|
246
|
+
printSqlString(sqlString:string): string {
|
|
247
|
+
return "\"" + sqlString.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"").replaceAll("\r", "\\r").replaceAll("\n", "\\n").replaceAll("\t", "\\t") + "\""
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
|
|
240
251
|
/**
|
|
241
252
|
* Parse a single SQL result value for serialization using the context of the native data
|
|
242
253
|
* type.
|