// HFU_NomeArquivo = HTML File upload component
if Trim(HFU_NomeArquivo.Value) = ''
then
begin
Response.Write('Missing file name');
Exit;
end;
W_NomeArquivo :=
HFU_NomeArquivo.Value;
W_Connection :=
FbConnection.Create(ConfigurationSettings.AppSettings.Item['ConnectionString']);
W_Command := FbCommand.Create();
W_Command.Connection := W_Connection;
W_Connection.Open();
W_Script :=
FbScript.Create(W_NomeArquivo);
try
W_Script.Parse;
except
Response.Write('There are
erro in script');
W_Script.Free;
W_Command.Free;
W_Connection.Free;
Exit;
end;
W_BatchExecution :=
FbBatchExecution.Create(W_Connection);
// It Does not accept command below. The compiler
give the error
// [Pascal Error] aigi9020.pas(134): E2129 Cannot assign to a
read-only property
// W_BatchExecution.SqlStatements :=
W_Script.Results;
//
// Then I have created loop to initialize
W_BatchExecution.SqlStatament
for W_Ind := 0 to W_Script.Results.count
- 1 do
begin
Response.Write((W_Ind).ToString);
W_BatchExecution.SqlStatements.Add(W_Script.Results[W_Ind]);
Response.Write(W_BatchExecution.SqlStatements[W_Ind]);
end;
try
W_BatchExecution.Execute();
except
Response.Write('
There are error in script - II');
W_Script.Free;
W_BatchExecution.Free;
W_Command.Free;
W_Connection.Free;
Exit;
end;
W_Script.Free;
W_BatchExecution.Free;
W_Command.Free;
W_Connection.Free;
end;
***********************************************
My Script
file content is
-------------------------
/*
xxxx
Estruturas do AIGI */
CREATE TABLE
FilialII
(
FIL_CDII
SMALLINT NOT
NULL,
FIL_NMII
VARCHAR(35) NOT
NULL,
FIL_DT_LKII
TIMESTAMP NOT
NULL,
CONSTRAINT
PK_FIL_CDII
PRIMARY KEY
(FIL_CDII)
);
SET TERM !! ;
create trigger T_FILIALII_01 for
FilialII
before insert position 1 as
begin
NEW.FIL_Dt_LkII = 'now';
end !!
SET TERM ; !!
create trigger T_FILIALII_02 for
FilialII
before update position 2 as
begin
NEW.FIL_Dt_LkII = 'now';
end !!
SET TERM ; !!