CSNW / sql-bricks

Transparent, Schemaless SQL Generation
http://csnw.github.io/sql-bricks
MIT License
203 stars 25 forks source link

`noWait` generates incorrect SQL #105

Closed joelmukuthu closed 5 years ago

joelmukuthu commented 5 years ago
select('addr_id').from('person').forUpdate().of('addr_id').noWait();

generates:

SELECT addr_id FROM person FOR UPDATE OF addr_id NO WAIT

while it should generate:

SELECT addr_id FROM person FOR UPDATE OF addr_id NOWAIT

As far as I can tell, postgres, oracle and mysql all have it as NOWAIT.

prust commented 5 years ago

@joelmukuthu: Thank you for contributing this fix! I'm sorry I didn't respond sooner, I'm not sure how I didn't see this or didn't notice the notification.

FWIW, for the final 3.0 version I'll move FOR UPDATE and NOWAIT out to the postgres/mysql extension libraries (I'm not sure if anyone has made an oracle extension library yet) in order to keep the core library small and focused exclusively on SQL-92. But for now, the I'll merge the fix directly in; it's appreciated.

joelmukuthu commented 5 years ago

@prust no worries, and thank you!

joelmukuthu commented 5 years ago

@prust Can we backport this to the 2.x branch? I still have my base branch and can open a new PR targeting 2.x. Asking first since I'm not sure if that's aligns with your plans for FOR UPDATE and NOWAIT?

prust commented 5 years ago

@joelmukuthu: yes, that would be great. Sorry I thought of this & should've mentioned it.