gg-mysql-connector 1.0.114 → 1.0.115

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.
@@ -219,15 +219,15 @@ class GGMySQLConnector {
219
219
  return result;
220
220
  }
221
221
  async init() {
222
- const currentConnection = mysql2_1.default.createPool({
222
+ const tempConnection = mysql2_1.default.createPool({
223
223
  host: this.DBInfo.host,
224
224
  user: this.DBInfo.user,
225
225
  password: this.DBInfo.password,
226
226
  });
227
+ await this.createDatabaseIfNotExist(tempConnection);
228
+ await tempConnection.end();
229
+ this.connection = mysql2_1.default.createPool(Object.assign(Object.assign({}, this.DBInfo), { waitForConnections: true, connectionLimit: 10 }));
227
230
  this.isConnected = true;
228
- await this.createDatabaseIfNotExist(currentConnection);
229
- // await currentConnection.end()
230
- this.connection = mysql2_1.default.createPool(Object.assign({}, this.DBInfo));
231
231
  // await this.query("SET global sql_mode=''")
232
232
  // await this.query("SET global query_cache_type='ON'")
233
233
  // await this.query("SET global query_cache_size=16777216")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg-mysql-connector",
3
- "version": "1.0.114",
3
+ "version": "1.0.115",
4
4
  "description": "",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {
@@ -377,16 +377,21 @@ export default class GGMySQLConnector<Main> implements ClassDBInterface<Main> {
377
377
  }
378
378
 
379
379
  async init() {
380
- const currentConnection = mysql.createPool({
380
+ const tempConnection = mysql.createPool({
381
381
  host: this.DBInfo.host,
382
382
  user: this.DBInfo.user,
383
383
  password: this.DBInfo.password,
384
384
  })
385
+ await this.createDatabaseIfNotExist(tempConnection)
386
+ await tempConnection.end()
387
+
388
+ this.connection = mysql.createPool({
389
+ ...this.DBInfo,
390
+ waitForConnections: true,
391
+ connectionLimit: 10,
392
+ })
385
393
  this.isConnected = true
386
- await this.createDatabaseIfNotExist(currentConnection)
387
- // await currentConnection.end()
388
394
 
389
- this.connection = mysql.createPool({ ...this.DBInfo })
390
395
  // await this.query("SET global sql_mode=''")
391
396
  // await this.query("SET global query_cache_type='ON'")
392
397
  // await this.query("SET global query_cache_size=16777216")