salk31 / RedQueryBuilder

SQL Query Builder UI JavaScript component
http://redquerybuilder.appspot.com/
Eclipse Public License 1.0
96 stars 22 forks source link

Get arguments with their type information #37

Closed scottbw closed 9 years ago

scottbw commented 9 years ago

I'm using RedQueryBuilder with a Postgres backend. Postgres is strongly typed, so when I get a query built with RQB, I'm having to make a guess on the backend as to whether each param was a boolean, integer, varchar (etc) before pushing that into a PreparedStatement to process.

Can the onSqlChange arguments include not just the argument string value, but also the type?

salk31 commented 9 years ago

Is the JavaScript object type not a correct match? https://github.com/salk31/RedQueryBuilder/blob/master/redquerybuilder-js/src/main/webapp/simple.js#L82 coerces the values to strings.

I've tended to use the SQL friendly values out of there and then implicit casting on other databases but I have to admit I've not tried it on Postgres. I can't find the related docs. Does '1' not implicit cast to 1 etc? I see they have banned the other direction.

scottbw commented 9 years ago

I'll give it a go with casting using the JS values and see how far I can get - strong typing in Postgres 8 really is a pain. All the implicit casts seem to have been removed from default installations.

salk31 commented 9 years ago

Did it work OK? ie Can I close this?

scottbw commented 9 years ago

I think we can close this now - thanks!