Skip to content

Loading…

wrong query building when changed orders of chains #53

Open
tugrul opened this Issue · 1 comment

2 participants

@tugrul
var query = dbConn.query();
query.from('tablename');
query.where('`field3` = ?', [5]);
query.select(['field1','field2']);
console.log(query.sql());

Actual Result:

 FROM `tablename` WHERE field3 = 5SELECT `field1`,`field2`

Targetted Result:

SELECT `field1`,`field2` FROM `tablename` WHERE field3 = 5
@talentedmrjones

I'm seeing this same behavior for joins. If I call join() after having already called where() it wrongly places the join after the where clause. Based on this I presume the code is building the statement as it goes rather than queuing clauses to be built in the proper order later (when calling .sql or .execute)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.