node-server-dev 3.1.5 → 3.1.7
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/cjs/browser.js +1 -1
- package/dist/cjs/getAllRouter/index.js +1 -1
- package/dist/cjs/hash/index.js +1 -1
- package/dist/cjs/id/index.js +1 -1
- package/dist/cjs/id/random.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/jwt/index.js +1 -1
- package/dist/cjs/mac/index.js +1 -1
- package/dist/cjs/package/mysql2/License +19 -0
- package/dist/cjs/package/mysql2/README.md +114 -0
- package/dist/cjs/package/mysql2/index.d.ts +1 -0
- package/dist/cjs/package/mysql2/index.js +77 -0
- package/dist/cjs/package/mysql2/lib/auth_41.js +95 -0
- package/dist/cjs/package/mysql2/lib/auth_plugins/caching_sha2_password.js +108 -0
- package/dist/cjs/package/mysql2/lib/auth_plugins/caching_sha2_password.md +18 -0
- package/dist/cjs/package/mysql2/lib/auth_plugins/index.js +8 -0
- package/dist/cjs/package/mysql2/lib/auth_plugins/mysql_clear_password.js +17 -0
- package/dist/cjs/package/mysql2/lib/auth_plugins/mysql_native_password.js +34 -0
- package/dist/cjs/package/mysql2/lib/auth_plugins/sha256_password.js +59 -0
- package/dist/cjs/package/mysql2/lib/base/connection.js +945 -0
- package/dist/cjs/package/mysql2/lib/base/pool.js +233 -0
- package/dist/cjs/package/mysql2/lib/base/pool_connection.js +63 -0
- package/dist/cjs/package/mysql2/lib/commands/auth_switch.js +111 -0
- package/dist/cjs/package/mysql2/lib/commands/binlog_dump.js +109 -0
- package/dist/cjs/package/mysql2/lib/commands/change_user.js +68 -0
- package/dist/cjs/package/mysql2/lib/commands/client_handshake.js +241 -0
- package/dist/cjs/package/mysql2/lib/commands/close_statement.js +18 -0
- package/dist/cjs/package/mysql2/lib/commands/command.js +54 -0
- package/dist/cjs/package/mysql2/lib/commands/execute.js +112 -0
- package/dist/cjs/package/mysql2/lib/commands/index.js +27 -0
- package/dist/cjs/package/mysql2/lib/commands/ping.js +36 -0
- package/dist/cjs/package/mysql2/lib/commands/prepare.js +143 -0
- package/dist/cjs/package/mysql2/lib/commands/query.js +329 -0
- package/dist/cjs/package/mysql2/lib/commands/quit.js +29 -0
- package/dist/cjs/package/mysql2/lib/commands/register_slave.js +27 -0
- package/dist/cjs/package/mysql2/lib/commands/server_handshake.js +203 -0
- package/dist/cjs/package/mysql2/lib/compressed_protocol.js +127 -0
- package/dist/cjs/package/mysql2/lib/connection.js +12 -0
- package/dist/cjs/package/mysql2/lib/connection_config.js +292 -0
- package/dist/cjs/package/mysql2/lib/constants/charset_encodings.js +316 -0
- package/dist/cjs/package/mysql2/lib/constants/charsets.js +317 -0
- package/dist/cjs/package/mysql2/lib/constants/client.js +39 -0
- package/dist/cjs/package/mysql2/lib/constants/commands.js +36 -0
- package/dist/cjs/package/mysql2/lib/constants/cursor.js +8 -0
- package/dist/cjs/package/mysql2/lib/constants/encoding_charset.js +49 -0
- package/dist/cjs/package/mysql2/lib/constants/errors.js +3973 -0
- package/dist/cjs/package/mysql2/lib/constants/field_flags.js +20 -0
- package/dist/cjs/package/mysql2/lib/constants/server_status.js +44 -0
- package/dist/cjs/package/mysql2/lib/constants/session_track.js +11 -0
- package/dist/cjs/package/mysql2/lib/constants/ssl_profiles.js +11 -0
- package/dist/cjs/package/mysql2/lib/constants/types.js +64 -0
- package/dist/cjs/package/mysql2/lib/create_connection.js +10 -0
- package/dist/cjs/package/mysql2/lib/create_pool.js +10 -0
- package/dist/cjs/package/mysql2/lib/create_pool_cluster.js +9 -0
- package/dist/cjs/package/mysql2/lib/helpers.js +86 -0
- package/dist/cjs/package/mysql2/lib/packet_parser.js +195 -0
- package/dist/cjs/package/mysql2/lib/packets/auth_next_factor.js +35 -0
- package/dist/cjs/package/mysql2/lib/packets/auth_switch_request.js +38 -0
- package/dist/cjs/package/mysql2/lib/packets/auth_switch_request_more_data.js +33 -0
- package/dist/cjs/package/mysql2/lib/packets/auth_switch_response.js +30 -0
- package/dist/cjs/package/mysql2/lib/packets/binary_row.js +95 -0
- package/dist/cjs/package/mysql2/lib/packets/binlog_dump.js +33 -0
- package/dist/cjs/package/mysql2/lib/packets/binlog_query_statusvars.js +115 -0
- package/dist/cjs/package/mysql2/lib/packets/change_user.js +97 -0
- package/dist/cjs/package/mysql2/lib/packets/close_statement.js +21 -0
- package/dist/cjs/package/mysql2/lib/packets/column_definition.js +291 -0
- package/dist/cjs/package/mysql2/lib/packets/execute.js +214 -0
- package/dist/cjs/package/mysql2/lib/packets/handshake.js +112 -0
- package/dist/cjs/package/mysql2/lib/packets/handshake_response.js +144 -0
- package/dist/cjs/package/mysql2/lib/packets/index.js +152 -0
- package/dist/cjs/package/mysql2/lib/packets/packet.js +931 -0
- package/dist/cjs/package/mysql2/lib/packets/prepare_statement.js +27 -0
- package/dist/cjs/package/mysql2/lib/packets/prepared_statement_header.js +16 -0
- package/dist/cjs/package/mysql2/lib/packets/query.js +27 -0
- package/dist/cjs/package/mysql2/lib/packets/register_slave.js +46 -0
- package/dist/cjs/package/mysql2/lib/packets/resultset_header.js +118 -0
- package/dist/cjs/package/mysql2/lib/packets/ssl_request.js +25 -0
- package/dist/cjs/package/mysql2/lib/packets/text_row.js +47 -0
- package/dist/cjs/package/mysql2/lib/parsers/binary_parser.js +231 -0
- package/dist/cjs/package/mysql2/lib/parsers/parser_cache.js +66 -0
- package/dist/cjs/package/mysql2/lib/parsers/static_binary_parser.js +211 -0
- package/dist/cjs/package/mysql2/lib/parsers/static_text_parser.js +152 -0
- package/dist/cjs/package/mysql2/lib/parsers/string.js +50 -0
- package/dist/cjs/package/mysql2/lib/parsers/text_parser.js +214 -0
- package/dist/cjs/package/mysql2/lib/pool.js +12 -0
- package/dist/cjs/package/mysql2/lib/pool_cluster.js +369 -0
- package/dist/cjs/package/mysql2/lib/pool_config.js +30 -0
- package/dist/cjs/package/mysql2/lib/pool_connection.js +12 -0
- package/dist/cjs/package/mysql2/lib/promise/connection.js +222 -0
- package/dist/cjs/package/mysql2/lib/promise/inherit_events.js +27 -0
- package/dist/cjs/package/mysql2/lib/promise/make_done_cb.js +19 -0
- package/dist/cjs/package/mysql2/lib/promise/pool.js +112 -0
- package/dist/cjs/package/mysql2/lib/promise/pool_cluster.js +54 -0
- package/dist/cjs/package/mysql2/lib/promise/pool_connection.js +19 -0
- package/dist/cjs/package/mysql2/lib/promise/prepared_statement_info.js +32 -0
- package/dist/cjs/package/mysql2/lib/results_stream.js +38 -0
- package/dist/cjs/package/mysql2/lib/server.js +37 -0
- package/dist/cjs/package/mysql2/package.json +80 -0
- package/dist/cjs/package/mysql2/promise.d.ts +131 -0
- package/dist/cjs/package/mysql2/promise.js +202 -0
- package/dist/cjs/package/mysql2/typings/mysql/LICENSE.txt +15 -0
- package/dist/cjs/package/mysql2/typings/mysql/index.d.ts +95 -0
- package/dist/cjs/package/mysql2/typings/mysql/info.txt +1 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/Auth.d.ts +30 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/Connection.d.ts +428 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/Pool.d.ts +69 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/PoolCluster.d.ts +90 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/PoolConnection.d.ts +10 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/Server.d.ts +11 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/constants/CharsetToEncoding.d.ts +8 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/constants/Charsets.d.ts +326 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/constants/Types.d.ts +70 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/constants/index.d.ts +5 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/parsers/ParserCache.d.ts +4 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/parsers/index.d.ts +18 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/parsers/typeCast.d.ts +54 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/packets/Field.d.ts +10 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/packets/FieldPacket.d.ts +27 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/packets/OkPacket.d.ts +23 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/packets/ProcedurePacket.d.ts +13 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts +18 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/packets/RowDataPacket.d.ts +9 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/packets/index.d.ts +28 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/packets/params/ErrorPacketParams.d.ts +6 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/packets/params/OkPacketParams.d.ts +9 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts +40 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/sequences/Prepare.d.ts +65 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/sequences/Query.d.ts +170 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/sequences/QueryableBase.d.ts +40 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/sequences/Sequence.d.ts +5 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.d.ts +21 -0
- package/dist/cjs/package/mysql2/typings/mysql/lib/protocol/sequences/promise/QueryableBase.d.ts +21 -0
- package/dist/cjs/package/mysql_backup/index.js +69 -0
- package/dist/cjs/package/mysql_backup/promise.js +187 -0
- package/dist/cjs/server.d.ts +1 -1
- package/dist/cjs/server.d.ts.map +1 -1
- package/dist/cjs/server.js +1 -1
- package/dist/cjs/start.js +1 -1
- package/dist/cjs/update.js +1 -1
- package/dist/esm/browser.js +1 -1
- package/dist/esm/getAllRouter/index.js +1 -1
- package/dist/esm/hash/index.js +1 -1
- package/dist/esm/id/index.js +1 -1
- package/dist/esm/id/random.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/jwt/index.js +1 -1
- package/dist/esm/mac/index.js +1 -1
- package/dist/esm/package/mysql2/License +19 -0
- package/dist/esm/package/mysql2/README.md +114 -0
- package/dist/esm/package/mysql2/index.d.ts +1 -0
- package/dist/esm/package/mysql2/index.js +77 -0
- package/dist/esm/package/mysql2/lib/auth_41.js +95 -0
- package/dist/esm/package/mysql2/lib/auth_plugins/caching_sha2_password.js +108 -0
- package/dist/esm/package/mysql2/lib/auth_plugins/caching_sha2_password.md +18 -0
- package/dist/esm/package/mysql2/lib/auth_plugins/index.js +8 -0
- package/dist/esm/package/mysql2/lib/auth_plugins/mysql_clear_password.js +17 -0
- package/dist/esm/package/mysql2/lib/auth_plugins/mysql_native_password.js +34 -0
- package/dist/esm/package/mysql2/lib/auth_plugins/sha256_password.js +59 -0
- package/dist/esm/package/mysql2/lib/base/connection.js +945 -0
- package/dist/esm/package/mysql2/lib/base/pool.js +233 -0
- package/dist/esm/package/mysql2/lib/base/pool_connection.js +63 -0
- package/dist/esm/package/mysql2/lib/commands/auth_switch.js +111 -0
- package/dist/esm/package/mysql2/lib/commands/binlog_dump.js +109 -0
- package/dist/esm/package/mysql2/lib/commands/change_user.js +68 -0
- package/dist/esm/package/mysql2/lib/commands/client_handshake.js +241 -0
- package/dist/esm/package/mysql2/lib/commands/close_statement.js +18 -0
- package/dist/esm/package/mysql2/lib/commands/command.js +54 -0
- package/dist/esm/package/mysql2/lib/commands/execute.js +112 -0
- package/dist/esm/package/mysql2/lib/commands/index.js +27 -0
- package/dist/esm/package/mysql2/lib/commands/ping.js +36 -0
- package/dist/esm/package/mysql2/lib/commands/prepare.js +143 -0
- package/dist/esm/package/mysql2/lib/commands/query.js +329 -0
- package/dist/esm/package/mysql2/lib/commands/quit.js +29 -0
- package/dist/esm/package/mysql2/lib/commands/register_slave.js +27 -0
- package/dist/esm/package/mysql2/lib/commands/server_handshake.js +203 -0
- package/dist/esm/package/mysql2/lib/compressed_protocol.js +127 -0
- package/dist/esm/package/mysql2/lib/connection.js +12 -0
- package/dist/esm/package/mysql2/lib/connection_config.js +292 -0
- package/dist/esm/package/mysql2/lib/constants/charset_encodings.js +316 -0
- package/dist/esm/package/mysql2/lib/constants/charsets.js +317 -0
- package/dist/esm/package/mysql2/lib/constants/client.js +39 -0
- package/dist/esm/package/mysql2/lib/constants/commands.js +36 -0
- package/dist/esm/package/mysql2/lib/constants/cursor.js +8 -0
- package/dist/esm/package/mysql2/lib/constants/encoding_charset.js +49 -0
- package/dist/esm/package/mysql2/lib/constants/errors.js +3973 -0
- package/dist/esm/package/mysql2/lib/constants/field_flags.js +20 -0
- package/dist/esm/package/mysql2/lib/constants/server_status.js +44 -0
- package/dist/esm/package/mysql2/lib/constants/session_track.js +11 -0
- package/dist/esm/package/mysql2/lib/constants/ssl_profiles.js +11 -0
- package/dist/esm/package/mysql2/lib/constants/types.js +64 -0
- package/dist/esm/package/mysql2/lib/create_connection.js +10 -0
- package/dist/esm/package/mysql2/lib/create_pool.js +10 -0
- package/dist/esm/package/mysql2/lib/create_pool_cluster.js +9 -0
- package/dist/esm/package/mysql2/lib/helpers.js +86 -0
- package/dist/esm/package/mysql2/lib/packet_parser.js +195 -0
- package/dist/esm/package/mysql2/lib/packets/auth_next_factor.js +35 -0
- package/dist/esm/package/mysql2/lib/packets/auth_switch_request.js +38 -0
- package/dist/esm/package/mysql2/lib/packets/auth_switch_request_more_data.js +33 -0
- package/dist/esm/package/mysql2/lib/packets/auth_switch_response.js +30 -0
- package/dist/esm/package/mysql2/lib/packets/binary_row.js +95 -0
- package/dist/esm/package/mysql2/lib/packets/binlog_dump.js +33 -0
- package/dist/esm/package/mysql2/lib/packets/binlog_query_statusvars.js +115 -0
- package/dist/esm/package/mysql2/lib/packets/change_user.js +97 -0
- package/dist/esm/package/mysql2/lib/packets/close_statement.js +21 -0
- package/dist/esm/package/mysql2/lib/packets/column_definition.js +291 -0
- package/dist/esm/package/mysql2/lib/packets/execute.js +214 -0
- package/dist/esm/package/mysql2/lib/packets/handshake.js +112 -0
- package/dist/esm/package/mysql2/lib/packets/handshake_response.js +144 -0
- package/dist/esm/package/mysql2/lib/packets/index.js +152 -0
- package/dist/esm/package/mysql2/lib/packets/packet.js +931 -0
- package/dist/esm/package/mysql2/lib/packets/prepare_statement.js +27 -0
- package/dist/esm/package/mysql2/lib/packets/prepared_statement_header.js +16 -0
- package/dist/esm/package/mysql2/lib/packets/query.js +27 -0
- package/dist/esm/package/mysql2/lib/packets/register_slave.js +46 -0
- package/dist/esm/package/mysql2/lib/packets/resultset_header.js +118 -0
- package/dist/esm/package/mysql2/lib/packets/ssl_request.js +25 -0
- package/dist/esm/package/mysql2/lib/packets/text_row.js +47 -0
- package/dist/esm/package/mysql2/lib/parsers/binary_parser.js +231 -0
- package/dist/esm/package/mysql2/lib/parsers/parser_cache.js +66 -0
- package/dist/esm/package/mysql2/lib/parsers/static_binary_parser.js +211 -0
- package/dist/esm/package/mysql2/lib/parsers/static_text_parser.js +152 -0
- package/dist/esm/package/mysql2/lib/parsers/string.js +50 -0
- package/dist/esm/package/mysql2/lib/parsers/text_parser.js +214 -0
- package/dist/esm/package/mysql2/lib/pool.js +12 -0
- package/dist/esm/package/mysql2/lib/pool_cluster.js +369 -0
- package/dist/esm/package/mysql2/lib/pool_config.js +30 -0
- package/dist/esm/package/mysql2/lib/pool_connection.js +12 -0
- package/dist/esm/package/mysql2/lib/promise/connection.js +222 -0
- package/dist/esm/package/mysql2/lib/promise/inherit_events.js +27 -0
- package/dist/esm/package/mysql2/lib/promise/make_done_cb.js +19 -0
- package/dist/esm/package/mysql2/lib/promise/pool.js +112 -0
- package/dist/esm/package/mysql2/lib/promise/pool_cluster.js +54 -0
- package/dist/esm/package/mysql2/lib/promise/pool_connection.js +19 -0
- package/dist/esm/package/mysql2/lib/promise/prepared_statement_info.js +32 -0
- package/dist/esm/package/mysql2/lib/results_stream.js +38 -0
- package/dist/esm/package/mysql2/lib/server.js +37 -0
- package/dist/esm/package/mysql2/package.json +80 -0
- package/dist/esm/package/mysql2/promise.d.ts +131 -0
- package/dist/esm/package/mysql2/promise.js +202 -0
- package/dist/esm/package/mysql2/typings/mysql/LICENSE.txt +15 -0
- package/dist/esm/package/mysql2/typings/mysql/index.d.ts +95 -0
- package/dist/esm/package/mysql2/typings/mysql/info.txt +1 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/Auth.d.ts +30 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/Connection.d.ts +428 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/Pool.d.ts +69 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/PoolCluster.d.ts +90 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/PoolConnection.d.ts +10 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/Server.d.ts +11 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/constants/CharsetToEncoding.d.ts +8 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/constants/Charsets.d.ts +326 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/constants/Types.d.ts +70 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/constants/index.d.ts +5 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/parsers/ParserCache.d.ts +4 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/parsers/index.d.ts +18 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/parsers/typeCast.d.ts +54 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/packets/Field.d.ts +10 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/packets/FieldPacket.d.ts +27 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/packets/OkPacket.d.ts +23 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/packets/ProcedurePacket.d.ts +13 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts +18 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/packets/RowDataPacket.d.ts +9 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/packets/index.d.ts +28 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/packets/params/ErrorPacketParams.d.ts +6 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/packets/params/OkPacketParams.d.ts +9 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts +40 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/sequences/Prepare.d.ts +65 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/sequences/Query.d.ts +170 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/sequences/QueryableBase.d.ts +40 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/sequences/Sequence.d.ts +5 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.d.ts +21 -0
- package/dist/esm/package/mysql2/typings/mysql/lib/protocol/sequences/promise/QueryableBase.d.ts +21 -0
- package/dist/esm/package/mysql_backup/index.js +69 -0
- package/dist/esm/package/mysql_backup/promise.js +187 -0
- package/dist/esm/server.d.ts +1 -1
- package/dist/esm/server.d.ts.map +1 -1
- package/dist/esm/server.js +1 -1
- package/dist/esm/start.js +1 -1
- package/dist/esm/update.js +1 -1
- package/package.json +3 -4
@@ -0,0 +1,233 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const process = require('process');
|
4
|
+
const SqlString = require('sqlstring');
|
5
|
+
const EventEmitter = require('events').EventEmitter;
|
6
|
+
const PoolConnection = require('../pool_connection.js');
|
7
|
+
const Queue = require('denque');
|
8
|
+
const BaseConnection = require('./connection.js');
|
9
|
+
|
10
|
+
function spliceConnection(queue, connection) {
|
11
|
+
const len = queue.length;
|
12
|
+
for (let i = 0; i < len; i++) {
|
13
|
+
if (queue.get(i) === connection) {
|
14
|
+
queue.removeOne(i);
|
15
|
+
break;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
class BasePool extends EventEmitter {
|
21
|
+
constructor(options) {
|
22
|
+
super();
|
23
|
+
this.config = options.config;
|
24
|
+
this.config.connectionConfig.pool = this;
|
25
|
+
this._allConnections = new Queue();
|
26
|
+
this._freeConnections = new Queue();
|
27
|
+
this._connectionQueue = new Queue();
|
28
|
+
this._closed = false;
|
29
|
+
if (this.config.maxIdle < this.config.connectionLimit) {
|
30
|
+
// create idle connection timeout automatically release job
|
31
|
+
this._removeIdleTimeoutConnections();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
getConnection(cb) {
|
36
|
+
if (this._closed) {
|
37
|
+
return process.nextTick(() => cb(new Error('Pool is closed.')));
|
38
|
+
}
|
39
|
+
let connection;
|
40
|
+
if (this._freeConnections.length > 0) {
|
41
|
+
connection = this._freeConnections.pop();
|
42
|
+
this.emit('acquire', connection);
|
43
|
+
return process.nextTick(() => cb(null, connection));
|
44
|
+
}
|
45
|
+
if (
|
46
|
+
this.config.connectionLimit === 0 ||
|
47
|
+
this._allConnections.length < this.config.connectionLimit
|
48
|
+
) {
|
49
|
+
connection = new PoolConnection(this, {
|
50
|
+
config: this.config.connectionConfig,
|
51
|
+
});
|
52
|
+
this._allConnections.push(connection);
|
53
|
+
return connection.connect((err) => {
|
54
|
+
if (this._closed) {
|
55
|
+
return cb(new Error('Pool is closed.'));
|
56
|
+
}
|
57
|
+
if (err) {
|
58
|
+
return cb(err);
|
59
|
+
}
|
60
|
+
this.emit('connection', connection);
|
61
|
+
this.emit('acquire', connection);
|
62
|
+
return cb(null, connection);
|
63
|
+
});
|
64
|
+
}
|
65
|
+
if (!this.config.waitForConnections) {
|
66
|
+
return process.nextTick(() => cb(new Error('No connections available.')));
|
67
|
+
}
|
68
|
+
if (
|
69
|
+
this.config.queueLimit &&
|
70
|
+
this._connectionQueue.length >= this.config.queueLimit
|
71
|
+
) {
|
72
|
+
return cb(new Error('Queue limit reached.'));
|
73
|
+
}
|
74
|
+
this.emit('enqueue');
|
75
|
+
return this._connectionQueue.push(cb);
|
76
|
+
}
|
77
|
+
|
78
|
+
releaseConnection(connection) {
|
79
|
+
let cb;
|
80
|
+
if (!connection._pool) {
|
81
|
+
// The connection has been removed from the pool and is no longer good.
|
82
|
+
if (this._connectionQueue.length) {
|
83
|
+
cb = this._connectionQueue.shift();
|
84
|
+
process.nextTick(this.getConnection.bind(this, cb));
|
85
|
+
}
|
86
|
+
} else if (this._connectionQueue.length) {
|
87
|
+
cb = this._connectionQueue.shift();
|
88
|
+
process.nextTick(cb.bind(null, null, connection));
|
89
|
+
} else {
|
90
|
+
this._freeConnections.push(connection);
|
91
|
+
this.emit('release', connection);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
end(cb) {
|
96
|
+
this._closed = true;
|
97
|
+
clearTimeout(this._removeIdleTimeoutConnectionsTimer);
|
98
|
+
if (typeof cb !== 'function') {
|
99
|
+
cb = function (err) {
|
100
|
+
if (err) {
|
101
|
+
throw err;
|
102
|
+
}
|
103
|
+
};
|
104
|
+
}
|
105
|
+
let calledBack = false;
|
106
|
+
let closedConnections = 0;
|
107
|
+
let connection;
|
108
|
+
const endCB = function (err) {
|
109
|
+
if (calledBack) {
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
if (err || ++closedConnections >= this._allConnections.length) {
|
113
|
+
calledBack = true;
|
114
|
+
cb(err);
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
}.bind(this);
|
118
|
+
if (this._allConnections.length === 0) {
|
119
|
+
endCB();
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
for (let i = 0; i < this._allConnections.length; i++) {
|
123
|
+
connection = this._allConnections.get(i);
|
124
|
+
connection._realEnd(endCB);
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
query(sql, values, cb) {
|
129
|
+
const cmdQuery = BaseConnection.createQuery(
|
130
|
+
sql,
|
131
|
+
values,
|
132
|
+
cb,
|
133
|
+
this.config.connectionConfig
|
134
|
+
);
|
135
|
+
if (typeof cmdQuery.namedPlaceholders === 'undefined') {
|
136
|
+
cmdQuery.namedPlaceholders =
|
137
|
+
this.config.connectionConfig.namedPlaceholders;
|
138
|
+
}
|
139
|
+
this.getConnection((err, conn) => {
|
140
|
+
if (err) {
|
141
|
+
if (typeof cmdQuery.onResult === 'function') {
|
142
|
+
cmdQuery.onResult(err);
|
143
|
+
} else {
|
144
|
+
cmdQuery.emit('error', err);
|
145
|
+
}
|
146
|
+
return;
|
147
|
+
}
|
148
|
+
try {
|
149
|
+
conn.query(cmdQuery).once('end', () => {
|
150
|
+
conn.release();
|
151
|
+
});
|
152
|
+
} catch (e) {
|
153
|
+
conn.release();
|
154
|
+
throw e;
|
155
|
+
}
|
156
|
+
});
|
157
|
+
return cmdQuery;
|
158
|
+
}
|
159
|
+
|
160
|
+
execute(sql, values, cb) {
|
161
|
+
// TODO construct execute command first here and pass it to connection.execute
|
162
|
+
// so that polymorphic arguments logic is there in one place
|
163
|
+
if (typeof values === 'function') {
|
164
|
+
cb = values;
|
165
|
+
values = [];
|
166
|
+
}
|
167
|
+
this.getConnection((err, conn) => {
|
168
|
+
if (err) {
|
169
|
+
return cb(err);
|
170
|
+
}
|
171
|
+
try {
|
172
|
+
conn.execute(sql, values, cb).once('end', () => {
|
173
|
+
conn.release();
|
174
|
+
});
|
175
|
+
} catch (e) {
|
176
|
+
conn.release();
|
177
|
+
return cb(e);
|
178
|
+
}
|
179
|
+
});
|
180
|
+
}
|
181
|
+
|
182
|
+
_removeConnection(connection) {
|
183
|
+
// Remove connection from all connections
|
184
|
+
spliceConnection(this._allConnections, connection);
|
185
|
+
// Remove connection from free connections
|
186
|
+
spliceConnection(this._freeConnections, connection);
|
187
|
+
this.releaseConnection(connection);
|
188
|
+
}
|
189
|
+
|
190
|
+
_removeIdleTimeoutConnections() {
|
191
|
+
if (this._removeIdleTimeoutConnectionsTimer) {
|
192
|
+
clearTimeout(this._removeIdleTimeoutConnectionsTimer);
|
193
|
+
}
|
194
|
+
|
195
|
+
this._removeIdleTimeoutConnectionsTimer = setTimeout(() => {
|
196
|
+
try {
|
197
|
+
while (
|
198
|
+
this._freeConnections.length > this.config.maxIdle ||
|
199
|
+
(this._freeConnections.length > 0 &&
|
200
|
+
Date.now() - this._freeConnections.get(0).lastActiveTime >
|
201
|
+
this.config.idleTimeout)
|
202
|
+
) {
|
203
|
+
this._freeConnections.get(0).destroy();
|
204
|
+
}
|
205
|
+
} finally {
|
206
|
+
this._removeIdleTimeoutConnections();
|
207
|
+
}
|
208
|
+
}, 1000);
|
209
|
+
}
|
210
|
+
|
211
|
+
format(sql, values) {
|
212
|
+
return SqlString.format(
|
213
|
+
sql,
|
214
|
+
values,
|
215
|
+
this.config.connectionConfig.stringifyObjects,
|
216
|
+
this.config.connectionConfig.timezone
|
217
|
+
);
|
218
|
+
}
|
219
|
+
|
220
|
+
escape(value) {
|
221
|
+
return SqlString.escape(
|
222
|
+
value,
|
223
|
+
this.config.connectionConfig.stringifyObjects,
|
224
|
+
this.config.connectionConfig.timezone
|
225
|
+
);
|
226
|
+
}
|
227
|
+
|
228
|
+
escapeId(value) {
|
229
|
+
return SqlString.escapeId(value, false);
|
230
|
+
}
|
231
|
+
}
|
232
|
+
|
233
|
+
module.exports = BasePool;
|
@@ -0,0 +1,63 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const BaseConnection = require('./connection.js');
|
4
|
+
|
5
|
+
class BasePoolConnection extends BaseConnection {
|
6
|
+
constructor(pool, options) {
|
7
|
+
super(options);
|
8
|
+
this._pool = pool;
|
9
|
+
// The last active time of this connection
|
10
|
+
this.lastActiveTime = Date.now();
|
11
|
+
// When a fatal error occurs the connection's protocol ends, which will cause
|
12
|
+
// the connection to end as well, thus we only need to watch for the end event
|
13
|
+
// and we will be notified of disconnects.
|
14
|
+
// REVIEW: Moved to `once`
|
15
|
+
this.once('end', () => {
|
16
|
+
this._removeFromPool();
|
17
|
+
});
|
18
|
+
this.once('error', () => {
|
19
|
+
this._removeFromPool();
|
20
|
+
});
|
21
|
+
}
|
22
|
+
|
23
|
+
release() {
|
24
|
+
if (!this._pool || this._pool._closed) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
// update last active time
|
28
|
+
this.lastActiveTime = Date.now();
|
29
|
+
this._pool.releaseConnection(this);
|
30
|
+
}
|
31
|
+
|
32
|
+
end() {
|
33
|
+
const err = new Error(
|
34
|
+
'Calling conn.end() to release a pooled connection is ' +
|
35
|
+
'deprecated. In next version calling conn.end() will be ' +
|
36
|
+
'restored to default conn.end() behavior. Use ' +
|
37
|
+
'conn.release() instead.'
|
38
|
+
);
|
39
|
+
this.emit('warn', err);
|
40
|
+
console.warn(err.message);
|
41
|
+
this.release();
|
42
|
+
}
|
43
|
+
|
44
|
+
destroy() {
|
45
|
+
this._removeFromPool();
|
46
|
+
super.destroy();
|
47
|
+
}
|
48
|
+
|
49
|
+
_removeFromPool() {
|
50
|
+
if (!this._pool || this._pool._closed) {
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
const pool = this._pool;
|
54
|
+
this._pool = null;
|
55
|
+
pool._removeConnection(this);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
BasePoolConnection.statementKey = BaseConnection.statementKey;
|
60
|
+
module.exports = BasePoolConnection;
|
61
|
+
|
62
|
+
// TODO: Remove this when we are removing PoolConnection#end
|
63
|
+
BasePoolConnection.prototype._realEnd = BaseConnection.prototype.end;
|
@@ -0,0 +1,111 @@
|
|
1
|
+
// This file was modified by Oracle on July 5, 2021.
|
2
|
+
// Errors generated by asynchronous authentication plugins are now being
|
3
|
+
// handled and subsequently emitted at the command level.
|
4
|
+
// Modifications copyright (c) 2021, Oracle and/or its affiliates.
|
5
|
+
|
6
|
+
'use strict';
|
7
|
+
|
8
|
+
const Packets = require('../packets/index.js');
|
9
|
+
const sha256_password = require('../auth_plugins/sha256_password');
|
10
|
+
const caching_sha2_password = require('../auth_plugins/caching_sha2_password.js');
|
11
|
+
const mysql_native_password = require('../auth_plugins/mysql_native_password.js');
|
12
|
+
const mysql_clear_password = require('../auth_plugins/mysql_clear_password.js');
|
13
|
+
|
14
|
+
const standardAuthPlugins = {
|
15
|
+
sha256_password: sha256_password({}),
|
16
|
+
caching_sha2_password: caching_sha2_password({}),
|
17
|
+
mysql_native_password: mysql_native_password({}),
|
18
|
+
mysql_clear_password: mysql_clear_password({}),
|
19
|
+
};
|
20
|
+
|
21
|
+
function warnLegacyAuthSwitch() {
|
22
|
+
console.warn(
|
23
|
+
'WARNING! authSwitchHandler api is deprecated, please use new authPlugins api'
|
24
|
+
);
|
25
|
+
}
|
26
|
+
|
27
|
+
function authSwitchPluginError(error, command) {
|
28
|
+
// Authentication errors are fatal
|
29
|
+
error.code = 'AUTH_SWITCH_PLUGIN_ERROR';
|
30
|
+
error.fatal = true;
|
31
|
+
|
32
|
+
command.emit('error', error);
|
33
|
+
}
|
34
|
+
|
35
|
+
function authSwitchRequest(packet, connection, command) {
|
36
|
+
const { pluginName, pluginData } =
|
37
|
+
Packets.AuthSwitchRequest.fromPacket(packet);
|
38
|
+
let authPlugin =
|
39
|
+
connection.config.authPlugins && connection.config.authPlugins[pluginName];
|
40
|
+
|
41
|
+
// legacy plugin api don't allow to override mysql_native_password
|
42
|
+
// if pluginName is mysql_native_password it's using standard auth4.1 auth
|
43
|
+
if (
|
44
|
+
connection.config.authSwitchHandler &&
|
45
|
+
pluginName !== 'mysql_native_password'
|
46
|
+
) {
|
47
|
+
const legacySwitchHandler = connection.config.authSwitchHandler;
|
48
|
+
warnLegacyAuthSwitch();
|
49
|
+
legacySwitchHandler({ pluginName, pluginData }, (err, data) => {
|
50
|
+
if (err) {
|
51
|
+
return authSwitchPluginError(err, command);
|
52
|
+
}
|
53
|
+
connection.writePacket(new Packets.AuthSwitchResponse(data).toPacket());
|
54
|
+
});
|
55
|
+
return;
|
56
|
+
}
|
57
|
+
if (!authPlugin) {
|
58
|
+
authPlugin = standardAuthPlugins[pluginName];
|
59
|
+
}
|
60
|
+
if (!authPlugin) {
|
61
|
+
throw new Error(
|
62
|
+
`Server requests authentication using unknown plugin ${pluginName}. See ${'TODO: add plugins doco here'} on how to configure or author authentication plugins.`
|
63
|
+
);
|
64
|
+
}
|
65
|
+
connection._authPlugin = authPlugin({ connection, command });
|
66
|
+
Promise.resolve(connection._authPlugin(pluginData))
|
67
|
+
.then((data) => {
|
68
|
+
if (data) {
|
69
|
+
connection.writePacket(new Packets.AuthSwitchResponse(data).toPacket());
|
70
|
+
}
|
71
|
+
})
|
72
|
+
.catch((err) => {
|
73
|
+
authSwitchPluginError(err, command);
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
function authSwitchRequestMoreData(packet, connection, command) {
|
78
|
+
const { data } = Packets.AuthSwitchRequestMoreData.fromPacket(packet);
|
79
|
+
|
80
|
+
if (connection.config.authSwitchHandler) {
|
81
|
+
const legacySwitchHandler = connection.config.authSwitchHandler;
|
82
|
+
warnLegacyAuthSwitch();
|
83
|
+
legacySwitchHandler({ pluginData: data }, (err, data) => {
|
84
|
+
if (err) {
|
85
|
+
return authSwitchPluginError(err, command);
|
86
|
+
}
|
87
|
+
connection.writePacket(new Packets.AuthSwitchResponse(data).toPacket());
|
88
|
+
});
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
|
92
|
+
if (!connection._authPlugin) {
|
93
|
+
throw new Error(
|
94
|
+
'AuthPluginMoreData received but no auth plugin instance found'
|
95
|
+
);
|
96
|
+
}
|
97
|
+
Promise.resolve(connection._authPlugin(data))
|
98
|
+
.then((data) => {
|
99
|
+
if (data) {
|
100
|
+
connection.writePacket(new Packets.AuthSwitchResponse(data).toPacket());
|
101
|
+
}
|
102
|
+
})
|
103
|
+
.catch((err) => {
|
104
|
+
authSwitchPluginError(err, command);
|
105
|
+
});
|
106
|
+
}
|
107
|
+
|
108
|
+
module.exports = {
|
109
|
+
authSwitchRequest,
|
110
|
+
authSwitchRequestMoreData,
|
111
|
+
};
|
@@ -0,0 +1,109 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const Command = require('./command');
|
4
|
+
const Packets = require('../packets');
|
5
|
+
|
6
|
+
const eventParsers = [];
|
7
|
+
|
8
|
+
class BinlogEventHeader {
|
9
|
+
constructor(packet) {
|
10
|
+
this.timestamp = packet.readInt32();
|
11
|
+
this.eventType = packet.readInt8();
|
12
|
+
this.serverId = packet.readInt32();
|
13
|
+
this.eventSize = packet.readInt32();
|
14
|
+
this.logPos = packet.readInt32();
|
15
|
+
this.flags = packet.readInt16();
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
class BinlogDump extends Command {
|
20
|
+
constructor(opts) {
|
21
|
+
super();
|
22
|
+
// this.onResult = callback;
|
23
|
+
this.opts = opts;
|
24
|
+
}
|
25
|
+
|
26
|
+
start(packet, connection) {
|
27
|
+
const newPacket = new Packets.BinlogDump(this.opts);
|
28
|
+
connection.writePacket(newPacket.toPacket(1));
|
29
|
+
return BinlogDump.prototype.binlogData;
|
30
|
+
}
|
31
|
+
|
32
|
+
binlogData(packet) {
|
33
|
+
// ok - continue consuming events
|
34
|
+
// error - error
|
35
|
+
// eof - end of binlog
|
36
|
+
if (packet.isEOF()) {
|
37
|
+
this.emit('eof');
|
38
|
+
return null;
|
39
|
+
}
|
40
|
+
// binlog event header
|
41
|
+
packet.readInt8();
|
42
|
+
const header = new BinlogEventHeader(packet);
|
43
|
+
const EventParser = eventParsers[header.eventType];
|
44
|
+
let event;
|
45
|
+
if (EventParser) {
|
46
|
+
event = new EventParser(packet);
|
47
|
+
} else {
|
48
|
+
event = {
|
49
|
+
name: 'UNKNOWN',
|
50
|
+
};
|
51
|
+
}
|
52
|
+
event.header = header;
|
53
|
+
this.emit('event', event);
|
54
|
+
return BinlogDump.prototype.binlogData;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
class RotateEvent {
|
59
|
+
constructor(packet) {
|
60
|
+
this.pposition = packet.readInt32();
|
61
|
+
// TODO: read uint64 here
|
62
|
+
packet.readInt32(); // positionDword2
|
63
|
+
this.nextBinlog = packet.readString();
|
64
|
+
this.name = 'RotateEvent';
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
class FormatDescriptionEvent {
|
69
|
+
constructor(packet) {
|
70
|
+
this.binlogVersion = packet.readInt16();
|
71
|
+
this.serverVersion = packet.readString(50).replace(/\u0000.*/, ''); // eslint-disable-line no-control-regex
|
72
|
+
this.createTimestamp = packet.readInt32();
|
73
|
+
this.eventHeaderLength = packet.readInt8(); // should be 19
|
74
|
+
this.eventsLength = packet.readBuffer();
|
75
|
+
this.name = 'FormatDescriptionEvent';
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
class QueryEvent {
|
80
|
+
constructor(packet) {
|
81
|
+
const parseStatusVars = require('../packets/binlog_query_statusvars.js');
|
82
|
+
this.slaveProxyId = packet.readInt32();
|
83
|
+
this.executionTime = packet.readInt32();
|
84
|
+
const schemaLength = packet.readInt8();
|
85
|
+
this.errorCode = packet.readInt16();
|
86
|
+
const statusVarsLength = packet.readInt16();
|
87
|
+
const statusVars = packet.readBuffer(statusVarsLength);
|
88
|
+
this.schema = packet.readString(schemaLength);
|
89
|
+
packet.readInt8(); // should be zero
|
90
|
+
this.statusVars = parseStatusVars(statusVars);
|
91
|
+
this.query = packet.readString();
|
92
|
+
this.name = 'QueryEvent';
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
class XidEvent {
|
97
|
+
constructor(packet) {
|
98
|
+
this.binlogVersion = packet.readInt16();
|
99
|
+
this.xid = packet.readInt64();
|
100
|
+
this.name = 'XidEvent';
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
eventParsers[2] = QueryEvent;
|
105
|
+
eventParsers[4] = RotateEvent;
|
106
|
+
eventParsers[15] = FormatDescriptionEvent;
|
107
|
+
eventParsers[16] = XidEvent;
|
108
|
+
|
109
|
+
module.exports = BinlogDump;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
// This file was modified by Oracle on September 21, 2021.
|
2
|
+
// The changes involve saving additional authentication factor passwords
|
3
|
+
// in the command scope and enabling multi-factor authentication in the
|
4
|
+
// client-side when the server supports it.
|
5
|
+
// Modifications copyright (c) 2021, Oracle and/or its affiliates.
|
6
|
+
|
7
|
+
'use strict';
|
8
|
+
|
9
|
+
const Command = require('./command.js');
|
10
|
+
const Packets = require('../packets/index.js');
|
11
|
+
const ClientConstants = require('../constants/client');
|
12
|
+
const ClientHandshake = require('./client_handshake.js');
|
13
|
+
const CharsetToEncoding = require('../constants/charset_encodings.js');
|
14
|
+
|
15
|
+
class ChangeUser extends Command {
|
16
|
+
constructor(options, callback) {
|
17
|
+
super();
|
18
|
+
this.onResult = callback;
|
19
|
+
this.user = options.user;
|
20
|
+
this.password = options.password;
|
21
|
+
// "password1" is an alias of "password"
|
22
|
+
this.password1 = options.password;
|
23
|
+
this.password2 = options.password2;
|
24
|
+
this.password3 = options.password3;
|
25
|
+
this.database = options.database;
|
26
|
+
this.passwordSha1 = options.passwordSha1;
|
27
|
+
this.charsetNumber = options.charsetNumber;
|
28
|
+
this.currentConfig = options.currentConfig;
|
29
|
+
this.authenticationFactor = 0;
|
30
|
+
}
|
31
|
+
start(packet, connection) {
|
32
|
+
const newPacket = new Packets.ChangeUser({
|
33
|
+
flags: connection.config.clientFlags,
|
34
|
+
user: this.user,
|
35
|
+
database: this.database,
|
36
|
+
charsetNumber: this.charsetNumber,
|
37
|
+
password: this.password,
|
38
|
+
passwordSha1: this.passwordSha1,
|
39
|
+
authPluginData1: connection._handshakePacket.authPluginData1,
|
40
|
+
authPluginData2: connection._handshakePacket.authPluginData2,
|
41
|
+
});
|
42
|
+
this.currentConfig.user = this.user;
|
43
|
+
this.currentConfig.password = this.password;
|
44
|
+
this.currentConfig.database = this.database;
|
45
|
+
this.currentConfig.charsetNumber = this.charsetNumber;
|
46
|
+
connection.clientEncoding = CharsetToEncoding[this.charsetNumber];
|
47
|
+
// clear prepared statements cache as all statements become invalid after changeUser
|
48
|
+
connection._statements.clear();
|
49
|
+
connection.writePacket(newPacket.toPacket());
|
50
|
+
// check if the server supports multi-factor authentication
|
51
|
+
const multiFactorAuthentication =
|
52
|
+
connection.serverCapabilityFlags &
|
53
|
+
ClientConstants.MULTI_FACTOR_AUTHENTICATION;
|
54
|
+
if (multiFactorAuthentication) {
|
55
|
+
// if the server supports multi-factor authentication, we enable it in
|
56
|
+
// the client
|
57
|
+
this.authenticationFactor = 1;
|
58
|
+
}
|
59
|
+
return ChangeUser.prototype.handshakeResult;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
ChangeUser.prototype.handshakeResult =
|
64
|
+
ClientHandshake.prototype.handshakeResult;
|
65
|
+
ChangeUser.prototype.calculateNativePasswordAuthToken =
|
66
|
+
ClientHandshake.prototype.calculateNativePasswordAuthToken;
|
67
|
+
|
68
|
+
module.exports = ChangeUser;
|