balderdashy / sails

Realtime MVC Framework for Node.js
https://sailsjs.com
MIT License
22.84k stars 1.95k forks source link

Model.getDatastore().sendNativeQuery() return ?column? in rows #7270

Open JACA26 opened 1 year ago

JACA26 commented 1 year ago

Node version: 16.17.0 Sails version (sails): 1.5.0 ORM hook version (sails-hook-orm): 4.0.0 Sockets hook version (sails-hook-sockets): 2.0.0 DB adapter & version (e.g. sails-mysql@5.55.5): sails-postgresql@4.0.0 Skipper adapter & version (e.g. skipper-s3@5.55.5): skipper@0.9.1


I've been trying get a SQL consult with sendNativeQuery when i select some columns:

let queryConditions =SELECT $1 FROM notificacion WHERE UNACCENT(LOWER(titulo)) LIKE UNACCENT(LOWER($2)) OR UNACCENT(LOWER(campana)) LIKE UNACCENT(LOWER($3))`;

let placeholderValues = ['titulo, campana, personasEnvio, fechaEnvio, id, toAll, tipo',%${text}%, %${text}%]; `

the result is:

rows_error

but when my query condition is SELECT * FROM .... the result is correct with rows

what is the correct way for select some columns?

sailsbot commented 1 year ago

@JACA26 Thanks for posting! We'll take a look as soon as possible.

In the mean time, there are a few ways you can help speed things along:

Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.

For help with questions about Sails, click here.

eashaw commented 1 year ago

Hi @JACA26, would you be able to share more of the code where you're using .sendNativeQuery()?