sqlingvo
sqlingvo copied to clipboard
How do I pass arguments to SQL functions?
I want to pass the value of a var to my SQL function.
(sql/sql (sql/select db [:*] (sql/from `(:my-func ~arg))))
But I get an error:
ExceptionInfo Can't parse FROM form. clojure.core/ex-info (core.clj:4739)
However I'm able to pass string arguments:
=> (sql/sql (sql/select db [:*] (sql/from '(:my-func "abc"))))
["SELECT * FROM \"my_func\"(?)" "abc"]
I want to pass the value of arg
instead of plain string. How do I do that?
It might be that a function in the from clause is not yet supported. I am AWFK at the moment. PR welcome!
On Tue, Jun 26, 2018, 16:03 Avinash Sultanpur [email protected] wrote:
I want to pass the value of a var to my SQL function.
(sql/sql (sql/select db [:*] (sql/from `(:my-func ~arg))))
But I get an error:
ExceptionInfo Can't parse FROM form. clojure.core/ex-info (core.clj:4739)
However I'm able to pass string arguments:
=> (sql/sql (sql/select db [:*] (sql/from '(:my-func "abc")))) ["SELECT * FROM "my_func"(?)" "abc"]
I want to pass the value of arg instead of plain string. How do I do that?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/r0man/sqlingvo/issues/113, or mute the thread https://github.com/notifications/unsubscribe-auth/AABUPs_AzMy45OkxMKtEodjkxjpy6hhnks5uAj9JgaJpZM4U4Aig .