responses #8

Merged
jusax23 merged 3 commits from dev into main 2023-02-22 11:17:26 +01:00
2 changed files with 11 additions and 11 deletions
Showing only changes of commit 155e702863 - Show all commits

View file

@ -29,8 +29,8 @@ export class DB {
this.name = database; this.name = database;
} }
async query(query: Query) { async query(query: Query, printQuery = false) {
console.log(query); if(printQuery)console.log(query);
if (this.type == dbType.mariadb) return await this.mariaPool.query(query); if (this.type == dbType.mariadb) return await this.mariaPool.query(query);
/*else if (this.type == dbType.postgres) { /*else if (this.type == dbType.postgres) {
let res = await this.pgPool.query(query.sql, query.values); let res = await this.pgPool.query(query.sql, query.values);

View file

@ -96,11 +96,11 @@ export class selectQuery {
return handler.querys.select(handler, this); return handler.querys.select(handler, this);
} }
async query(db: DB) { async query(db: DB, printQuery = false) {
const handler = db.getHandler(); const handler = db.getHandler();
const builder = this.serialize(handler); const builder = this.serialize(handler);
const s = handler.builders.query(builder); const s = handler.builders.query(builder);
let readResp = await db.query(s); let readResp = await db.query(s, printQuery);
return db.getHandler().responses.readResponse(readResp); return db.getHandler().responses.readResponse(readResp);
} }
} }
@ -134,11 +134,11 @@ export class insertQuery {
serialize(handler: Handler): QueryBuilder { serialize(handler: Handler): QueryBuilder {
return handler.querys.insert(handler, this); return handler.querys.insert(handler, this);
} }
async query(db: DB) { async query(db: DB, printQuery = false) {
const handler = db.getHandler(); const handler = db.getHandler();
const builder = this.serialize(handler); const builder = this.serialize(handler);
const s = handler.builders.query(builder); const s = handler.builders.query(builder);
let readResp = await db.query(s); let readResp = await db.query(s, printQuery);
return db.getHandler().responses.insertResponse(readResp); return db.getHandler().responses.insertResponse(readResp);
} }
} }
@ -163,11 +163,11 @@ export class updateQuery {
serialize(handler: Handler): QueryBuilder { serialize(handler: Handler): QueryBuilder {
return handler.querys.update(handler, this); return handler.querys.update(handler, this);
} }
async query(db: DB) { async query(db: DB, printQuery = false) {
const handler = db.getHandler(); const handler = db.getHandler();
const builder = this.serialize(handler); const builder = this.serialize(handler);
const s = handler.builders.query(builder); const s = handler.builders.query(builder);
let readResp = await db.query(s); let readResp = await db.query(s, printQuery);
return db.getHandler().responses.writeResponse(readResp); return db.getHandler().responses.writeResponse(readResp);
} }
} }
@ -185,11 +185,11 @@ export class removeQuery {
serialize(handler: Handler): QueryBuilder { serialize(handler: Handler): QueryBuilder {
return handler.querys.remove(handler, this); return handler.querys.remove(handler, this);
} }
async query(db: DB) { async query(db: DB, printQuery = false) {
const handler = db.getHandler(); const handler = db.getHandler();
const builder = this.serialize(handler); const builder = this.serialize(handler);
const s = handler.builders.query(builder); const s = handler.builders.query(builder);
let readResp = await db.query(s); let readResp = await db.query(s, printQuery);
return db.getHandler().responses.writeResponse(readResp); return db.getHandler().responses.writeResponse(readResp);
} }
} }