Archive for January, 2009
Nika Raincoat Shark
Posted by jake | Filed under Nika Land Shark
Erlang MySQL Stored Procedure Support
Posted by jake | Filed under Programming Ducks
github.com/JacobVorreuter/erlang_mysql
If you’re getting the following exception trying to call a stored procedure or prepared statement with the Erlang MySQL library you must apply this patch to mysql_auth.erl inorder to add multi-results and multi-statements to the caps list:
{error,{mysql_result,[],[],0,<<"#0A000PROCEDURE
dbname.procname can't return a result set in the given context">>}}
@@ -27,6 +27,8 @@
-define(LONG_PASSWORD, 1).
-define(LONG_FLAG, 4).
-define(PROTOCOL_41, 512).
+-define(CLIENT_MULTI_STATEMENTS, 65536).
+-define(CLIENT_MULTI_RESULTS, 131072).
-define(TRANSACTIONS, 8192).
-define(SECURE_CONNECTION, 32768).
-define(CONNECT_WITH_DB, 8).
@@ -121,7 +123,8 @@ make_new_auth(User, Password, Database) ->
?CONNECT_WITH_DB
end,
Caps = ?LONG_PASSWORD bor ?LONG_FLAG bor ?TRANSACTIONS bor
- ?PROTOCOL_41 bor ?SECURE_CONNECTION bor DBCaps,
+ ?PROTOCOL_41 bor ?SECURE_CONNECTION bor
+ ?CLIENT_MULTI_STATEMENTS bor ?CLIENT_MULTI_RESULTS bor DBCaps,
Maxsize = ?MAX_PACKET_SIZE,
UserB = list_to_binary(User),
PasswordL = size(Password),
Erlang Documentation Shell Command
Posted by jake | Filed under Programming Ducks
I spend a lot of time looking things up in the man pages on erlang.org. Here’s how to setup a nice shortcut if you’re a mac user:
$> echo -e '#!/bin/sh\nopen http://erlang.org/doc/man/$1.html\n' > erld
$> chmod +x erld
$> sudo mv erld /usr/local/bin/
Now you can do:
$> erld lists
This runs “open http://erlang.org/doc/man/lists.html”
Enjoy!
