FireDAC.Comp.Script.TFDScript.SQLScriptFileName

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property SQLScriptFileName: String read FSQLScriptFileName write FSQLScriptFileName;

C++

__property System::UnicodeString SQLScriptFileName = {read=FSQLScriptFileName, write=FSQLScriptFileName};

Properties

Type Visibility Source Unit Parent
property published
FireDAC.Comp.Script.pas
FireDAC.Comp.Script.hpp
FireDAC.Comp.Script TFDScript

Description

The name of the SQL script file.

Use the SQLScriptFileName property to set the name of an SQL script file to run.

The name can use macros from the Macros collection or arguments from the Arguments list. If the OS file name does not have an extension, then ".SQL" is appended. If there is no path, then the DefaultScriptPath option is used.

The loading mechanism of an SQL script can be overridden using the OnGetText event handler. One way to do this is to load an SQL script not from a file, but from an EXE resource. Alternatively, an SQL script can be submitted from a memory using the SQLScript collection. SQLScriptFileName has higher priority than the SQLScript collection.

Note that the ExecuteFile and ExecuteScript methods clear the existing SQLScriptFileName value.

A path can include path variables.

Example

FDScript1.Arguments.Clear;
FDScript1.Arguments.Add('financial');
FDScript1.ScriptOptions.DefaultScriptPath := 'c:\temp';
FDScript1.SQLScriptFileName := 'create_&1_db';
// a file name will be resolved into c:\temp\create_financial_db.sql
FDScript1.ExecuteAll;

See Also