IRepositoryScriptManager.LoadScript

Syntax

LoadScript(Stream: IIOStream);

Parameters

Stream. The stream containing a script used for repository creating and updating. Contents of the current.rm4, or current_rds.rm4 files should be loaded into this stream to work with the repository.

Description

The LoadScript method loads a script used to perform the specified operation with the repository.

Comments

Depending on the repository type set in the Repository property, contents of the different files should be loaded in the stream:

Example #1

Executing the example requires the ORCL server named Test. The "TestSchema" scheme is created on the server. The root of disk C contains the current.rm4 file that includes the script for repository creating.

Sub Main;

Var

Rsm: IRepositoryScriptManager;

Driv: IDalDriver;

ConDesc: IDalConnectionDescriptor;

Params: IDalConnectionDescriptorParams;

Con: IDalConnection;

Begin

//Connection to the scheme on the ORCL8 server

Driv := New DalOrcl8Driver.Create As IDalDriver;

ConDesc := Driv.CreateDescriptor;

Params := ConDesc.Params;

Params.Find("User Name").Value := "TestSchema";

Params.Find("Password").Value := "TestSchema";

Params.Find("Host BSTR").Value := "Test";

Params.Find("Scheme").Value := "TestSchema";

Con := ConDesc.CreateConnection;

//Settings of the repository manager

Rsm := New RepositoryScriptManager.Create;

Rsm.Connection := Con;

Rsm.Driver := RepositoryDriverType.ORCL8;

Rsm.Operation := RepositoryOperationType.Create;

Rsm.Repository := RepositoryType.Metabase;

Rsm.LoadScript(New FileStream.Create("c:\Current.rm4", FileOpenMode.Read, FileShare.Exclusive));

Rsm.Execute(Null);

End Sub Main;

After executing the example, a new platform repository will be created on the Test server in the TestSchema scheme.

Example #2

Executing the example requires a MSSQL server named Test. There is the TestSchema database on the server. The root of disk C contains the current.rm4 file that includes the script for repository creating.

Sub Main;

Var

Rsm: IRepositoryScriptManager;

Driv: IDalDriver;

ConDesc: IDalConnectionDescriptor;

Params: IDalConnectionDescriptorParams;

Con: IDalConnection;

Begin

//Connecting to the scheme on the MSSQL server

Driv := New DalMsSql2008Driver.Create As IDalDriver;

ConDesc := Driv.CreateDescriptor;

Params := ConDesc.Params;

Params.Find("User Name").Value := "TestSchema";

Params.Find("Password").Value := "TestSchema";

Params.Find("Host BSTR").Value := "Test";

Params.Find("Database").Value := "TestSchema";

Con := ConDesc.CreateConnection;

//Settings of the repository manager

Rsm := New RepositoryScriptManager.Create;

Rsm.Connection := Con;

Rsm.Driver := RepositoryDriverType.MSSQL2008;

Rsm.Operation := RepositoryOperationType.Create;

Rsm.Repository := RepositoryType.Metabase;

Rsm.Unicode := True;

Rsm.LoadScript(New FileStream.Create("c:\current.rm4", FileOpenMode.Read, FileShare.Exclusive));

Rsm.Execute(Null);

End Sub Main;

After executing the example a unicode version of the Foresight Analytics Platform repository is created at the Test server in the TestSchema scheme.

See also:

IRepositoryScriptManager