Stored procedures 如何:使用Elixir中的Tds库调用存储过程
尝试使用Elixir库调用存储过程时出现以下错误 存储过程Stored procedures 如何:使用Elixir中的Tds库调用存储过程,stored-procedures,elixir,tds,Stored Procedures,Elixir,Tds,尝试使用Elixir库调用存储过程时出现以下错误 存储过程get\u account存在并且只有一个参数@id iex(5)>Tds.Connection.query(pid, "get_account",[%Tds.Parameter{name: "@id", value: 1}]) {:error, %Tds.Error{message: nil, mssql: %{c
get\u account
存在并且只有一个参数@id
iex(5)>Tds.Connection.query(pid, "get_account",[%Tds.Parameter{name: "@id", value: 1}])
{:error,
%Tds.Error{message: nil,
mssql: %{class: 16, length: 252, line_number: 0, msg_text: "Procedure or function 'get_account' expects parameter '@id', which was not supplied.", number: 201, proc_name: "get_account",
server_name: "localhost\\SQLEXPRESS", state: 4}}}
iex(6)>
尝试使用Tds.proc(pid,“获取帐户”[1])
也不起作用
Tds.query(pid, "get_account 1",[])
使用此选项的方式与使用EXEC
将参数直接传递到存储过程的方式相同
更新:
这种格式也适用于:
params = [
%Tds.Parameter{name: "@1", value: 100, type: :integer},
%Tds.Parameter{name: "@2", value: 100, type: :integer},
%Tds.Parameter{name: "@3", value: <<0 ,0 ,0 ,0>>, type: :binary},
]
Conn.query(s.db, "save_auth_key @1, @2, @3", params)
params=[
%Tds.参数{名称:“@1”,值:100,类型::整数},
%Tds.参数{名称:“@2”,值:100,类型::整数},
%Tds.参数{name:@3',value:,type::binary},
]
Conn.query(s.db,“保存认证密钥@1、@2、@3”,参数)
这可能是一种更容易下拉到Erlang ODBC层并执行您尝试执行的操作的情况。有关更多详细信息,请参见此问题()。