Skip to content

Commit 301ed70

Browse files
committed
fix:beforeStart error
1 parent 9a3f133 commit 301ed70

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/loader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ function createOneClient(config, app) {
1616
let client = new OracleDB(config, app.coreLogger);
1717
app.beforeStart(async () => {
1818
// connection init
19-
const con = await client.init();
20-
const { rows } = await con.execute("select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss') from dual", []);
19+
await client.init();
20+
const { rows } = await client.execute("select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss') from dual", []);
2121
const index = count++;
2222
app.coreLogger.info(`[egg-oracle] instance[${index}] status OK, currentTime: ${rows[0][0]}`);
2323
});

lib/oracle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class OracleDB {
5656
* @return {ResultObject} result object, containing any fetched rows, the values of any OUT and IN OUT bind variables, and the number of rows affected by the execution of DML statements.
5757
*/
5858
async execute(sql, bindParams = {}, options = {}) {
59-
const connection = this.connection || this._getConnection();
59+
const connection = this.connection || await this._getConnection();
6060
if (typeof sql === 'string' && bindParams instanceof Object) {
6161
try {
6262
const result = await connection.execute(sql, bindParams, options);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egg-oracle",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "Oracle database plugin for egg",
55
"eggPlugin": {
66
"name": "oracle"

0 commit comments

Comments
 (0)