Open nelsonic opened 7 years ago
You probably figured it out long time ago, but you have an extra comma after "SELECT".
Another note is that you need to use "SELECT" to retrieve the result.
Lastly, the result is not "1024", but rather, %{rows: [{1024}], num_rows: 1}
. Your code will need to convert to desired format.
as @sntran said SELECT, power($1, $2)
is invalid sql, removing the first comma fixes the problem
On page 119 of Programming Phoenix there's an example for how to write a "direct" SQL query:
This does not
SELECT
any data from the database it (is meant to) merely calculate2^10
whichshould return 1024
... instead we see:It's not a DB/connection error because other queries work! e.g:
So... I'm left scratching my head as to how to run an SQL query using Ecto ... has anyone
else
attempted to do this?