@breautek/storm 9.2.1 → 9.2.3
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/CHANGELOG.md +12 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Application.html +17 -17
- package/docs/classes/ConfigLoader.html +3 -3
- package/docs/classes/Database.html +2 -2
- package/docs/classes/DatabaseCastObject.html +2 -2
- package/docs/classes/DatabaseConnection.html +21 -21
- package/docs/classes/DatabaseQueryError.html +6 -6
- package/docs/classes/DeadLockError.html +6 -6
- package/docs/classes/DiskSpaceError.html +5 -5
- package/docs/classes/DropTemporaryTableQuery.html +7 -7
- package/docs/classes/DuplicateEntryError.html +5 -5
- package/docs/classes/EntityNotFoundError.html +5 -5
- package/docs/classes/ExpiredTokenError.html +5 -5
- package/docs/classes/GetMySQLVersion.html +25 -0
- package/docs/classes/Handler.html +2 -2
- package/docs/classes/IllegalStateError.html +5 -5
- package/docs/classes/InternalError.html +5 -5
- package/docs/classes/InvalidCredentialsError.html +5 -5
- package/docs/classes/InvalidValueError.html +5 -5
- package/docs/classes/LineString.html +2 -2
- package/docs/classes/LockWaitTimeoutError.html +6 -6
- package/docs/classes/ManagedDatabaseConnection.html +5 -5
- package/docs/classes/Middleware.html +2 -2
- package/docs/classes/MissingConfigError.html +5 -5
- package/docs/classes/MissingParameterError.html +5 -5
- package/docs/classes/MySQLConnection.html +26 -25
- package/docs/classes/MySQLDatabase.html +2 -2
- package/docs/classes/NotImplementedError.html +5 -5
- package/docs/classes/Point.html +2 -2
- package/docs/classes/Polygon.html +2 -2
- package/docs/classes/Query.html +7 -7
- package/docs/classes/RawError.html +5 -5
- package/docs/classes/RawQuery.html +7 -7
- package/docs/classes/Request.html +3 -3
- package/docs/classes/Response.html +2 -2
- package/docs/classes/ResponseData.html +3 -3
- package/docs/classes/ServiceProvider.html +2 -2
- package/docs/classes/ServiceResponse.html +2 -2
- package/docs/classes/SetSessionVariableQuery.html +7 -7
- package/docs/classes/StormError.html +5 -5
- package/docs/classes/TemporaryTableQuery.html +7 -7
- package/docs/classes/TimeoutError.html +5 -5
- package/docs/classes/Token.html +2 -2
- package/docs/classes/TokenManager.html +2 -2
- package/docs/classes/Transaction.html +2 -2
- package/docs/classes/UnauthorizedAccessError.html +5 -5
- package/docs/enums/ErrorCode.html +2 -2
- package/docs/enums/ExitCode.html +2 -2
- package/docs/enums/HTTPMethod.html +2 -2
- package/docs/enums/IsolationLevel.html +2 -2
- package/docs/enums/JWTError.html +2 -2
- package/docs/enums/StatusCode.html +2 -2
- package/docs/enums/TransactionAccessLevel.html +2 -2
- package/docs/functions/getInstance.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/IAdditionalErrorDetails.html +1 -1
- package/docs/interfaces/ICloudwatchConfig.html +2 -2
- package/docs/interfaces/ICloudwatchCredentials.html +2 -2
- package/docs/interfaces/ICloudwatchStreamConfig.html +2 -2
- package/docs/interfaces/IConfig.html +3 -3
- package/docs/interfaces/IDatabaseConfig.html +2 -2
- package/docs/interfaces/IDatabaseConnection.html +5 -5
- package/docs/interfaces/IDatabasePosition.html +2 -2
- package/docs/interfaces/IErrorResponse.html +2 -2
- package/docs/interfaces/IFormData.html +2 -2
- package/docs/interfaces/IGetMySQLVersionResult.html +5 -0
- package/docs/interfaces/IGetMySQLVersionRow.html +2 -0
- package/docs/interfaces/IInsertQueryResult.html +2 -2
- package/docs/interfaces/IJWTVerifyOptions.html +2 -2
- package/docs/interfaces/IOKPacket.html +2 -2
- package/docs/interfaces/IParameterMap.html +1 -1
- package/docs/interfaces/IQueryable.html +2 -2
- package/docs/interfaces/IRequestResponse.html +2 -2
- package/docs/interfaces/ISetSessionVariableQueryInput.html +2 -2
- package/docs/interfaces/IStormCLIArgs.html +2 -2
- package/docs/interfaces/ITemporaryTableQueryInput.html +2 -2
- package/docs/interfaces/IUpdateQueryResult.html +2 -2
- package/docs/interfaces/formidable.FileJSON.html +1 -1
- package/docs/interfaces/formidable.Part.html +1 -1
- package/docs/types/IDeleteQueryResult.html +1 -1
- package/docs/types/IStoredProcedureResult.html +1 -1
- package/docs/types/TCoordinate.html +1 -1
- package/docs/types/TExpiresIn.html +1 -1
- package/docs/types/TSerializableResponse.html +1 -1
- package/docs/types/TSupportedResponsePrimitives.html +1 -1
- package/docs/types/TSupportedResponseTypes.html +1 -1
- package/jest.config.js +1 -0
- package/lib/GetMySQLVersion.d.ts +15 -0
- package/lib/GetMySQLVersion.js +28 -0
- package/lib/GetMySQLVersion.js.map +1 -0
- package/lib/MySQLConnection.d.ts +3 -0
- package/lib/MySQLConnection.js +26 -4
- package/lib/MySQLConnection.js.map +1 -1
- package/lib/api.d.ts +1 -0
- package/lib/api.js +4 -2
- package/lib/api.js.map +1 -1
- package/lib/private/GetMasterPositionQuery.d.ts +4 -0
- package/lib/private/GetMasterPositionQuery.js +4 -0
- package/lib/private/GetMasterPositionQuery.js.map +1 -1
- package/lib/private/GetPrimaryPositionQuery.d.ts +14 -0
- package/lib/private/GetPrimaryPositionQuery.js +35 -0
- package/lib/private/GetPrimaryPositionQuery.js.map +1 -0
- package/package.json +1 -1
- package/src/GetMySQLVersion.ts +41 -0
- package/src/MySQLConnection.ts +36 -4
- package/src/api.ts +1 -0
- package/src/private/GetMasterPositionQuery.ts +4 -0
- package/src/private/GetPrimaryPositionQuery.ts +40 -0
- package/breautek-storm-9.2.1-beta.0.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>TSupportedResponseTypes | @breautek/storm</title><meta name="description" content="Documentation for @breautek/storm"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@breautek/storm</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">TSupportedResponseTypes</a></li></ul><h1>Type Alias TSupportedResponseTypes</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">TSupportedResponseTypes</span><span class="tsd-signature-symbol">:</span><br/> <span class="tsd-signature-symbol">|</span> <a href="TSupportedResponsePrimitives.html" class="tsd-signature-type tsd-kind-type-alias">TSupportedResponsePrimitives</a><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Error</span><br/> <span class="tsd-signature-symbol">|</span> <a href="../classes/StormError.html" class="tsd-signature-type tsd-kind-class">StormError</a><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Buffer</span><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">ReadableStream</span><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Stream.Readable</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>TSupportedResponseTypes | @breautek/storm</title><meta name="description" content="Documentation for @breautek/storm"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@breautek/storm</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">TSupportedResponseTypes</a></li></ul><h1>Type Alias TSupportedResponseTypes</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">TSupportedResponseTypes</span><span class="tsd-signature-symbol">:</span><br/> <span class="tsd-signature-symbol">|</span> <a href="TSupportedResponsePrimitives.html" class="tsd-signature-type tsd-kind-type-alias">TSupportedResponsePrimitives</a><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Error</span><br/> <span class="tsd-signature-symbol">|</span> <a href="../classes/StormError.html" class="tsd-signature-type tsd-kind-class">StormError</a><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Buffer</span><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">ReadableStream</span><br/> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">Stream.Readable</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/breautek/storm/blob/cf8e3fa7563bd161fe3cdfbc462c6926f8a9ee3c/src/Response.ts#L62">src/Response.ts:62</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html">@breautek/storm</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
package/jest.config.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IDatabaseConnection } from './IDatabaseConnection';
|
|
2
|
+
import { Query } from './Query';
|
|
3
|
+
export interface IGetMySQLVersionResult {
|
|
4
|
+
major: number;
|
|
5
|
+
minor: number;
|
|
6
|
+
patch: number;
|
|
7
|
+
version: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IGetMySQLVersionRow {
|
|
10
|
+
version: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class GetMySQLVersion extends Query<void, IGetMySQLVersionRow[], IGetMySQLVersionResult> {
|
|
13
|
+
protected _getQuery(connection: IDatabaseConnection): string;
|
|
14
|
+
onPostProcess(connection: IDatabaseConnection, resultSet: IGetMySQLVersionRow[]): Promise<IGetMySQLVersionResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetMySQLVersion = void 0;
|
|
4
|
+
const Query_1 = require("./Query");
|
|
5
|
+
class GetMySQLVersion extends Query_1.Query {
|
|
6
|
+
_getQuery(connection) {
|
|
7
|
+
return 'SELECT VERSION() AS version';
|
|
8
|
+
}
|
|
9
|
+
async onPostProcess(connection, resultSet) {
|
|
10
|
+
let result = resultSet[0];
|
|
11
|
+
if (!result) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
let parts = result.version.split('.');
|
|
15
|
+
let major = parseInt(parts[0]);
|
|
16
|
+
let minor = parseInt(parts[1]);
|
|
17
|
+
let patch = parseInt(parts[2]);
|
|
18
|
+
let out = {
|
|
19
|
+
major: major,
|
|
20
|
+
minor: minor,
|
|
21
|
+
patch: patch,
|
|
22
|
+
version: result.version
|
|
23
|
+
};
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.GetMySQLVersion = GetMySQLVersion;
|
|
28
|
+
//# sourceMappingURL=GetMySQLVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetMySQLVersion.js","sourceRoot":"","sources":["../src/GetMySQLVersion.ts"],"names":[],"mappings":";;;AAEA,mCAA8B;AAa9B,MAAa,eAAgB,SAAQ,aAA0D;IACxE,SAAS,CAAC,UAA+B;QACxD,OAAO,6BAA6B,CAAC;IACzC,CAAC;IAEe,KAAK,CAAC,aAAa,CAAC,UAA+B,EAAE,SAAgC;QACjG,IAAI,MAAM,GAAwB,SAAS,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,KAAK,GAAa,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,KAAK,GAAW,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,KAAK,GAAW,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,KAAK,GAAW,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvC,IAAI,GAAG,GAA2B;YAC9B,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,MAAM,CAAC,OAAO;SAC1B,CAAC;QAEF,OAAO,GAAG,CAAC;IACf,CAAC;CACJ;AAzBD,0CAyBC"}
|
package/lib/MySQLConnection.d.ts
CHANGED
|
@@ -5,16 +5,19 @@ import { IsolationLevel } from './IsolationLevel';
|
|
|
5
5
|
import { IDatabasePosition } from './IDatabasePosition';
|
|
6
6
|
import { IQueryable } from './IQueryable';
|
|
7
7
|
import { TransactionAccessLevel } from './TransactionAccessLevel';
|
|
8
|
+
import { IGetMySQLVersionResult } from './GetMySQLVersion';
|
|
8
9
|
export declare class MySQLConnection extends DatabaseConnection<MySQL.PoolConnection> {
|
|
9
10
|
private $transaction;
|
|
10
11
|
private $opened;
|
|
11
12
|
private $hasReplicationEnabled;
|
|
12
13
|
private $isMasterConnection;
|
|
14
|
+
private $version;
|
|
13
15
|
constructor(connection: MySQL.PoolConnection, instantiationStack: string, isReadOnly?: boolean);
|
|
14
16
|
/**
|
|
15
17
|
* @internal - Do not use in application code
|
|
16
18
|
*/
|
|
17
19
|
__internal_init(): Promise<void>;
|
|
20
|
+
getVersion(): Promise<IGetMySQLVersionResult>;
|
|
18
21
|
formatQuery(query: IQueryable<any>): string;
|
|
19
22
|
/**
|
|
20
23
|
* Returns true if this server is the source.
|
package/lib/MySQLConnection.js
CHANGED
|
@@ -32,6 +32,9 @@ const GetSlavePositionQuery_1 = require("./private/GetSlavePositionQuery");
|
|
|
32
32
|
const GetMasterPositionQuery_1 = require("./private/GetMasterPositionQuery");
|
|
33
33
|
const TransactionAccessLevel_1 = require("./TransactionAccessLevel");
|
|
34
34
|
const GetProcessList_1 = require("./private/GetProcessList");
|
|
35
|
+
const GetMySQLVersion_1 = require("./GetMySQLVersion");
|
|
36
|
+
const GetPrimaryPositionQuery_1 = require("./private/GetPrimaryPositionQuery");
|
|
37
|
+
const queryFormatter_1 = require("./mysql/queryFormatter");
|
|
35
38
|
const DEFAULT_HIGH_WATERMARK = 512; // in number of result objects
|
|
36
39
|
const TAG = 'MySQLConnection';
|
|
37
40
|
const SQL_FORMATTING_OPTIONS = {
|
|
@@ -105,6 +108,12 @@ class MySQLConnection extends DatabaseConnection_1.DatabaseConnection {
|
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
}
|
|
111
|
+
async getVersion() {
|
|
112
|
+
if (!this.$version) {
|
|
113
|
+
this.$version = await new GetMySQLVersion_1.GetMySQLVersion().execute(this);
|
|
114
|
+
}
|
|
115
|
+
return { ...this.$version };
|
|
116
|
+
}
|
|
108
117
|
formatQuery(query) {
|
|
109
118
|
return this.getAPI().format(query.getQuery(this), query.getParametersForQuery());
|
|
110
119
|
}
|
|
@@ -134,16 +143,29 @@ class MySQLConnection extends DatabaseConnection_1.DatabaseConnection {
|
|
|
134
143
|
return this.$opened;
|
|
135
144
|
}
|
|
136
145
|
async getCurrentDatabasePosition() {
|
|
137
|
-
let
|
|
146
|
+
let version = await this.getVersion();
|
|
147
|
+
let statusQuery = null;
|
|
148
|
+
if ((version.major === 8 && version.minor >= 4) || version.major >= 9) {
|
|
149
|
+
// >= 8.4 we need to use a different setof master/slave queries
|
|
150
|
+
statusQuery = this.isReplication() ? new GetSlavePositionQuery_1.GetSlavePositionQuery() : new GetPrimaryPositionQuery_1.GetPrimaryPositionQuery();
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
statusQuery = this.isReplication() ? new GetSlavePositionQuery_1.GetSlavePositionQuery() : new GetMasterPositionQuery_1.GetMasterPositionQuery();
|
|
154
|
+
}
|
|
138
155
|
return await statusQuery.execute(this);
|
|
139
156
|
}
|
|
140
157
|
_query(query, params) {
|
|
141
158
|
let logger = (0, instance_1.getInstance)().getLogger();
|
|
159
|
+
// MySQL2 doesn't seem to be reliable for their named parameter support,
|
|
160
|
+
// so we will fall back to our original implementation, but prep the query
|
|
161
|
+
// string manually via queryFormatter (which makes use of MySQL.escape).
|
|
162
|
+
// This means we won't use the params argument on the main query call.
|
|
163
|
+
let preparedQuery = (0, queryFormatter_1.queryFormatter)(query, params);
|
|
142
164
|
return new Promise((resolve, reject) => {
|
|
143
165
|
let queryObject = this.getAPI().query({
|
|
144
|
-
sql:
|
|
166
|
+
sql: preparedQuery,
|
|
145
167
|
timeout: this.getTimeout()
|
|
146
|
-
},
|
|
168
|
+
}, null, (error, results) => {
|
|
147
169
|
if (error) {
|
|
148
170
|
let sql = queryObject.sql;
|
|
149
171
|
// Formatting queries can be an expensive task, so only do it if the log level is actually silly.
|
|
@@ -152,7 +174,7 @@ class MySQLConnection extends DatabaseConnection_1.DatabaseConnection {
|
|
|
152
174
|
// SQLFormatter doesn't understand all MySQL syntaxes, so this is to prevent
|
|
153
175
|
// potentially valid queries from becoming errors simply because we couldn't
|
|
154
176
|
// log them.
|
|
155
|
-
sql = SQLFormatter.formatDialect(
|
|
177
|
+
sql = SQLFormatter.formatDialect(preparedQuery, {
|
|
156
178
|
...SQL_FORMATTING_OPTIONS,
|
|
157
179
|
dialect: SQLFormatter.mysql
|
|
158
180
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MySQLConnection.js","sourceRoot":"","sources":["../src/MySQLConnection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;;AAEF,6DAAwD;AACxD,6DAA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,OAAO,EAAE,CAAC;gBACxC,CAAC;YACL,CAAC;iBACI,CAAC;gBACF,eAAe,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;YACxC,CAAC;YAED,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE;gBACtB,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;gBACxB,OAAO,EAAE,CAAC;YACd,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;gBACpB,IAAA,sBAAW,GAAE,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBAC5C,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;gBACxB,OAAO,EAAE,CAAC;YACd,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApTD,0CAoTC"}
|
package/lib/api.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { Transaction } from './Transaction';
|
|
|
19
19
|
export { IOKPacket } from './IOKPacket';
|
|
20
20
|
export { IStoredProcedureResult } from './IStoredProcedureResult';
|
|
21
21
|
export { TransactionAccessLevel } from './TransactionAccessLevel';
|
|
22
|
+
export { GetMySQLVersion, IGetMySQLVersionResult, IGetMySQLVersionRow } from './GetMySQLVersion';
|
|
22
23
|
export { ErrorCode } from './ErrorCode';
|
|
23
24
|
export { RawError } from './RawError';
|
|
24
25
|
export { StormError, IErrorResponse, IAdditionalErrorDetails } from './StormError';
|
package/lib/api.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
19
|
-
exports.Command = exports.formidable = exports.Polygon = exports.LineString = void 0;
|
|
18
|
+
exports.DatabaseCastObject = exports.ExitCode = exports.TokenManager = exports.Token = exports.ServiceResponse = exports.HTTPMethod = exports.ServiceProvider = exports.Handler = exports.ResponseData = exports.Response = exports.Request = exports.Middleware = exports.StatusCode = exports.IllegalStateError = exports.LockWaitTimeoutError = exports.DeadLockError = exports.NotImplementedError = exports.DatabaseQueryError = exports.MissingConfigError = exports.DuplicateEntryError = exports.DiskSpaceError = exports.EntityNotFoundError = exports.UnauthorizedAccessError = exports.InvalidValueError = exports.ExpiredTokenError = exports.InternalError = exports.InvalidCredentialsError = exports.MissingParameterError = exports.JWTError = exports.TimeoutError = exports.StormError = exports.RawError = exports.ErrorCode = exports.GetMySQLVersion = exports.TransactionAccessLevel = exports.Transaction = exports.IsolationLevel = exports.SetSessionVariableQuery = exports.RawQuery = exports.DropTemporaryTableQuery = exports.TemporaryTableQuery = exports.Query = exports.ManagedDatabaseConnection = exports.MySQLConnection = exports.MySQLDatabase = exports.DatabaseConnection = exports.Database = exports.ConfigLoader = exports.Application = exports.getInstance = void 0;
|
|
19
|
+
exports.Command = exports.formidable = exports.Polygon = exports.LineString = exports.Point = void 0;
|
|
20
20
|
const tslib_1 = require("tslib");
|
|
21
21
|
// Application
|
|
22
22
|
var instance_1 = require("./instance");
|
|
@@ -53,6 +53,8 @@ var Transaction_1 = require("./Transaction");
|
|
|
53
53
|
Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return Transaction_1.Transaction; } });
|
|
54
54
|
var TransactionAccessLevel_1 = require("./TransactionAccessLevel");
|
|
55
55
|
Object.defineProperty(exports, "TransactionAccessLevel", { enumerable: true, get: function () { return TransactionAccessLevel_1.TransactionAccessLevel; } });
|
|
56
|
+
var GetMySQLVersion_1 = require("./GetMySQLVersion");
|
|
57
|
+
Object.defineProperty(exports, "GetMySQLVersion", { enumerable: true, get: function () { return GetMySQLVersion_1.GetMySQLVersion; } });
|
|
56
58
|
// Errors
|
|
57
59
|
var ErrorCode_1 = require("./ErrorCode");
|
|
58
60
|
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return ErrorCode_1.ErrorCode; } });
|
package/lib/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;;;AAEF,cAAc;AACd,uCAAuC;AAA/B,uGAAA,WAAW,OAAA;AACnB,6CAGuB;AAFnB,0GAAA,WAAW,OAAA;AAIf,SAAS;AACT,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AAEpB,WAAW;AACX,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,2DAAwD;AAAhD,wHAAA,kBAAkB,OAAA;AAC1B,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,yEAAsE;AAA9D,sIAAA,yBAAyB,OAAA;AACjC,iCAA8B;AAAtB,8FAAA,KAAK,OAAA;AACb,6DAAqF;AAA7E,0HAAA,mBAAmB,OAAA;AAC3B,qEAAkE;AAA1D,kIAAA,uBAAuB,OAAA;AAC/B,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAIhB,qEAAiG;AAAzF,kIAAA,uBAAuB,OAAA;AAC/B,mDAAgD;AAAxC,gHAAA,cAAc,OAAA;AACtB,6CAA0C;AAAlC,0GAAA,WAAW,OAAA;AAGnB,mEAAgE;AAAxD,gIAAA,sBAAsB,OAAA;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;;;AAEF,cAAc;AACd,uCAAuC;AAA/B,uGAAA,WAAW,OAAA;AACnB,6CAGuB;AAFnB,0GAAA,WAAW,OAAA;AAIf,SAAS;AACT,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AAEpB,WAAW;AACX,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,2DAAwD;AAAhD,wHAAA,kBAAkB,OAAA;AAC1B,iDAA8C;AAAtC,8GAAA,aAAa,OAAA;AACrB,qDAAkD;AAA1C,kHAAA,eAA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;AAApD,4HAAA,oBAAoB,OAAA;AAC5B,yDAAsD;AAA9C,sHAAA,iBAAiB,OAAA;AAEzB,OAAO;AACP,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,qCAAiD;AAAzC,kGAAA,OAAO,OAAA;AACf,uCAAkH;AAA1G,oGAAA,QAAQ,OAAA;AAChB,+CAA4C;AAApC,4GAAA,YAAY,OAAA;AACpB,qCAAkC;AAA1B,kGAAA,OAAO,OAAA;AACf,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AACvB,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AAkBvB,QAAQ;AACR,iCAA8B;AAAtB,8FAAA,KAAK,OAAA;AACb,+CAAwD;AAAhD,4GAAA,YAAY,OAAA;AAEpB,QAAQ;AACR,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAIhB,2DAAwD;AAAhD,wHAAA,kBAAkB,OAAA;AAC1B,iCAA8B;AAAtB,8FAAA,KAAK,OAAA;AACb,2CAAwC;AAAhC,wGAAA,UAAU,OAAA;AAClB,qCAAkC;AAA1B,kGAAA,OAAO,OAAA;AAEf,cAAc;AACd,+DAAyC;AACjC,gCAAU;AAElB,uCAAkC;AAA1B,oGAAA,OAAO,OAAA"}
|
|
@@ -3,6 +3,10 @@ interface IStatus {
|
|
|
3
3
|
File: string;
|
|
4
4
|
Position: string;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* For use with MySQL 8.0 and earlier. Obsolete since MySQL 8.4
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
6
10
|
export declare class GetMasterPositionQuery extends GetBinLogPositionQuery<IStatus> {
|
|
7
11
|
protected _getQuery(): string;
|
|
8
12
|
protected _getFile(row: IStatus): string;
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.GetMasterPositionQuery = void 0;
|
|
19
19
|
const GetBinLogPositionQuery_1 = require("./GetBinLogPositionQuery");
|
|
20
|
+
/**
|
|
21
|
+
* For use with MySQL 8.0 and earlier. Obsolete since MySQL 8.4
|
|
22
|
+
* @deprecated
|
|
23
|
+
*/
|
|
20
24
|
class GetMasterPositionQuery extends GetBinLogPositionQuery_1.GetBinLogPositionQuery {
|
|
21
25
|
_getQuery() {
|
|
22
26
|
return 'SHOW MASTER STATUS';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetMasterPositionQuery.js","sourceRoot":"","sources":["../../src/private/GetMasterPositionQuery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,qEAAkE;AAOlE,MAAa,sBAAuB,SAAQ,+CAA+B;IAEpD,SAAS;QACxB,OAAO,oBAAoB,CAAC;IAChC,CAAC;IAEkB,QAAQ,CAAC,GAAY;QACpC,OAAO,GAAG,CAAC,IAAI,CAAC;IACpB,CAAC;IAEkB,YAAY,CAAC,GAAY;QACxC,OAAO,GAAG,CAAC,QAAQ,CAAC;IACxB,CAAC;CACJ;AAbD,wDAaC"}
|
|
1
|
+
{"version":3,"file":"GetMasterPositionQuery.js","sourceRoot":"","sources":["../../src/private/GetMasterPositionQuery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,qEAAkE;AAOlE;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,+CAA+B;IAEpD,SAAS;QACxB,OAAO,oBAAoB,CAAC;IAChC,CAAC;IAEkB,QAAQ,CAAC,GAAY;QACpC,OAAO,GAAG,CAAC,IAAI,CAAC;IACpB,CAAC;IAEkB,YAAY,CAAC,GAAY;QACxC,OAAO,GAAG,CAAC,QAAQ,CAAC;IACxB,CAAC;CACJ;AAbD,wDAaC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GetBinLogPositionQuery } from './GetBinLogPositionQuery';
|
|
2
|
+
interface IStatus {
|
|
3
|
+
File: string;
|
|
4
|
+
Position: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* For use with MySQL 8.4 and later
|
|
8
|
+
*/
|
|
9
|
+
export declare class GetPrimaryPositionQuery extends GetBinLogPositionQuery<IStatus> {
|
|
10
|
+
protected _getQuery(): string;
|
|
11
|
+
protected _getFile(row: IStatus): string;
|
|
12
|
+
protected _getPosition(row: IStatus): string;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2017-2024 Norman Breau
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.GetPrimaryPositionQuery = void 0;
|
|
19
|
+
const GetBinLogPositionQuery_1 = require("./GetBinLogPositionQuery");
|
|
20
|
+
/**
|
|
21
|
+
* For use with MySQL 8.4 and later
|
|
22
|
+
*/
|
|
23
|
+
class GetPrimaryPositionQuery extends GetBinLogPositionQuery_1.GetBinLogPositionQuery {
|
|
24
|
+
_getQuery() {
|
|
25
|
+
return 'SHOW BINARY LOG STATUS';
|
|
26
|
+
}
|
|
27
|
+
_getFile(row) {
|
|
28
|
+
return row.File;
|
|
29
|
+
}
|
|
30
|
+
_getPosition(row) {
|
|
31
|
+
return row.Position;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.GetPrimaryPositionQuery = GetPrimaryPositionQuery;
|
|
35
|
+
//# sourceMappingURL=GetPrimaryPositionQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetPrimaryPositionQuery.js","sourceRoot":"","sources":["../../src/private/GetPrimaryPositionQuery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;EAcE;;;AAEF,qEAAkE;AAOlE;;GAEG;AACH,MAAa,uBAAwB,SAAQ,+CAA+B;IAErD,SAAS;QACxB,OAAO,wBAAwB,CAAC;IACpC,CAAC;IAEkB,QAAQ,CAAC,GAAY;QACpC,OAAO,GAAG,CAAC,IAAI,CAAC;IACpB,CAAC;IAEkB,YAAY,CAAC,GAAY;QACxC,OAAO,GAAG,CAAC,QAAQ,CAAC;IACxB,CAAC;CACJ;AAbD,0DAaC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import { IDatabaseConnection } from './IDatabaseConnection';
|
|
3
|
+
import {Query} from './Query';
|
|
4
|
+
|
|
5
|
+
export interface IGetMySQLVersionResult {
|
|
6
|
+
major: number;
|
|
7
|
+
minor: number;
|
|
8
|
+
patch: number;
|
|
9
|
+
version: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IGetMySQLVersionRow {
|
|
13
|
+
version: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class GetMySQLVersion extends Query<void, IGetMySQLVersionRow[], IGetMySQLVersionResult> {
|
|
17
|
+
protected override _getQuery(connection: IDatabaseConnection): string {
|
|
18
|
+
return 'SELECT VERSION() AS version';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public override async onPostProcess(connection: IDatabaseConnection, resultSet: IGetMySQLVersionRow[]): Promise<IGetMySQLVersionResult> {
|
|
22
|
+
let result: IGetMySQLVersionRow = resultSet[0];
|
|
23
|
+
if (!result) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let parts: string[] = result.version.split('.');
|
|
28
|
+
let major: number = parseInt(parts[0]);
|
|
29
|
+
let minor: number = parseInt(parts[1]);
|
|
30
|
+
let patch: number = parseInt(parts[2]);
|
|
31
|
+
|
|
32
|
+
let out: IGetMySQLVersionResult = {
|
|
33
|
+
major: major,
|
|
34
|
+
minor: minor,
|
|
35
|
+
patch: patch,
|
|
36
|
+
version: result.version
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/MySQLConnection.ts
CHANGED
|
@@ -37,6 +37,9 @@ import { GetMasterPositionQuery } from './private/GetMasterPositionQuery';
|
|
|
37
37
|
import { IQueryable } from './IQueryable';
|
|
38
38
|
import { TransactionAccessLevel } from './TransactionAccessLevel';
|
|
39
39
|
import { GetProcessList, IGetProcessListOutput } from './private/GetProcessList';
|
|
40
|
+
import { GetMySQLVersion, IGetMySQLVersionResult } from './GetMySQLVersion';
|
|
41
|
+
import { GetPrimaryPositionQuery } from './private/GetPrimaryPositionQuery';
|
|
42
|
+
import { queryFormatter } from './mysql/queryFormatter';
|
|
40
43
|
|
|
41
44
|
const DEFAULT_HIGH_WATERMARK: number = 512; // in number of result objects
|
|
42
45
|
const TAG: string = 'MySQLConnection';
|
|
@@ -64,6 +67,7 @@ export class MySQLConnection extends DatabaseConnection<MySQL.PoolConnection> {
|
|
|
64
67
|
private $opened: boolean;
|
|
65
68
|
private $hasReplicationEnabled: boolean;
|
|
66
69
|
private $isMasterConnection: boolean;
|
|
70
|
+
private $version: IGetMySQLVersionResult;
|
|
67
71
|
|
|
68
72
|
public constructor(connection: MySQL.PoolConnection, instantiationStack: string, isReadOnly: boolean = true) {
|
|
69
73
|
connection.config.namedPlaceholders = true;
|
|
@@ -130,6 +134,14 @@ export class MySQLConnection extends DatabaseConnection<MySQL.PoolConnection> {
|
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
136
|
|
|
137
|
+
public async getVersion(): Promise<IGetMySQLVersionResult> {
|
|
138
|
+
if (!this.$version) {
|
|
139
|
+
this.$version = await new GetMySQLVersion().execute(this);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return {...this.$version};
|
|
143
|
+
}
|
|
144
|
+
|
|
133
145
|
public override formatQuery(query: IQueryable<any>): string {
|
|
134
146
|
return this.getAPI().format(query.getQuery(this), query.getParametersForQuery());
|
|
135
147
|
}
|
|
@@ -165,17 +177,37 @@ export class MySQLConnection extends DatabaseConnection<MySQL.PoolConnection> {
|
|
|
165
177
|
}
|
|
166
178
|
|
|
167
179
|
public override async getCurrentDatabasePosition(): Promise<IDatabasePosition> {
|
|
168
|
-
let
|
|
180
|
+
let version: IGetMySQLVersionResult = await this.getVersion();
|
|
181
|
+
let statusQuery: GetBinLogPositionQuery = null;
|
|
182
|
+
|
|
183
|
+
if (
|
|
184
|
+
(version.major === 8 && version.minor >= 4) || version.major >= 9
|
|
185
|
+
) {
|
|
186
|
+
// >= 8.4 we need to use a different setof master/slave queries
|
|
187
|
+
statusQuery = this.isReplication() ? new GetSlavePositionQuery() : new GetPrimaryPositionQuery();
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
statusQuery = this.isReplication() ? new GetSlavePositionQuery() : new GetMasterPositionQuery();
|
|
191
|
+
}
|
|
192
|
+
|
|
169
193
|
return await statusQuery.execute(this);
|
|
170
194
|
}
|
|
171
195
|
|
|
172
196
|
protected _query(query: string, params?: any): Promise<any> {
|
|
173
197
|
let logger: BaseLogger = getInstance().getLogger();
|
|
198
|
+
|
|
199
|
+
// MySQL2 doesn't seem to be reliable for their named parameter support,
|
|
200
|
+
// so we will fall back to our original implementation, but prep the query
|
|
201
|
+
// string manually via queryFormatter (which makes use of MySQL.escape).
|
|
202
|
+
// This means we won't use the params argument on the main query call.
|
|
203
|
+
|
|
204
|
+
let preparedQuery: string = queryFormatter(query, params);
|
|
205
|
+
|
|
174
206
|
return new Promise((resolve, reject) => {
|
|
175
207
|
let queryObject: MySQL.Query = this.getAPI().query({
|
|
176
|
-
sql:
|
|
208
|
+
sql: preparedQuery,
|
|
177
209
|
timeout: this.getTimeout()
|
|
178
|
-
},
|
|
210
|
+
}, null, (error: MySQL.QueryError, results: any) => {
|
|
179
211
|
if (error) {
|
|
180
212
|
let sql: string = queryObject.sql;
|
|
181
213
|
// Formatting queries can be an expensive task, so only do it if the log level is actually silly.
|
|
@@ -184,7 +216,7 @@ export class MySQLConnection extends DatabaseConnection<MySQL.PoolConnection> {
|
|
|
184
216
|
// SQLFormatter doesn't understand all MySQL syntaxes, so this is to prevent
|
|
185
217
|
// potentially valid queries from becoming errors simply because we couldn't
|
|
186
218
|
// log them.
|
|
187
|
-
sql = SQLFormatter.formatDialect(
|
|
219
|
+
sql = SQLFormatter.formatDialect(preparedQuery, {
|
|
188
220
|
...SQL_FORMATTING_OPTIONS,
|
|
189
221
|
dialect: SQLFormatter.mysql
|
|
190
222
|
});
|
package/src/api.ts
CHANGED
|
@@ -43,6 +43,7 @@ export {Transaction} from './Transaction';
|
|
|
43
43
|
export {IOKPacket} from './IOKPacket';
|
|
44
44
|
export {IStoredProcedureResult} from './IStoredProcedureResult';
|
|
45
45
|
export {TransactionAccessLevel} from './TransactionAccessLevel';
|
|
46
|
+
export {GetMySQLVersion, IGetMySQLVersionResult, IGetMySQLVersionRow} from './GetMySQLVersion';
|
|
46
47
|
|
|
47
48
|
// Errors
|
|
48
49
|
export {ErrorCode} from './ErrorCode';
|
|
@@ -21,6 +21,10 @@ interface IStatus {
|
|
|
21
21
|
Position: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* For use with MySQL 8.0 and earlier. Obsolete since MySQL 8.4
|
|
26
|
+
* @deprecated
|
|
27
|
+
*/
|
|
24
28
|
export class GetMasterPositionQuery extends GetBinLogPositionQuery<IStatus> {
|
|
25
29
|
|
|
26
30
|
protected override _getQuery(): string {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2017-2024 Norman Breau
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { GetBinLogPositionQuery } from './GetBinLogPositionQuery';
|
|
18
|
+
|
|
19
|
+
interface IStatus {
|
|
20
|
+
File: string;
|
|
21
|
+
Position: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* For use with MySQL 8.4 and later
|
|
26
|
+
*/
|
|
27
|
+
export class GetPrimaryPositionQuery extends GetBinLogPositionQuery<IStatus> {
|
|
28
|
+
|
|
29
|
+
protected override _getQuery(): string {
|
|
30
|
+
return 'SHOW BINARY LOG STATUS';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
protected override _getFile(row: IStatus): string {
|
|
34
|
+
return row.File;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
protected override _getPosition(row: IStatus): string {
|
|
38
|
+
return row.Position;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
Binary file
|