Aliases #3
2 changed files with 16 additions and 7 deletions
|
@ -236,11 +236,11 @@ export class Handler {
|
||||||
builder.addCode("select ");
|
builder.addCode("select ");
|
||||||
builder.append(joinArg(", ")(handler, q.attr));
|
builder.append(joinArg(", ")(handler, q.attr));
|
||||||
builder.addCode(` from `);
|
builder.addCode(` from `);
|
||||||
if(q.from == null){
|
if (q.from == null) {
|
||||||
builder.addCode(" DUAL");
|
builder.addCode(" DUAL");
|
||||||
}else if (q.from instanceof Table){
|
} else if (q.from instanceof Table) {
|
||||||
builder.addCode(q.from.serialize(handler));
|
builder.addCode(q.from.serialize(handler));
|
||||||
}else{
|
} else {
|
||||||
builder.append(q.from.serialize(handler));
|
builder.append(q.from.serialize(handler));
|
||||||
}
|
}
|
||||||
if (q.whereD) {
|
if (q.whereD) {
|
||||||
|
@ -255,9 +255,16 @@ export class Handler {
|
||||||
builder.append(q.havingD.serialize(handler));
|
builder.append(q.havingD.serialize(handler));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (q.havingD) {
|
if (q.limitD != null) {
|
||||||
builder.addCode(" limit ");
|
if (q.limitOffsetD == null) {
|
||||||
builder.addInjection(q.limitD);
|
builder.addCode(" limit ");
|
||||||
|
builder.addInjection(q.limitD);
|
||||||
|
} else {
|
||||||
|
builder.addCode(" limit ");
|
||||||
|
builder.addInjection(q.limitOffsetD);
|
||||||
|
builder.addCode(", ");
|
||||||
|
builder.addInjection(q.limitD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*builder.setHandler((json)=>{
|
/*builder.setHandler((json)=>{
|
||||||
|
|
|
@ -83,8 +83,10 @@ export class selectQuery {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
limitD: number | null = null;
|
limitD: number | null = null;
|
||||||
limit(i: number) {
|
limitOffsetD: number | null = null;
|
||||||
|
limit(i: number, offset: number = 0) {
|
||||||
this.limitD = i;
|
this.limitD = i;
|
||||||
|
this.limitOffsetD = offset;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue