Trying to pass data into driver

This commit is contained in:
Max Lapshin
2009-10-13 10:56:15 +04:00
parent 9a3aea50a7
commit 89d9d0b17d
4 changed files with 45 additions and 59 deletions

View File

@@ -452,6 +452,19 @@ code_change(_OldVsn, State, _Extra) ->
create_cmd(Dbase) ->
"sqlite3_port " ++ Dbase.
exec(Port, {sql_exec, Cmd}) ->
port_command(Port, <<2, (list_to_binary(Cmd))/binary>>),
receive
{Port, {data, Data}} when is_binary(Data) ->
List = binary_to_term(Data),
if is_list(List) ->
lists:reverse(List);
true -> List
end;
_ ->
ok
end;
exec(Port, Cmd) ->
port_command(Port, term_to_binary(Cmd)),
receive