Skip to content

Commit

Permalink
fix:beforeStart error
Browse files Browse the repository at this point in the history
  • Loading branch information
cuyl committed Jul 1, 2017
1 parent 9a3f133 commit 301ed70
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function createOneClient(config, app) {
let client = new OracleDB(config, app.coreLogger);
app.beforeStart(async () => {
// connection init
const con = await client.init();
const { rows } = await con.execute("select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss') from dual", []);
await client.init();
const { rows } = await client.execute("select to_char(sysdate,'yyyy-MM-dd HH24:mi:ss') from dual", []);
const index = count++;
app.coreLogger.info(`[egg-oracle] instance[${index}] status OK, currentTime: ${rows[0][0]}`);
});
Expand Down
2 changes: 1 addition & 1 deletion lib/oracle.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class OracleDB {
* @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.
*/
async execute(sql, bindParams = {}, options = {}) {
const connection = this.connection || this._getConnection();
const connection = this.connection || await this._getConnection();
if (typeof sql === 'string' && bindParams instanceof Object) {
try {
const result = await connection.execute(sql, bindParams, options);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "egg-oracle",
"version": "1.0.6",
"version": "1.0.7",
"description": "Oracle database plugin for egg",
"eggPlugin": {
"name": "oracle"
Expand Down

0 comments on commit 301ed70

Please sign in to comment.