elgris / sqrl

Fluent SQL generation for golang
MIT License
279 stars 38 forks source link

Invalid DELETE query with alias #11

Closed michael2m closed 7 years ago

michael2m commented 7 years ago

For example: DELETE a FROM A a JOIN B b ON a.c = b.c .... sqrl.Delete("s").From("A a").Join("B b ON a.c = b.c). ...

Due to delete statement builder handling in sqrl.Delete(...), if only a single element (remains after filtering) it is pushed to the From-part instead. Causing an invalid query to be generated at least for MySQL: DELETE FROM A a JOIN B b ON a.c = b.c ....

elgris commented 7 years ago

@michael2m the fix is merged. Please check how it works for you. Thanks again for your feedback!