{****************************************************}
{                                                    }
{             FIBPlus Script, version 1.7            }
{                                                    }
{          for InterBase, Firebird and Yafil         }
{                                                    }
{              Recomended by Devrace                 }
{http://www.devrace.com/en/fibplus/download/19-43.php}
{                                                    }
{     Copyright by Nikolay Trifonov, 2003-2005       }
{                                                    }
{        http://www.atstariff.com/fibplus/en/        }
{             E-mail: t_nick@mail.ru                 }
{                                                    }
{****************************************************}

FIBPlus Script. Why do you need it?
===================================
If you develop database applications you need to create and execute special SQL-scripts. 
This enables you to simplify deployment and product support modifying and updating metadata 
in your customer's databases.

FIBPlus components executes DDL statements as well as common SQL-commands and you can improve 
your applications with such feature as built-in metadata updates. However, FIBPlus components 
do not execute SQL-scripts. You can not execute a few different SQL statements at once with 
TpFIBQuery or TpFIBDataSet. Both components can operate with single SQL statements only.

That's why I had to write my own script component set compatible with FIBPlus. It is compatible 
with IBX TIBScript, TIBExtract, but unlike the IBX component, it also supports "execute procedure", 
"create or alter", "describe" (as in IBExpert <www.ibexpert.com>) etc. FIBPlus Script is used in 
several commercial applications with success, example "ATS Tarifficator" <www.atstariff.com>, 
Blazetop <www.blazetop.com>


Terms of use
============
This is not a freeware product. You can get a free trial version of FIBPlus Script, but after 
the evaluation period you should either purchase the component or remove it from you computer. 
Purchasing FIBPlus Script you get full sources of the product.

The price is $30 USD. It is normally quicker and easier to order online through well-known 
Internet payment services ShareIt and RegSoft. Their secure servers make ordering by credit/debit 
card quick and safe. They also accept purchase orders and faxed orders.

Purchase on-line via Regsoft or ShareIt:
Regsoft: http://www.regsoft.net/purchase.php3?productid=67119
ShareIt: http://www.shareit.com/product.html?cart=1&productid=204433&languageid=1&stylefrom=204433


Main FIBPlus Script features
============================
Supports all DDL-statements: DECLARE, ALTER, CREATE, etc.
Supports database connection/disconnection commands.
Supports transaction management commands: START TRANSACTION, COMMIT, etc
Supports new Firebird 1.5 and InterBase 7.x SQL.
Does not require SET TERM command to separate ALTER TRIGGER and ALTER PROCEDURE statements.
Support IBExpert command: DESCRIBE and SET BLOBFILE.


Script Example
==============

DECLARE EXTERNAL FUNCTION TIMETOSECONDS
TIME
RETURNS INTEGER BY VALUE
ENTRY_POINT 'TimeToSeconds' MODULE_NAME 'nntudf';

update products set price = 0 where id_price>60;

ALTER PROCEDURE SP_GET_ROUNDMINUTES (
DURATION TIME)
RETURNS (
DURATION_ROUNDMINUTES INTEGER)
AS
declare variable duration_hour integer;
declare variable duration_minute integer;
declare variable duration_second integer;
declare variable dontusefirstseconds integer;
BEGIN
select Z(extract(hour from :duration)), Z(extract(minute from :duration)),
Z(extract(second from :duration))
from rdb$database
into :duration_hour, :duration_minute, :duration_second;
SUSPEND;
END ;
=========


How to use FIBPlus Script in Delphi
===================================
Drop the component on a form and fill DataBase and Transaction properties. You can also use LastDDLQueryLog and LastDMLQueryLog properties (set the paths to text files to have a log of all DDL and
DML statements and errors). It will help you to find problem commands in your scripts, if any.

If you'd like to use FIBPlus Script component with FIBPlus 4.x or 5.0, you should move the RemoveDatabase method of TFIBDatabase (FIBDatabase.pas ) to public section and recompile the library.

Example:

FIBScript1.Script.LoadFromFile('c:\test.sql');
FIBScript1.AutoDDL := False;
if FIBScript1.ValidateScript then FIBScript1.ExecuteScript;
if FIBScript1.Transaction.InTransaction then FIBScript1.Transaction.Commit;


Nikolay Trifonov
E-mail: t_nick@mail.ru
http://www.atstariff.com/fibscript/