From 871c4d6be70d79e124b8e7d73259fd038d639cee Mon Sep 17 00:00:00 2001 From: jusax23 Date: Sat, 25 Feb 2023 19:02:48 +0100 Subject: [PATCH] port --- src/db.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/db.ts b/src/db.ts index 47935fd..fb07ef7 100644 --- a/src/db.ts +++ b/src/db.ts @@ -15,10 +15,10 @@ export class DB { type: dbType; mariaPool!: mariadb.Pool; //pgPool!: pg.Pool; - constructor({ host, user, password, database, connectionLimit = 5, databaseType = dbType.mariadb }: { host: string, user: string, password: string, database: string, connectionLimit?: number, databaseType?: dbType }) { + constructor({ host, user, password, database, port = 3306, connectionLimit = 5, databaseType = dbType.mariadb }: { host: string, user: string, password: string, database: string, port?: number, connectionLimit?: number, databaseType?: dbType }) { this.type = databaseType; if (databaseType == dbType.mariadb) { - this.mariaPool = mariadb.createPool({ host, user, password, database, connectionLimit, multipleStatements: true }); + this.mariaPool = mariadb.createPool({ host, user, password, port, database, connectionLimit, multipleStatements: true }); this.handler = new Handler(this); } /*else if (databaseType == dbType.postgres) { @@ -30,7 +30,7 @@ export class DB { this.name = database; } async query(query: Query, printQuery = false) { - if(printQuery)console.log(query); + if (printQuery) console.log(query); if (this.type == dbType.mariadb) return await this.mariaPool.query(query); /*else if (this.type == dbType.postgres) { let res = await this.pgPool.query(query.sql, query.values); @@ -115,8 +115,8 @@ export class Attribute { toStringFunc(handler: Handler) { return this.table.serialize(handler) + "(" + this.serialize(handler) + ")"; } - toString(){ - return this.table.dbLangTableName + "_" + this.name; + toString() { + return this.table.dbLangTableName + "_" + this.name; } }