Closed dcy closed 10 years ago
Thanks for pointing this out.
I've added it execute/3 to the mysql adapter.
It follows the same rules of substitution as the postgresql driver:
Example:
boss_db:execute("select id from game where name=$1 or othername=$2", [Name, OtherName]).
Or even better, since $1 references the first element in the list and $2 the second and so on:
boss_db:execute("select id from game where name=$1 or other_name=$1", [Name]).
However, you could just do this too, which is basically the same:
boss_db:execute("select id from game where $1 in (name, other_name)", [Name]).
-Jesse
On Wed, Jul 16, 2014 at 1:34 AM, dcy notifications@github.com wrote:
boss_db:execute(<<"SELECT id FROM game WHERE name='~p' OR other_name='~p'">>, [Name, Name]) when i excuted it, i got the follow error: [error] gen_server terminated with reason: call to undefined function boss_db_adapter_mysql:execute/3 from boss_db_controller:handle_call/3 line 198
And this is right: Sql = io_lib:format(<<"SELECT id FROM game WHERE name='~p' OR other_name='~p'">>, [Name, Name]), boss_db:execute(Sql);
— Reply to this email directly or view it on GitHub https://github.com/ChicagoBoss/boss_db/issues/187.
Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm
boss_db:execute(<<"SELECT
id
FROMgame
WHEREname
='~p' ORother_name
='~p'">>, [Name, Name]) when i excuted it, i got the follow error: [error] gen_server <0.101.0> terminated with reason: call to undefined function boss_db_adapter_mysql:execute/3 from boss_db_controller:handle_call/3 line 198And this is right: Sql = io_lib:format(<<"SELECT
id
FROMgame
WHEREname
='~p' ORother_name
='~p'">>, [Name, Name]), boss_db:execute(Sql);