Publish date: 2003-06-20
Stored procedure. ODBC call. Obtaining of row set (WSF:VBS)
| Download the example archive |
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
' stored procedute text
' create procedure sp_exec_2 (arg_int integer,
' arg_date date,
' arg_str varchar(32))
' returns (out_int_1 integer,
' out_int_2 integer,
' out_date date,
' out_str varchar(32))
' as
' begin
' out_int_1=-arg_int;
' out_int_2=2*arg_int;
'
' out_date =arg_date+1;
'
' out_str =upper(arg_str);
'
' suspend;
' end
'
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
call sample_odbc_open_sp()
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sub sample_odbc_open_sp()
p_echo "************************************************************"
p_echo "* execute odbc-query '{?=call sp(...)}' as 'select * from' *"
p_echo "************************************************************"
set cn = wscript.createobject("adodb.connection")
call cn.open("file name=ibp_test.ibp")
call print_connection_info(cn)
set cmd=wscript.createobject("adodb.command")
cmd.activeconnection=cn
'enable odbc query
cmd.properties("support_odbc_query")=true
'execute odbc-query "{call sp}" as "select * from sp"
cmd.properties("odbc_call_sp")=0
p_echo "---------------------------------------------------------"
call cmd_set_text(cmd,"{:ret=call sp_exec_2(:in1,:in2,:in3)}")
cmd.parameters.refresh
cmd("in1")=11
cmd("in2")=cdate("01.01.2003")
cmd("in3")="querty"
set rs=cmd_execute(cmd)
p_echo "prepare stmt:"&cmd.properties("prepare stmt")
call print_recordset(rs)
p_echo "---------------------------------------------------------"
call cmd_set_text(cmd,"{:ret=call sp_exec_2(,:in2)}")
cmd.parameters.refresh
cmd("in2")=cdate("01.01.2003")
set rs=cmd_execute(cmd)
p_echo "prepare stmt:"&cmd.properties("prepare stmt")
call print_recordset(rs)
end sub 'sample_odbc_open_sp
| Download the example archive |
Output.
