@mikro-orm/mssql 6.6.14-dev.0 → 6.6.14-dev.2
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/MsSqlPlatform.js +8 -5
- package/package.json +3 -3
package/MsSqlPlatform.js
CHANGED
|
@@ -145,17 +145,20 @@ class MsSqlPlatform extends knex_1.AbstractSqlPlatform {
|
|
|
145
145
|
getSearchJsonPropertyKey(path, type, aliased, value) {
|
|
146
146
|
const [a, ...b] = path;
|
|
147
147
|
/* istanbul ignore next */
|
|
148
|
-
const root =
|
|
148
|
+
const root = aliased ? `[${knex_1.ALIAS_REPLACEMENT}].${this.quoteIdentifier(a)}` : this.quoteIdentifier(a);
|
|
149
149
|
const types = {
|
|
150
150
|
boolean: 'bit',
|
|
151
151
|
};
|
|
152
152
|
const cast = (key) => (0, knex_1.raw)(type in types ? `cast(${key} as ${types[type]})` : key);
|
|
153
|
-
const quoteKey = (key) => key.match(/^[a-z]\w*$/i)
|
|
153
|
+
const quoteKey = (key) => key.match(/^[a-z]\w*$/i)
|
|
154
|
+
? key
|
|
155
|
+
: `"${key.replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`;
|
|
156
|
+
const jsonPath = this.quoteValue(`$.${b.map(quoteKey).join('.')}`);
|
|
154
157
|
/* istanbul ignore if */
|
|
155
158
|
if (path.length === 0) {
|
|
156
|
-
return cast(`json_value(${root},
|
|
159
|
+
return cast(`json_value(${root}, ${jsonPath})`);
|
|
157
160
|
}
|
|
158
|
-
return cast(`json_value(${root},
|
|
161
|
+
return cast(`json_value(${root}, ${jsonPath})`);
|
|
159
162
|
}
|
|
160
163
|
normalizePrimaryKey(data) {
|
|
161
164
|
/* istanbul ignore if */
|
|
@@ -171,7 +174,7 @@ class MsSqlPlatform extends knex_1.AbstractSqlPlatform {
|
|
|
171
174
|
return true;
|
|
172
175
|
}
|
|
173
176
|
quoteIdentifier(id) {
|
|
174
|
-
return `[${id.toString().replace('.', `].[`)}]`;
|
|
177
|
+
return `[${id.toString().replaceAll(']', ']]').replace('.', `].[`)}]`;
|
|
175
178
|
}
|
|
176
179
|
escape(value) {
|
|
177
180
|
if (value instanceof UnicodeStringType_1.UnicodeString) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mssql",
|
|
3
|
-
"version": "6.6.14-dev.
|
|
3
|
+
"version": "6.6.14-dev.2",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@mikro-orm/knex": "6.6.14-dev.
|
|
61
|
+
"@mikro-orm/knex": "6.6.14-dev.2",
|
|
62
62
|
"tedious": "19.2.1",
|
|
63
63
|
"tsqlstring": "1.0.1"
|
|
64
64
|
},
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.6.13"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.6.14-dev.
|
|
69
|
+
"@mikro-orm/core": "6.6.14-dev.2"
|
|
70
70
|
}
|
|
71
71
|
}
|