@@ -10,23 +10,24 @@ export async function createConnectionPool() {
10
10
const config = getConnectionOptions ( ) ;
11
11
12
12
try {
13
- pool = createPool ( config ) ;
13
+ const dbPool = createPool ( config ) ;
14
14
15
- pool . on ( 'connection' , ( connection ) => {
15
+ dbPool . on ( 'connection' , ( connection ) => {
16
16
connection . query ( mysql_transaction_isolation_level ) ;
17
17
} ) ;
18
18
19
19
using conn = await getConnection ( ) ;
20
-
21
- const result = await conn . query ( 'SELECT VERSION() as version' ) as RowDataPacket [ ] ;
20
+
21
+ const result = ( await conn . query ( 'SELECT VERSION() as version' ) ) as RowDataPacket [ ] ;
22
22
dbVersion = `^5[${ result [ 0 ] . version } ]` ;
23
23
24
24
console . log ( `${ dbVersion } ^2Database server connection established!^0` ) ;
25
25
26
26
if ( config . multipleStatements ) {
27
- console . warn ( `multipleStatements is enabled. Used incorrectly, this option may cause SQL injection.` )
27
+ console . warn ( `multipleStatements is enabled. Used incorrectly, this option may cause SQL injection.` ) ;
28
28
}
29
-
29
+
30
+ pool = dbPool ;
30
31
} catch ( err : any ) {
31
32
const message = err . message . includes ( 'auth_gssapi_client' )
32
33
? `Requested authentication using unknown plugin auth_gssapi_client.`
@@ -38,7 +39,7 @@ export async function createConnectionPool() {
38
39
} : ${ message } ^0`
39
40
) ;
40
41
41
- console . log ( `See https://github.com/overextended/oxmysql/issues/154 for more information.` )
42
+ console . log ( `See https://github.com/overextended/oxmysql/issues/154 for more information.` ) ;
42
43
43
44
if ( config . password ) config . password = '******' ;
44
45
0 commit comments