Connection: IDalConnection;
The Connection property returns a reference on the IDalConnection interface that controls the current database connection.
Sub Main;
Var
MB: IMetabase;
DB: IDatabaseInstance;
Com: IDalCommand;
Conn: IDalConnection;
Proc: IDalProcedures;
ParamInfo, ValueParam: IArrayList;
i: Integer;
ProcFields: IDalCursorFields;
ProcField: IDalCursorField;
Begin
MB := MetabaseClass.Active;
DB := MB.ItemById("BD").Open(Null) As IDatabaseInstance;
Com := DB.Connection.CreateCommand("");
Conn := Com.Connection;
Proc := Conn.Procedures("Proc_1");
ParamInfo := New ArrayList.Create;
ValueParam := New ArrayList.Create;
ProcFields := Proc.Fields;
While Not Proc.Eof Do
For i := 0 To ProcFields.Count - 1 Do
ProcField := ProcFields.Item(i);
ParamInfo.Add(ProcField.Name);
ValueParam.Add(ProcField.Value);
End For;
Proc.Next;
End While;
Conn.Close;
Com.Close;
For i := 0 To ParamInfo.Count - 1 Do
Debug.Write(ParamInfo.Item(i));
Debug.Write(" = ");
Debug.WriteLine(ValueParam.Item(i));
End For;
End Sub Main;
The connection to the BD database is established after executing this example. A cursor that contains information about the Proc_1 procedure is obtained on the base of this connection, then this information is read into the ParamInfo and ValueParam arrays. This information is displayed in the development environment console.
See also: