wrong query building when changed orders of chains #53

Open
tugrul opened this Issue Jan 25, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@tugrul

tugrul commented Jan 25, 2012

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

This comment has been minimized.

Show comment
Hide comment
@talentedmrjones

talentedmrjones Mar 5, 2012

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)

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