CodePudding user response:
public function integer uf_selectinto (string as_sql, ref any a_parm [], the transaction ltrans_1); String Stringvar, Sqlstatement
The integer I, Intvar, li_NumOutputs
Long LongVar
Sqlstatement=as_sql
PREPARE SQLSA FROM: Sqlstatement using ltrans_1;
If ltrans_1. Sqlcode=1 then goto e
The DESCRIBE SQLSA INTO SQLDA;
If ltrans_1. Sqlcode=1 then goto e
DECLARE my_cursor DYNAMIC CURSOR FOR SQLSA;
If ltrans_1. Sqlcode=1 then goto e
The OPEN DYNAMIC my_cursor USING DESCRIPTOR SQLDA;
If ltrans_1. Sqlcode=1 then goto e
The FETCH my_cursor USING DESCRIPTOR SQLDA;
If ltrans_1. Sqlcode=1 then goto e
Li_NumOutputs=SQLDA. NumOutputs
For I=1 to li_NumOutputs
CHOOSE a CASE SQLDA. OutParmType [I]
CASE TypeString!
Stringvar=GetDynamicString (SQLDA, I)
A_parm [I]=Stringvar
CASE TypeInteger! , TypeLong! , TypeByte! , TypeUInt! , TypeUInt! , TypeULong!
Intvar=GetDynamicNumber (SQLDA, I)
A_parm [I]=Intvar
CASE TypeLongLong! , TypeDecimal! , TypeReal! , TypeDouble!
Longvar=GetDynamicDecimal (SQLDA, I)
A_parm [I]=Longvar
Case Typedate!
A_parm [I]=GetDynamicDate (SQLDA, I)
Case typedatetime!
A_parm [I]=GetDynamicDateTime (SQLDA, I)
Case typetime!
A_parm [I]=GetDynamicTime (SQLDA, I)
The END CHOOSE
Next
The CLOSE my_cursor;
If ltrans_1. Sqlcode=1 then goto e
Return li_NumOutputs
E:
The return - 1
End the function
CodePudding user response:
//callAny la_parm []
If uf_selectinto (' select 1, 2, ref la_parm [], the sqlca)=1 then
Messagebox (' ', the sqlca. Sqlerrtext)
The else
Messagebox (' ', la_parm [1])
End the if