Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Stored procedures 如何:使用Elixir中的Tds库调用存储过程_Stored Procedures_Elixir_Tds - Fatal编程技术网

Stored procedures 如何:使用Elixir中的Tds库调用存储过程

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

尝试使用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: %{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层并执行您尝试执行的操作的情况。有关更多详细信息,请参见此问题()。