You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a few custom queries in my models and I would like to use the function you use for escaping strings to me inserted. Is there a way to call it to sanitize my inputs?
This would be a really nice feature! My app is pretty complex and there are quite a few queries I can't really do with the ORM directly, so I create Model and Instance methods and put my queries there. This keeps the app structure intact (MVC).
Being able to escape my queries directly there would be very nice and more in line with my app structure.
/var/www/project/node_modules/orm/lib/Drivers/DML/postgres.js:86
cb(err);
^
TypeError: object is not a function
at null.callback (/var/www/project/node_modules/orm/lib/Drivers/DML/postgres.js:86:6)
at Query.handleError (/var/www/project/node_modules/pg/lib/query.js:93:10)
at null.<anonymous> (/var/www/project/node_modules/pg/lib/client.js:178:19)
at EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (/var/www/project/node_modules/pg/lib/connection.js:89:12)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:736:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
Is there something I didn't do correctly? I followed the docs but I might still have done some error...
Activity
dxg commentedon Aug 19, 2013
For partial queries:
For complete queries it's less nice:
We could provide something nicer like:
Thoughts?
I'm also wondering if there are implications of overloading
execQuery
but I think it should be fine.dresende commentedon Aug 20, 2013
Yes, it should be fine, if backwards compliant this could be nice. Maybe then
Model.find().where()
could use it directly.SamuelBolduc commentedon Aug 20, 2013
This would be a really nice feature! My app is pretty complex and there are quite a few queries I can't really do with the ORM directly, so I create Model and Instance methods and put my queries there. This keeps the app structure intact (MVC).
Being able to escape my queries directly there would be very nice and more in line with my app structure.
dxg commentedon Aug 20, 2013
I'll work on this
Enable auto-escaping raw queries #304
SamuelBolduc commentedon Aug 21, 2013
Many thanks for this!! It will save me a lot of time and uselessly long code!
SamuelBolduc commentedon Aug 22, 2013
I didn't try it until today, and here is what I get with the latest git version :
And here is the SQL I see in the debug console :
Followed by this error:
Is there something I didn't do correctly? I followed the docs but I might still have done some error...
dxg commentedon Aug 22, 2013
Did you run
npm install
? You need sql-query version 0.1.11SamuelBolduc commentedon Aug 23, 2013
Here is the result of
npm install
in the orm directory (sincenpm-install
in my project directory did nothing) :But I still have the same issue as in my last post
5 remaining items