@memberjunction/sqlserver-dataprovider 6.2.0-edge.6 → 6.2.0-edge.8
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/dist/SQLServerDataProvider.d.ts +39 -8
- package/dist/SQLServerDataProvider.d.ts.map +1 -1
- package/dist/SQLServerDataProvider.js +262 -34
- package/dist/SQLServerDataProvider.js.map +1 -1
- package/dist/SQLServerTransactionGroup.d.ts +19 -1
- package/dist/SQLServerTransactionGroup.d.ts.map +1 -1
- package/dist/SQLServerTransactionGroup.js +179 -93
- package/dist/SQLServerTransactionGroup.js.map +1 -1
- package/dist/saveParameters.d.ts +8 -3
- package/dist/saveParameters.d.ts.map +1 -1
- package/dist/saveParameters.js +20 -2
- package/dist/saveParameters.js.map +1 -1
- package/dist/statementDescription.d.ts +31 -0
- package/dist/statementDescription.d.ts.map +1 -0
- package/dist/statementDescription.js +46 -0
- package/dist/statementDescription.js.map +1 -0
- package/dist/typedParameters.d.ts +15 -0
- package/dist/typedParameters.d.ts.map +1 -0
- package/dist/typedParameters.js +85 -0
- package/dist/typedParameters.js.map +1 -0
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +16 -16
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import { BaseEntity, IEntityDataProvider, IMetadataProvider, EntityInfo, EntityFieldInfo, ProviderType, UserInfo, PostCommitToken, IFileSystemProvider, TransactionGroupBase, EntitySaveOptions, EntityDependency, GetRecordDependenciesOptions, CompositeKey, BaseEntityResult, DeleteSQLResult, RunViewWithCacheCheckParams, RunQueryWithCacheCheckParams, RestoreContext, CloneContext, RecordChangeSource, RecordChangePayload, EntityDeleteOptions } from '@memberjunction/core';
|
|
19
19
|
import { EntityAIActionParams } from '@memberjunction/aiengine';
|
|
20
20
|
import { GenericDatabaseProvider, ExecuteSQLBatchOptions, SaveCoercedValue, SaveCallBinding, SaveSQLFragment, SaveReturnContext } from '@memberjunction/generic-database-provider';
|
|
21
|
+
import type { DatabasePoolStats, DescribeStatementResult } from '@memberjunction/generic-database-provider';
|
|
21
22
|
import { MJQueryEntityExtended } from '@memberjunction/core-entities';
|
|
22
23
|
import sql from 'mssql';
|
|
23
24
|
import { Observable } from 'rxjs';
|
|
@@ -100,19 +101,25 @@ export declare class SQLServerDataProvider extends GenericDatabaseProvider imple
|
|
|
100
101
|
* `sys.columns` scan in {@link loadViewColumnOrderCache} ran once or twice on EVERY request
|
|
101
102
|
* (issue #3102 — ~9.6k scans/day in production vs the ~2 needed).
|
|
102
103
|
*
|
|
103
|
-
* Keyed by
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
104
|
+
* Keyed by normalized database target AND login (`user@server:port[/instance]/database`) when
|
|
105
|
+
* `ConnectionPool.config` exposes them — so pools opened with the same login against the SAME
|
|
106
|
+
* database (per-request RW providers around the boot-time pool) share one `sys.columns` scan and
|
|
107
|
+
* one cross-pool invalidation domain, while pools pointing to DIFFERENT databases, or using a
|
|
108
|
+
* different login (read-only, CodeGen), stay isolated: `sys.columns` only lists objects the login
|
|
109
|
+
* can see, so one login's scan must never stand in for another's. Pools without `config.user`
|
|
110
|
+
* (token/integrated auth) share by target alone. Falls back to `_viewColumnOrderCacheByPool`
|
|
111
|
+
* (`WeakMap`) when a pool object does not expose `config.server` + `config.database` (e.g.
|
|
112
|
+
* lightweight test doubles).
|
|
109
113
|
*
|
|
110
114
|
* The value is the load PROMISE (not the resolved Map) so concurrent per-request Config() calls
|
|
111
115
|
* de-duplicate onto a single in-flight scan. Invalidated on metadata refresh (see
|
|
112
116
|
* {@link Refresh} / {@link InvalidateViewColumnOrderCache}) so view changes from
|
|
113
|
-
* migrations/CodeGen are picked up without a server restart.
|
|
117
|
+
* migrations/CodeGen are picked up across all pools targeting that database without a server restart.
|
|
114
118
|
*/
|
|
115
119
|
private static _viewColumnOrderCacheByPool;
|
|
120
|
+
private static readonly _viewColumnOrderCacheByDbKey;
|
|
121
|
+
private static readonly DEFAULT_SQL_SERVER_PORT;
|
|
122
|
+
private static viewColumnOrderDbKey;
|
|
116
123
|
/**
|
|
117
124
|
* How long commit/rollback wait for a request that bypassed the instance SQL queue before failing
|
|
118
125
|
* loudly. Instance-level so a test can shorten it; production leaves the default.
|
|
@@ -237,6 +244,8 @@ export declare class SQLServerDataProvider extends GenericDatabaseProvider imple
|
|
|
237
244
|
* @returns The mssql ConnectionPool object
|
|
238
245
|
*/
|
|
239
246
|
get DatabaseConnection(): any;
|
|
247
|
+
/** Reads the live counts from the mssql connection pool, or `null` before the pool is set. */
|
|
248
|
+
GetPoolStats(): DatabasePoolStats | null;
|
|
240
249
|
/**
|
|
241
250
|
* For the SQLServerDataProvider the unique instance connection string which is used to identify, uniquely, a given connection is the following format:
|
|
242
251
|
* mssql://host:port/instanceName?/database
|
|
@@ -571,6 +580,7 @@ export declare class SQLServerDataProvider extends GenericDatabaseProvider imple
|
|
|
571
580
|
* here with a message that says so, instead of a batch-size error from the server.
|
|
572
581
|
*/
|
|
573
582
|
static MaxInlineBinaryBytes: number;
|
|
583
|
+
private decodeBinaryFieldBytes;
|
|
574
584
|
protected FormatBinaryLiteral(field: EntityFieldInfo, value: unknown): string;
|
|
575
585
|
/**
|
|
576
586
|
* Returns a string that packages the parameter value for the stored procedure call.
|
|
@@ -688,10 +698,20 @@ export declare class SQLServerDataProvider extends GenericDatabaseProvider imple
|
|
|
688
698
|
* This method can be used to execute raw SQL statements outside of the MJ infrastructure.
|
|
689
699
|
* *CAUTION* - use this method with great care.
|
|
690
700
|
* @param query
|
|
691
|
-
* @param parameters
|
|
701
|
+
* @param parameters - Named parameters: an object (`{ name: value }`, referenced `@name`), or a list of
|
|
702
|
+
* `NamedQueryParameter` / `TypedQueryParameter`. A plain array of values is the LEGACY positional form:
|
|
703
|
+
* it binds `@p0..@pN` and rewrites every `?` in `query`, a `?` inside a string literal, quoted
|
|
704
|
+
* identifier or comment included, so it is only safe for statement text with no other `?`.
|
|
692
705
|
* @returns
|
|
693
706
|
*/
|
|
694
707
|
ExecuteSQL(query: string, parameters?: any, options?: ExecuteSQLOptions, contextUser?: UserInfo): Promise<any>;
|
|
708
|
+
/**
|
|
709
|
+
* Describes the first result set of `sqlText` with `sys.dm_exec_describe_first_result_set` (mode 2):
|
|
710
|
+
* names, order, exact types, nullability and the view or table column each pass-through column
|
|
711
|
+
* comes from. SQL Server compiles the statement without executing it. A statement the server
|
|
712
|
+
* cannot compile gives a failure carrying the server's message.
|
|
713
|
+
*/
|
|
714
|
+
DescribeStatement(sqlText: string, contextUser?: UserInfo): Promise<DescribeStatementResult>;
|
|
695
715
|
get ColocatedDialect(): DatabasePlatform;
|
|
696
716
|
get ColocatedSchema(): string;
|
|
697
717
|
/**
|
|
@@ -775,6 +795,7 @@ export declare class SQLServerDataProvider extends GenericDatabaseProvider imple
|
|
|
775
795
|
* so the same generation logic produces correct SQL on any future platform.
|
|
776
796
|
*/
|
|
777
797
|
protected BuildChildDiscoverySQL(childEntities: EntityInfo[], recordPKValue: string): string;
|
|
798
|
+
protected BuildChildDiscoveryBatchSQL(childEntities: EntityInfo[], recordPKValues: string[]): string;
|
|
778
799
|
/**************************************************************************
|
|
779
800
|
* IS-A Overlapping Subtype — Record Change Propagation
|
|
780
801
|
*
|
|
@@ -832,6 +853,16 @@ export declare class SQLServerDataProvider extends GenericDatabaseProvider imple
|
|
|
832
853
|
*/
|
|
833
854
|
RefreshIfNeeded(providerToUse?: IMetadataProvider, bypassMinCheckInterval?: boolean): Promise<boolean>;
|
|
834
855
|
get FileSystemProvider(): IFileSystemProvider;
|
|
856
|
+
/**
|
|
857
|
+
* Returns the currently active physical `mssql.Transaction` handle managed by this provider,
|
|
858
|
+
* or `null` when no physical transaction is open.
|
|
859
|
+
*/
|
|
860
|
+
get ActiveTransactionHandle(): sql.Transaction | null;
|
|
861
|
+
/**
|
|
862
|
+
* Executes a `mssql` request callback against `transaction`, serialized through this provider's
|
|
863
|
+
* transaction SQL queue when `transaction` is the provider's active transaction handle.
|
|
864
|
+
*/
|
|
865
|
+
ExecuteOnTransactionHandle<TRow>(transaction: sql.Transaction, description: string, run: (tx: sql.Transaction) => Promise<sql.IResult<TRow>>): Promise<sql.IResult<TRow>>;
|
|
835
866
|
CreateTransactionGroup(): Promise<TransactionGroupBase>;
|
|
836
867
|
/**************************************************************************/
|
|
837
868
|
/**************************************************************************/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SQLServerDataProvider.d.ts","sourceRoot":"","sources":["../src/SQLServerDataProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;gHAIgH;AAEhH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EAEjB,UAAU,EACV,eAAe,EAGf,YAAY,EACZ,QAAQ,EACR,eAAe,EAEf,mBAAmB,EACnB,oBAAoB,EAGpB,iBAAiB,EAKjB,gBAAgB,EAChB,4BAA4B,EAG5B,YAAY,EACZ,gBAAgB,EAIhB,eAAe,EACf,2BAA2B,EAG3B,4BAA4B,EAE5B,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AACnL,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,OAAO,EAAmB,UAAU,EAA4C,MAAM,MAAM,CAAC;AAU7F,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAG5B,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAC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1C,WAAW,EAAE,GAAG,CAAC,WAAW,EAC5B,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,CAAC,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GACvD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAwBhB,sBAAsB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAIpE,4EAA4E;IAE5E,4EAA4E;IAC5E,SAAS,KAAK,QAAQ,IAAI,iBAAiB,CAE1C;CACF"}
|
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
* In practice - this FILE will NOT exist in the entities library, we need to move to its own separate project
|
|
16
16
|
* so it is only included by the consumer of the entities library if they want to use it.
|
|
17
17
|
**************************************************************************************************************/
|
|
18
|
-
import { EntityFieldTSType, ProviderType, LogError, LogStatus, LogStatusEx, CompositeKey, } from '@memberjunction/core';
|
|
18
|
+
import { EntityFieldTSType, ProviderType, LogError, LogStatus, LogStatusEx, CompositeKey, GetDiagnosticContext, } from '@memberjunction/core';
|
|
19
19
|
import { NodeFileSystemProvider } from './NodeFileSystemProvider.js';
|
|
20
20
|
import { QueueManager } from '@memberjunction/queue';
|
|
21
|
-
import { GenericDatabaseProvider } from '@memberjunction/generic-database-provider';
|
|
21
|
+
import { GenericDatabaseProvider, IsTypedQueryParameterList, IsNamedQueryParameterList, TypedQueryParameter, DescribeStatementFailure, SummarizeSqlParameters, FormatSqlParameterTypesForError, } from '@memberjunction/generic-database-provider';
|
|
22
|
+
import { BindTypedParameters } from './typedParameters.js';
|
|
23
|
+
import { MapSQLServerDescribeRows, SQLSERVER_DESCRIBE_SQL } from './statementDescription.js';
|
|
22
24
|
import sql from 'mssql';
|
|
23
25
|
import { BehaviorSubject, Subject, concatMap, from, catchError, of } from 'rxjs';
|
|
24
26
|
import { SQLServerTransactionGroup } from './SQLServerTransactionGroup.js';
|
|
@@ -60,7 +62,11 @@ function isStaleConnectionError(error) {
|
|
|
60
62
|
code === 'ECONNRESET');
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
63
|
-
* Builds a sql.Request
|
|
65
|
+
* Builds a sql.Request and binds `parameters`:
|
|
66
|
+
* - a SaveParameter list, a TypedQueryParameter list or a NamedQueryParameter list binds each by name;
|
|
67
|
+
* - a plain object binds each key by name (`{ name: v }` for `@name`);
|
|
68
|
+
* - a plain array is the LEGACY positional form: `@p0..@pN`, with every `?` in the statement rewritten,
|
|
69
|
+
* including one inside a string literal, quoted identifier or comment. Prefer a named form.
|
|
64
70
|
*/
|
|
65
71
|
function buildRequest(connectionSource, query, parameters) {
|
|
66
72
|
// Note: The branch looks redundant but is required for TypeScript type narrowing.
|
|
@@ -80,10 +86,25 @@ function buildRequest(connectionSource, query, parameters) {
|
|
|
80
86
|
}
|
|
81
87
|
return { request, processedQuery: query };
|
|
82
88
|
}
|
|
89
|
+
if (IsTypedQueryParameterList(parameters)) {
|
|
90
|
+
// Named inputs declared with the types of the columns they are compared with (typedParameters.ts).
|
|
91
|
+
BindTypedParameters(request, parameters);
|
|
92
|
+
return { request, processedQuery: query };
|
|
93
|
+
}
|
|
94
|
+
if (IsNamedQueryParameterList(parameters)) {
|
|
95
|
+
// Named inputs whose type the driver infers; the statement already references them by name.
|
|
96
|
+
for (const p of parameters) {
|
|
97
|
+
request.input(p.Name, p.Value);
|
|
98
|
+
}
|
|
99
|
+
return { request, processedQuery: query };
|
|
100
|
+
}
|
|
83
101
|
let processedQuery = query;
|
|
84
102
|
if (parameters) {
|
|
85
103
|
if (Array.isArray(parameters)) {
|
|
86
|
-
//
|
|
104
|
+
// LEGACY positional form: values bind as @p0..@pN and EVERY `?` in the text is rewritten to the
|
|
105
|
+
// next @pN, a `?` inside a string literal, quoted identifier or comment included. Kept for
|
|
106
|
+
// existing callers; MJ's own SQL passes named parameters (an object, NamedQueryParameter or
|
|
107
|
+
// TypedQueryParameter lists), which leave the text alone.
|
|
87
108
|
parameters.forEach((value, index) => {
|
|
88
109
|
request.input(`p${index}`, value);
|
|
89
110
|
});
|
|
@@ -158,20 +179,48 @@ async function executeSQLCore(query, parameters, context, options, isRetry = fal
|
|
|
158
179
|
error.code = 'POOL_CLOSED';
|
|
159
180
|
throw error;
|
|
160
181
|
}
|
|
182
|
+
const startTs = Date.now();
|
|
183
|
+
const startHr = typeof performance !== 'undefined' && performance.now ? performance.now() : startTs;
|
|
184
|
+
const diagCtx = options?.diagnosticContext ?? GetDiagnosticContext();
|
|
161
185
|
try {
|
|
162
186
|
const { request, processedQuery } = buildRequest(connectionSource, query, parameters);
|
|
163
187
|
const queryPromise = options?.timeoutMs
|
|
164
188
|
? QueryWithTimeout(request, processedQuery, options.timeoutMs)
|
|
165
189
|
: request.query(processedQuery);
|
|
190
|
+
let result;
|
|
166
191
|
if (options && !options.ignoreLogging && context.logSqlStatement) {
|
|
167
192
|
const literalSQL = options.literalSQL;
|
|
168
|
-
|
|
193
|
+
[result] = await Promise.all([
|
|
169
194
|
queryPromise,
|
|
170
195
|
context.logSqlStatement(literalSQL ?? query, literalSQL ? undefined : parameters, options.description, options.ignoreLogging, options.isMutation, options.simpleSQLFallback, options.contextUser)
|
|
171
196
|
]);
|
|
172
|
-
return result;
|
|
173
197
|
}
|
|
174
|
-
|
|
198
|
+
else {
|
|
199
|
+
result = await queryPromise;
|
|
200
|
+
}
|
|
201
|
+
if (!options?.ignoreLogging && GenericDatabaseProvider.HasSqlObservers()) {
|
|
202
|
+
const endHr = typeof performance !== 'undefined' && performance.now ? performance.now() : Date.now();
|
|
203
|
+
const durationMs = Math.round((endHr - startHr) * 100) / 100;
|
|
204
|
+
const rowCount = Array.isArray(result?.rowsAffected) && result.rowsAffected.length > 0
|
|
205
|
+
? result.rowsAffected.reduce((a, b) => a + b, 0)
|
|
206
|
+
: Array.isArray(result?.recordset)
|
|
207
|
+
? result.recordset.length
|
|
208
|
+
: 0;
|
|
209
|
+
GenericDatabaseProvider.NotifySqlObservers({
|
|
210
|
+
ts: startTs,
|
|
211
|
+
durationMs,
|
|
212
|
+
sql: query,
|
|
213
|
+
description: options?.description,
|
|
214
|
+
isMutation: !!options?.isMutation,
|
|
215
|
+
rowCount,
|
|
216
|
+
parameterSummaries: SummarizeSqlParameters(parameters, !options?.isMutation),
|
|
217
|
+
sessionId: diagCtx?.sessionId,
|
|
218
|
+
traceId: diagCtx?.traceId,
|
|
219
|
+
spanId: diagCtx?.spanId,
|
|
220
|
+
ignoreLogging: options?.ignoreLogging,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return result;
|
|
175
224
|
}
|
|
176
225
|
catch (error) {
|
|
177
226
|
// Retry once for stale connection errors on non-transactional queries.
|
|
@@ -182,7 +231,28 @@ async function executeSQLCore(query, parameters, context, options, isRetry = fal
|
|
|
182
231
|
`Original error: ${error.message}`);
|
|
183
232
|
return executeSQLCore(query, parameters, context, options, true);
|
|
184
233
|
}
|
|
185
|
-
|
|
234
|
+
if (!options?.ignoreLogging && GenericDatabaseProvider.HasSqlObservers()) {
|
|
235
|
+
const endHr = typeof performance !== 'undefined' && performance.now ? performance.now() : Date.now();
|
|
236
|
+
const durationMs = Math.round((endHr - startHr) * 100) / 100;
|
|
237
|
+
GenericDatabaseProvider.NotifySqlObservers({
|
|
238
|
+
ts: startTs,
|
|
239
|
+
durationMs,
|
|
240
|
+
sql: query,
|
|
241
|
+
description: options?.description,
|
|
242
|
+
isMutation: !!options?.isMutation,
|
|
243
|
+
parameterSummaries: SummarizeSqlParameters(parameters, false),
|
|
244
|
+
error: {
|
|
245
|
+
name: error?.name ? String(error.name) : 'Error',
|
|
246
|
+
message: error?.message ? String(error.message) : String(error),
|
|
247
|
+
code: error?.code ? String(error.code) : undefined,
|
|
248
|
+
},
|
|
249
|
+
sessionId: diagCtx?.sessionId,
|
|
250
|
+
traceId: diagCtx?.traceId,
|
|
251
|
+
spanId: diagCtx?.spanId,
|
|
252
|
+
ignoreLogging: options?.ignoreLogging,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
// Build detailed error message with query and parameter types/lengths (never raw parameter values).
|
|
186
256
|
// mssql RequestError has a precedingErrors array with the actual root-cause
|
|
187
257
|
// SQL Server messages (e.g. "object already exists") that precede the
|
|
188
258
|
// generic "Could not create constraint" wrapper. Always include them.
|
|
@@ -195,7 +265,7 @@ async function executeSQLCore(query, parameters, context, options, isRetry = fal
|
|
|
195
265
|
const errorMessage = `Error executing SQL
|
|
196
266
|
Error: ${error?.message ? error.message : error}${precedingMsgs}
|
|
197
267
|
Query: ${literalSQL ?? query}
|
|
198
|
-
Parameters: ${literalSQL || !parameters ? 'None' :
|
|
268
|
+
Parameters: ${literalSQL || !parameters ? 'None' : FormatSqlParameterTypesForError(parameters)}`;
|
|
199
269
|
// Preserve the original error type (ConnectionError vs RequestError) so callers
|
|
200
270
|
// can structurally distinguish infrastructure failures from query-level errors.
|
|
201
271
|
// Attach the detailed message while keeping the error's class identity and code.
|
|
@@ -314,19 +384,48 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
314
384
|
* `sys.columns` scan in {@link loadViewColumnOrderCache} ran once or twice on EVERY request
|
|
315
385
|
* (issue #3102 — ~9.6k scans/day in production vs the ~2 needed).
|
|
316
386
|
*
|
|
317
|
-
* Keyed by
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
387
|
+
* Keyed by normalized database target AND login (`user@server:port[/instance]/database`) when
|
|
388
|
+
* `ConnectionPool.config` exposes them — so pools opened with the same login against the SAME
|
|
389
|
+
* database (per-request RW providers around the boot-time pool) share one `sys.columns` scan and
|
|
390
|
+
* one cross-pool invalidation domain, while pools pointing to DIFFERENT databases, or using a
|
|
391
|
+
* different login (read-only, CodeGen), stay isolated: `sys.columns` only lists objects the login
|
|
392
|
+
* can see, so one login's scan must never stand in for another's. Pools without `config.user`
|
|
393
|
+
* (token/integrated auth) share by target alone. Falls back to `_viewColumnOrderCacheByPool`
|
|
394
|
+
* (`WeakMap`) when a pool object does not expose `config.server` + `config.database` (e.g.
|
|
395
|
+
* lightweight test doubles).
|
|
323
396
|
*
|
|
324
397
|
* The value is the load PROMISE (not the resolved Map) so concurrent per-request Config() calls
|
|
325
398
|
* de-duplicate onto a single in-flight scan. Invalidated on metadata refresh (see
|
|
326
399
|
* {@link Refresh} / {@link InvalidateViewColumnOrderCache}) so view changes from
|
|
327
|
-
* migrations/CodeGen are picked up without a server restart.
|
|
400
|
+
* migrations/CodeGen are picked up across all pools targeting that database without a server restart.
|
|
328
401
|
*/
|
|
329
402
|
static { this._viewColumnOrderCacheByPool = new WeakMap(); }
|
|
403
|
+
static { this._viewColumnOrderCacheByDbKey = new Map(); }
|
|
404
|
+
static { this.DEFAULT_SQL_SERVER_PORT = 1433; }
|
|
405
|
+
static viewColumnOrderDbKey(pool) {
|
|
406
|
+
const cfg = pool?.config;
|
|
407
|
+
if (typeof cfg?.server === 'string' &&
|
|
408
|
+
cfg.server.trim().length > 0 &&
|
|
409
|
+
typeof cfg?.database === 'string' &&
|
|
410
|
+
cfg.database.trim().length > 0) {
|
|
411
|
+
const host = cfg.server.trim().toLowerCase();
|
|
412
|
+
const port = typeof cfg.port === 'number' && cfg.port > 0
|
|
413
|
+
? cfg.port
|
|
414
|
+
: SQLServerDataProvider.DEFAULT_SQL_SERVER_PORT;
|
|
415
|
+
const instance = typeof cfg.options?.instanceName === 'string' && cfg.options.instanceName.trim().length > 0
|
|
416
|
+
? `/${cfg.options.instanceName.trim().toLowerCase()}`
|
|
417
|
+
: '';
|
|
418
|
+
const db = cfg.database.trim().toLowerCase();
|
|
419
|
+
// The login is part of the identity: sys.columns only lists objects the login can see, so a
|
|
420
|
+
// scan made through the read-only or CodeGen login must never be served to the read-write
|
|
421
|
+
// pool (or vice versa) — a view missing from the map falls back to metadata order, the very
|
|
422
|
+
// misrouting this cache exists to prevent (#3102). Pools sharing server, database AND login
|
|
423
|
+
// still share one scan.
|
|
424
|
+
const user = typeof cfg.user === 'string' && cfg.user.trim().length > 0 ? cfg.user.trim().toLowerCase() : '';
|
|
425
|
+
return `mssql://${user}@${host}:${port}${instance}/${db}`;
|
|
426
|
+
}
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
330
429
|
ensureSqlQueue() {
|
|
331
430
|
if (!this._sqlQueue$) {
|
|
332
431
|
this._sqlQueue$ = new Subject();
|
|
@@ -446,10 +545,18 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
446
545
|
*/
|
|
447
546
|
async loadViewColumnOrderCache() {
|
|
448
547
|
const pool = this._pool;
|
|
449
|
-
|
|
548
|
+
const dbKey = SQLServerDataProvider.viewColumnOrderDbKey(pool);
|
|
549
|
+
let scanPromise = dbKey !== null
|
|
550
|
+
? SQLServerDataProvider._viewColumnOrderCacheByDbKey.get(dbKey)
|
|
551
|
+
: SQLServerDataProvider._viewColumnOrderCacheByPool.get(pool);
|
|
450
552
|
if (!scanPromise) {
|
|
451
553
|
scanPromise = this.scanViewColumnOrder();
|
|
452
|
-
|
|
554
|
+
if (dbKey !== null) {
|
|
555
|
+
SQLServerDataProvider._viewColumnOrderCacheByDbKey.set(dbKey, scanPromise);
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
SQLServerDataProvider._viewColumnOrderCacheByPool.set(pool, scanPromise);
|
|
559
|
+
}
|
|
453
560
|
}
|
|
454
561
|
try {
|
|
455
562
|
this._viewColumnOrderCache = await scanPromise;
|
|
@@ -457,7 +564,12 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
457
564
|
catch (e) {
|
|
458
565
|
// best-effort: an empty cache makes getAllEntityColumnsSQL fall back to the metadata-derived order.
|
|
459
566
|
// Drop the shared entry (only if it's still OUR failed promise) so a later Config() can retry.
|
|
460
|
-
if (
|
|
567
|
+
if (dbKey !== null) {
|
|
568
|
+
if (SQLServerDataProvider._viewColumnOrderCacheByDbKey.get(dbKey) === scanPromise) {
|
|
569
|
+
SQLServerDataProvider._viewColumnOrderCacheByDbKey.delete(dbKey);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
else if (SQLServerDataProvider._viewColumnOrderCacheByPool.get(pool) === scanPromise) {
|
|
461
573
|
SQLServerDataProvider._viewColumnOrderCacheByPool.delete(pool);
|
|
462
574
|
}
|
|
463
575
|
this._viewColumnOrderCache = new Map();
|
|
@@ -504,6 +616,10 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
504
616
|
*/
|
|
505
617
|
static InvalidateViewColumnOrderCache(pool) {
|
|
506
618
|
SQLServerDataProvider._viewColumnOrderCacheByPool.delete(pool);
|
|
619
|
+
const dbKey = SQLServerDataProvider.viewColumnOrderDbKey(pool);
|
|
620
|
+
if (dbKey !== null) {
|
|
621
|
+
SQLServerDataProvider._viewColumnOrderCacheByDbKey.delete(dbKey);
|
|
622
|
+
}
|
|
507
623
|
}
|
|
508
624
|
/**
|
|
509
625
|
* Metadata refresh invalidates this pool's shared view-column-order cache before re-running
|
|
@@ -576,6 +692,19 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
576
692
|
get DatabaseConnection() {
|
|
577
693
|
return this._pool;
|
|
578
694
|
}
|
|
695
|
+
/** Reads the live counts from the mssql connection pool, or `null` before the pool is set. */
|
|
696
|
+
GetPoolStats() {
|
|
697
|
+
const pool = this._pool;
|
|
698
|
+
if (!pool) {
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
return {
|
|
702
|
+
TotalConnections: pool.size,
|
|
703
|
+
ActiveConnections: pool.borrowed,
|
|
704
|
+
IdleConnections: pool.available,
|
|
705
|
+
WaitingRequests: pool.pending,
|
|
706
|
+
};
|
|
707
|
+
}
|
|
579
708
|
/**
|
|
580
709
|
* For the SQLServerDataProvider the unique instance connection string which is used to identify, uniquely, a given connection is the following format:
|
|
581
710
|
* mssql://host:port/instanceName?/database
|
|
@@ -1248,22 +1377,45 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
1248
1377
|
const execParams = [];
|
|
1249
1378
|
let simpleParams = '';
|
|
1250
1379
|
let bFirst = true;
|
|
1380
|
+
const needsSimpleParams = this.HasActiveSqlLoggingSessions ||
|
|
1381
|
+
!!entity.TransactionGroup ||
|
|
1382
|
+
Object.prototype.hasOwnProperty.call(this, '_logSqlStatement') ||
|
|
1383
|
+
Object.getPrototypeOf(this) !== SQLServerDataProvider.prototype;
|
|
1251
1384
|
for (const [f, value] of fieldValues) {
|
|
1252
1385
|
const varName = `@${f.CodeName}${uniqueSuffix}`;
|
|
1253
1386
|
declarations.push(`${varName} ${f.SQLFullType.toUpperCase()}`);
|
|
1254
|
-
// A binary value is rendered to its hex literal ONCE and reused below: the literal is twice
|
|
1255
|
-
// the size of the bytes, and the SET block and the simple-params form both carry it.
|
|
1256
1387
|
const hasValue = value !== null && value !== undefined;
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1388
|
+
if (hasValue && f.IsBinaryFieldType) {
|
|
1389
|
+
const binaryBytes = this.decodeBinaryFieldBytes(f, value);
|
|
1390
|
+
let cachedHexLiteral;
|
|
1391
|
+
const getHexLiteral = () => {
|
|
1392
|
+
if (cachedHexLiteral === undefined) {
|
|
1393
|
+
cachedHexLiteral = this.FormatBinaryLiteral(f, binaryBytes);
|
|
1394
|
+
}
|
|
1395
|
+
return cachedHexLiteral;
|
|
1396
|
+
};
|
|
1397
|
+
setStatements.push(`SET ${varName} = ${params.AddBinaryField(f, binaryBytes, getHexLiteral)}`);
|
|
1398
|
+
execParams.push(`@${f.CodeName}=${varName}`);
|
|
1399
|
+
if (needsSimpleParams) {
|
|
1400
|
+
simpleParams += this.generateSingleSPParam(f, value, bFirst, getHexLiteral());
|
|
1401
|
+
}
|
|
1402
|
+
bFirst = false;
|
|
1403
|
+
}
|
|
1404
|
+
else {
|
|
1405
|
+
if (hasValue) {
|
|
1406
|
+
setStatements.push(`SET ${varName} = ${params.AddField(f, this.generateSetStatementValue(f, value))}`);
|
|
1407
|
+
}
|
|
1408
|
+
execParams.push(`@${f.CodeName}=${varName}`);
|
|
1409
|
+
if (needsSimpleParams) {
|
|
1410
|
+
simpleParams += this.generateSingleSPParam(f, value, bFirst);
|
|
1411
|
+
}
|
|
1412
|
+
bFirst = false;
|
|
1260
1413
|
}
|
|
1261
|
-
execParams.push(`@${f.CodeName}=${varName}`);
|
|
1262
|
-
simpleParams += this.generateSingleSPParam(f, value, bFirst, binaryLiteral);
|
|
1263
|
-
bFirst = false;
|
|
1264
1414
|
if ((value === null || value === undefined) && f.NeedsClearCompanion) {
|
|
1265
1415
|
execParams.push(`@${f.CodeName}_Clear=1`);
|
|
1266
|
-
|
|
1416
|
+
if (needsSimpleParams) {
|
|
1417
|
+
simpleParams += `, @${f.CodeName}_Clear=1`;
|
|
1418
|
+
}
|
|
1267
1419
|
}
|
|
1268
1420
|
}
|
|
1269
1421
|
// UPDATE: tail-append PK declarations from the loaded entity's PrimaryKey.
|
|
@@ -1612,7 +1764,7 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
1612
1764
|
* here with a message that says so, instead of a batch-size error from the server.
|
|
1613
1765
|
*/
|
|
1614
1766
|
static { this.MaxInlineBinaryBytes = 32 * 1024 * 1024; }
|
|
1615
|
-
|
|
1767
|
+
decodeBinaryFieldBytes(field, value) {
|
|
1616
1768
|
const bytes = IsByteArray(value) ? value : TryBase64ToBytes(typeof value === 'string' ? value : null);
|
|
1617
1769
|
if (!bytes) {
|
|
1618
1770
|
throw new Error(`Field "${field.Name}" is binary (${field.Type}); its value must be a base64 string, but it is not valid base64`);
|
|
@@ -1622,7 +1774,10 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
1622
1774
|
`limit for a value inlined into a save batch (SQLServerDataProvider.MaxInlineBinaryBytes). Store large binary content through file storage, ` +
|
|
1623
1775
|
`or raise the limit if the batch size and Record Changes cost are acceptable.`);
|
|
1624
1776
|
}
|
|
1625
|
-
return
|
|
1777
|
+
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
1778
|
+
}
|
|
1779
|
+
FormatBinaryLiteral(field, value) {
|
|
1780
|
+
return `0x${this.decodeBinaryFieldBytes(field, value).toString('hex').toUpperCase()}`;
|
|
1626
1781
|
}
|
|
1627
1782
|
/**
|
|
1628
1783
|
* Returns a string that packages the parameter value for the stored procedure call.
|
|
@@ -1955,13 +2110,17 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
1955
2110
|
// This prevents EREQINPROG errors when multiple queries try to use the same transaction
|
|
1956
2111
|
this.initializeQueueProcessor();
|
|
1957
2112
|
const queue = this.ensureSqlQueue();
|
|
2113
|
+
const enqueuedDiagnosticContext = options?.diagnosticContext ?? GetDiagnosticContext();
|
|
2114
|
+
const effectiveOptions = enqueuedDiagnosticContext
|
|
2115
|
+
? { ...options, diagnosticContext: enqueuedDiagnosticContext }
|
|
2116
|
+
: options;
|
|
1958
2117
|
return new Promise((resolve, reject) => {
|
|
1959
2118
|
queue.next({
|
|
1960
2119
|
kind: 'query',
|
|
1961
2120
|
query,
|
|
1962
2121
|
parameters,
|
|
1963
2122
|
context,
|
|
1964
|
-
options,
|
|
2123
|
+
options: effectiveOptions,
|
|
1965
2124
|
// Ours if it is the ambient handle now, or was one that has since ended: a caller holding
|
|
1966
2125
|
// the old handle after its commit must be told so, not sent to mssql for ENOTBEGUN.
|
|
1967
2126
|
ambient: context.transaction === this._transaction || (!!context.transaction && this._endedHandles.has(context.transaction)),
|
|
@@ -2056,7 +2215,10 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
2056
2215
|
* This method can be used to execute raw SQL statements outside of the MJ infrastructure.
|
|
2057
2216
|
* *CAUTION* - use this method with great care.
|
|
2058
2217
|
* @param query
|
|
2059
|
-
* @param parameters
|
|
2218
|
+
* @param parameters - Named parameters: an object (`{ name: value }`, referenced `@name`), or a list of
|
|
2219
|
+
* `NamedQueryParameter` / `TypedQueryParameter`. A plain array of values is the LEGACY positional form:
|
|
2220
|
+
* it binds `@p0..@pN` and rewrites every `?` in `query`, a `?` inside a string literal, quoted
|
|
2221
|
+
* identifier or comment included, so it is only safe for statement text with no other `?`.
|
|
2060
2222
|
* @returns
|
|
2061
2223
|
*/
|
|
2062
2224
|
async ExecuteSQL(query, parameters = null, options, contextUser) {
|
|
@@ -2086,6 +2248,21 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
2086
2248
|
throw e; // force caller to handle
|
|
2087
2249
|
}
|
|
2088
2250
|
}
|
|
2251
|
+
/**
|
|
2252
|
+
* Describes the first result set of `sqlText` with `sys.dm_exec_describe_first_result_set` (mode 2):
|
|
2253
|
+
* names, order, exact types, nullability and the view or table column each pass-through column
|
|
2254
|
+
* comes from. SQL Server compiles the statement without executing it. A statement the server
|
|
2255
|
+
* cannot compile gives a failure carrying the server's message.
|
|
2256
|
+
*/
|
|
2257
|
+
async DescribeStatement(sqlText, contextUser) {
|
|
2258
|
+
try {
|
|
2259
|
+
const rows = await this.ExecuteSQL(SQLSERVER_DESCRIBE_SQL, [new TypedQueryParameter('tsql', 'nvarchar(max)', sqlText)], { description: 'DescribeStatement', ignoreLogging: true }, contextUser);
|
|
2260
|
+
return MapSQLServerDescribeRows(rows);
|
|
2261
|
+
}
|
|
2262
|
+
catch (e) {
|
|
2263
|
+
return DescribeStatementFailure(e instanceof Error ? e.message : String(e));
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2089
2266
|
// ─── Colocated vector host (IColocatedVectorHost) ────────────────
|
|
2090
2267
|
// Lets a colocated vector provider (e.g. SQLServerVectorDatabase, SQL Server 2025 native
|
|
2091
2268
|
// vectors) store and query vectors in THIS database, reusing this connection — instead of
|
|
@@ -2465,7 +2642,7 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
2465
2642
|
const unionParts = childEntities
|
|
2466
2643
|
.filter(child => child.PrimaryKeys.length > 0)
|
|
2467
2644
|
.map(child => {
|
|
2468
|
-
const schema = child.SchemaName || '__mj';
|
|
2645
|
+
const schema = child.SchemaName || this.MJCoreSchemaName || '__mj';
|
|
2469
2646
|
const sourceRef = dialect.QuoteSchema(schema, child.BaseView);
|
|
2470
2647
|
const pkRef = dialect.QuoteIdentifier(child.FirstPrimaryKey.Name); // first-pk-ok: IS-A child shares its parent's single-column key by design
|
|
2471
2648
|
const nameLit = dialect.QuoteStringLiteral(child.Name);
|
|
@@ -2475,6 +2652,27 @@ export class SQLServerDataProvider extends GenericDatabaseProvider {
|
|
|
2475
2652
|
return '';
|
|
2476
2653
|
return unionParts.join(' UNION ALL ');
|
|
2477
2654
|
}
|
|
2655
|
+
BuildChildDiscoveryBatchSQL(childEntities, recordPKValues) {
|
|
2656
|
+
if (recordPKValues.length === 0)
|
|
2657
|
+
return '';
|
|
2658
|
+
const dialect = this.getDialect();
|
|
2659
|
+
const inList = recordPKValues.map(v => dialect.QuoteStringLiteral(v)).join(', ');
|
|
2660
|
+
const aliasEntityName = dialect.QuoteColumnAlias('EntityName');
|
|
2661
|
+
const aliasRecordPK = dialect.QuoteColumnAlias('RecordPK');
|
|
2662
|
+
const aliasPriority = dialect.QuoteColumnAlias('Priority');
|
|
2663
|
+
const unionParts = childEntities
|
|
2664
|
+
.filter(child => child.PrimaryKeys.length > 0)
|
|
2665
|
+
.map((child, idx) => {
|
|
2666
|
+
const schema = child.SchemaName || this.MJCoreSchemaName || '__mj';
|
|
2667
|
+
const sourceRef = dialect.QuoteSchema(schema, child.BaseView);
|
|
2668
|
+
const pkRef = dialect.QuoteIdentifier(child.FirstPrimaryKey.Name); // first-pk-ok: IS-A shared key
|
|
2669
|
+
const nameLit = dialect.QuoteStringLiteral(child.Name);
|
|
2670
|
+
return `SELECT ${nameLit} AS ${aliasEntityName}, CAST(${pkRef} AS NVARCHAR(255)) AS ${aliasRecordPK}, ${idx + 1} AS ${aliasPriority} FROM ${sourceRef} WHERE ${pkRef} IN (${inList})`;
|
|
2671
|
+
});
|
|
2672
|
+
if (unionParts.length === 0)
|
|
2673
|
+
return '';
|
|
2674
|
+
return unionParts.join(' UNION ALL ');
|
|
2675
|
+
}
|
|
2478
2676
|
/**************************************************************************
|
|
2479
2677
|
* IS-A Overlapping Subtype — Record Change Propagation
|
|
2480
2678
|
*
|
|
@@ -2676,8 +2874,38 @@ IF ${varName} IS NOT NULL
|
|
|
2676
2874
|
this._fileSystemProvider = new NodeFileSystemProvider();
|
|
2677
2875
|
return this._fileSystemProvider;
|
|
2678
2876
|
}
|
|
2877
|
+
/**
|
|
2878
|
+
* Returns the currently active physical `mssql.Transaction` handle managed by this provider,
|
|
2879
|
+
* or `null` when no physical transaction is open.
|
|
2880
|
+
*/
|
|
2881
|
+
get ActiveTransactionHandle() {
|
|
2882
|
+
return this._transaction ?? null;
|
|
2883
|
+
}
|
|
2884
|
+
/**
|
|
2885
|
+
* Executes a `mssql` request callback against `transaction`, serialized through this provider's
|
|
2886
|
+
* transaction SQL queue when `transaction` is the provider's active transaction handle.
|
|
2887
|
+
*/
|
|
2888
|
+
async ExecuteOnTransactionHandle(transaction, description, run) {
|
|
2889
|
+
if (this._endedHandles.has(transaction)) {
|
|
2890
|
+
throw new Error('The ambient transaction ended before this TransactionGroup request ran. ' +
|
|
2891
|
+
'Await every query issued on the transaction before committing or rolling back.');
|
|
2892
|
+
}
|
|
2893
|
+
if (transaction !== this._transaction) {
|
|
2894
|
+
return run(transaction);
|
|
2895
|
+
}
|
|
2896
|
+
let result;
|
|
2897
|
+
await this.enqueueTransactionAction(description, transaction, async () => {
|
|
2898
|
+
await this.waitForActiveRequest();
|
|
2899
|
+
if (this._endedHandles.has(transaction) || transaction !== this._transaction) {
|
|
2900
|
+
throw new Error('The ambient transaction ended before this TransactionGroup request ran. ' +
|
|
2901
|
+
'Await every query issued on the transaction before committing or rolling back.');
|
|
2902
|
+
}
|
|
2903
|
+
result = await run(transaction);
|
|
2904
|
+
});
|
|
2905
|
+
return result;
|
|
2906
|
+
}
|
|
2679
2907
|
async CreateTransactionGroup() {
|
|
2680
|
-
return new SQLServerTransactionGroup();
|
|
2908
|
+
return new SQLServerTransactionGroup(this);
|
|
2681
2909
|
}
|
|
2682
2910
|
/**************************************************************************/
|
|
2683
2911
|
// END ---- IMetadataProvider
|