[yunqa.de] Re: Database components InitDatabase event

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Sun, 15 May 2011 13:22:39 +0200

On 15.05.2011 02:20, Kai Peters wrote:

> what would typically go in here?

Do you mean the TDISQLite3Database.OnInitDatabase event?

If you look at the DISQLite3Database.pas sources, you will find that it
is triggered as part of the following sequence during database open and
database creation:


1. TDISQLite3Database.OnBeforeConnect event
   TDISQLite3Database.DoBeforeConnect virtual method

Notifiy applications that the database is about to be connected.
Triggered on both database create and database open.


2. TDISQLite3Database.DoBeforeCreateDatabase event
   TDISQLite3Database.OnBeforeCreateDatabase virtual method

Notifiy that the new database is about to be created. Triggered only
once on database create, not on subsequent database open.


3. TDISQLite3Database.OnInitDatabase event
   TDISQLite3Database.DoInitDatabase virtual method

During this callback, the TDISQLite3Database.Handle is already available
and can be used to initialize modules (FTS3, R-TREE, fuzzer,
wholenumber), user functions and collation sequences. You can also set
database PRAGMAs and options here.

In short, use InitDatabase to set up everything which is required by the
database schema. Triggered on both database create and database open.


4. TDISQLite3Database.OnAfterCreateDatabase event
   TDISQLite3Database.DoAfterCreateDatabase virtual method

Use to create tables, views, triggers and intitialize data. Triggered
only once on database create, not on subsequent database open.


5. TDISQLite3Database.OnAfterConnect event
   TDISQLite3Database.DoAfterConnect virtual method

Notify that the database is opened. Triggered on both database create
and database open.


Ralf
_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: