responses #8
2 changed files with 11 additions and 11 deletions
|
@ -29,8 +29,8 @@ export class DB {
|
|||
|
||||
this.name = database;
|
||||
}
|
||||
async query(query: Query) {
|
||||
console.log(query);
|
||||
async query(query: Query, printQuery = false) {
|
||||
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);
|
||||
|
|
18
src/query.ts
18
src/query.ts
|
@ -49,7 +49,7 @@ export class QueryBuilder {
|
|||
this.list.push(...qb.list);
|
||||
}
|
||||
appendEnding(qb: QueryBuilder) {
|
||||
if(qb.isEmpty()) return;
|
||||
if (qb.isEmpty()) return;
|
||||
this.append(qb);
|
||||
this.list.push([false, ";"]);
|
||||
}
|
||||
|
@ -96,11 +96,11 @@ export class selectQuery {
|
|||
return handler.querys.select(handler, this);
|
||||
}
|
||||
|
||||
async query(db: DB) {
|
||||
async query(db: DB, printQuery = false) {
|
||||
const handler = db.getHandler();
|
||||
const builder = this.serialize(handler);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -134,11 +134,11 @@ export class insertQuery {
|
|||
serialize(handler: Handler): QueryBuilder {
|
||||
return handler.querys.insert(handler, this);
|
||||
}
|
||||
async query(db: DB) {
|
||||
async query(db: DB, printQuery = false) {
|
||||
const handler = db.getHandler();
|
||||
const builder = this.serialize(handler);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -163,11 +163,11 @@ export class updateQuery {
|
|||
serialize(handler: Handler): QueryBuilder {
|
||||
return handler.querys.update(handler, this);
|
||||
}
|
||||
async query(db: DB) {
|
||||
async query(db: DB, printQuery = false) {
|
||||
const handler = db.getHandler();
|
||||
const builder = this.serialize(handler);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -185,11 +185,11 @@ export class removeQuery {
|
|||
serialize(handler: Handler): QueryBuilder {
|
||||
return handler.querys.remove(handler, this);
|
||||
}
|
||||
async query(db: DB) {
|
||||
async query(db: DB, printQuery = false) {
|
||||
const handler = db.getHandler();
|
||||
const builder = this.serialize(handler);
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue