Copyright: Copyright ® 1996 Steve Flynn
Citation: Copyright ® 1996 Steve Flynn


Abbreviated Field Access Properties
DataSet Properties Directly Available from DataSorcerer

Inherited DataSource Attributes	Events	Methods	Properties

DataSorcerer TTable Attributes	Events	Methods	Properties

DataSorcerer TQuery Attributes	Events	Methods	Properties

DataSorcerer TStoredProc Attributes	Events	Methods	Properties

DataSorcerer InfoPower Attributes	Events	Methods	Properties

Abbreviated Field Access Properties

Using DataSet Properties, Methods and Events

Where do I set Properties and/or Exception Events


Ability Property
DataSorcerer Ability Property

Applies to

TDataSorcerer

Declaration

property Ability: TAbility;

Description

The Ability property is a read only property that indicates the capability of the DataSorcerer component.


AddTrap Procedure

See Also	Example

Applies to

TDataSorcerer

Declaration

procedure AddTrap(ErrCode: integer; ErrProc: TTrapProc);

Description

AddTrap allows you to add an Exception event procedure. When an exception occurs and a matching Exception event procedure is found, the event procedure is called. If no Exception event procedure is defined for the particular exception then the current Application Exception event procedure is called. If no Application Exception procedure is defined then Delphi's default Exception handler is called to display an Exception message.

Errcode is the BDE Exception error code that you wish to trap, and ErrProc is the TTrapProc that will be called in the event of this Exception error occurring.

If you are defining Exception traps on Apprentice Forms then you should make use of the OnLinked Event since AddTrap should only be called after the Apprentice is linked to its Sorcerer.


ApprenticeForms Property
ApprenticeForms

Applies to

TDataSorcerer

Declaration

property ApprenticeForms: TStrings;

Description

The ApprenticeForms property is a string list containing the names of all the Forms which have Apprentices linked to the Sorcerer.

This property only applies to Sorcerers.


Component
DataSorcerer Component

Properties	Methods	Events	Tasks

Unit

DataSorc

Description

DataSorcerer gives Delphi Database Programmers the much sought after feature of a Global Datasource: The main features of DataSorcerer are:

A single DataSorcerer and its Dataset can be accessed Globally from all form within an application.

Links between DataSorcerers on different Forms can be created at Design Time.

All data linkages are present at Design time to allow testing before compilation.

There is No Code required on any Form to make the the data available.

There is No Code required on any Form to keep the data synchronized.

All Data Aware controls on all forms are automatically kept synchronized.

Direct access is available to the underlying DataSet, no matter what type it is.

Abbreviated program syntax to access database fields.

All public TDataSource methods and properties are directly accessible.

All public TDataSet methods and properties are directly accessible.

All public TDBDataSet methods and properties are directly accessible.

All public TTable methods and properties are directly accessible.

All public TQuery methods and properties are directly accessible.

All public TStoredProc methods and properties are directly accessible.

The TTable Fields Editor is available from any linked DataSorcerer.

The TQuery/TStoredProc Params Editor is available from any linked DataSorcerer.

The Master Fields Designer is available from any linked DataSorcerer.

Full support for InfoPower Data Access components

The InfoPower Property Editors are available from any linked DataSorcerer.

Exception trapping of Database errors

DataSorcerer is a descendant of the Delphi TDataSource component. If InfoPower support is enabled then DataSorcerer descends from the TwwDataSource component, which is itself a direct descendant of TDataSource.


DBFilterCombo for Delphi

DBFilterCombo for Delphi

DBFilterCombo is a Data Aware Lookup ComboBox control for Borland's Delphi. It looks and works just like the standard Delphi DBLookupCombo with a couple of notable exceptions;

DBFilterCombo will not only create a lookup list from a second database it allows the items in the lookup list to be Filtered by a third and independent LookupFilterField. The LookupFilterField has both Minimum and Maximum values which may be Inclusive or Exclusive. The LookupFilterField does NOT have to be a key.

DBFilterCombo adds records to the Lookup Datasource if the user enters a value that is not already contained in the lookup list. DBFilterCombo alerts you to this operation and allows you to programatically accept or cancel the record addition on a record by record basis.

DBFilterCombo supports Incremental List Searching with or without Case Sensitivity to allow the user to enter the first letters of an item in the list and have the rest of the field filled in automatically.

DBFilterCombo has intelligent Drop Down List placement when the drop down list is near to a screen edge.

DBFilterCombo is really great for those little Helper Tables that all Databases need. You know the ones that store things like Titles (Mrs, Mrs, Colonel etc) or Shipping Method (Air, Sea, Courier etc etc). In fact you can now store all of these little helpers in a single table and use DBFilterCombo to provide Dropdown lists Filtered by category (eg, Titles, Shipping Method, Religion etc). I am sure that you will find it equally as useful.

Try out the Shareware version available for download from the Compuserve Delphi Forum. Search for DBFLTCOM.ZIP.

Source code is available as a separate registration from Version 2.0 onwards.


DataSet Property
DataSorcerer DataSet Property

Applies to

TDataSorcerer

Declaration

property DataSet: TDataSet;

Description

Run-time only. DataSet identifies the dataset connected to the DataSorcerer component. This can be any of the standard Delphi TTable, TQuery and TStoredProc components. If InfoPower support is enabled then this may also be a TwwTable, TwwQuery or TwwQBE component.


DataSetType Property
DataSorcerer DataSetType Property

Applies to

TDataSorcerer

Declaration

property DataSetType: TDataSetType;

Description

The DataSetType property indicates type type of source DataSet in use by the DataSorcerer component.


DataSorcerer
DataSorcerer for Delphi

DataSorcerer Copyright © 1996 Steve Flynn

Component Overview

New Features in Version 2

InfoPower Support & Version Mismatch Errors

Installation

Finding the DataSorcerer Software Version

Shareware Limitations

Sample Program

The Sorcerer's Apprentice

How to Use DataSorcerer

Instant Sorcerer

Ordering the Registered Version of DataSorcerer

Software License Agreement

Other products by Steve Flynn

Getting Technical support

InfoPower is a trademark of Woll2Woll software.

Delphi is a trademerk of Borland.

Windows and Windows 95 are trademarks of Microsoft.

Norton Utilities is a trademark of Symantec.

Apollo is a Trademark of Successware


DataSorcerer Tasks

Abbreviated Field Access Properties

How to Use DataSorcerer

The Sorcerers Apprentice

The Global Village

Using DataSet Properties, Methods and Events

Where do I set Properties and/or Exception Events


Directory Sorter for Windows 95

Directory Sorter for Windows 95

Do you use the DOS prompt in Windows 95 ?

Are you annoyed when you archive, copy or backup files and they are not processed in Alphabetic order ?

Are you annoyed that the latest version of Norton Utilities for Windows 95 does not include a DirSort ?

Then get Directory Sorter!

Directory Sorter will physically store all the files and directories on your drives in Alphabetic order. This

means that whenever you do a dir, copy, xcopy, backup or archive operation etc, all the files and directories will be processed in Alphabetic order.

The shareware version of Directory Sorter is available in the WINUTILITY and MSWIN95 forums on

Compuserve. If you like the shareware version then registration is also available on-line on Compuserve.

Grab a copy and try it out.

STOP PRESS: Directory Sorter V2.0 with tons of new features is due out in May 96. Look for it in the Compuserve WINUTILITY and MSWIN95 forums, filename DIRSORT2.EXE.


Exception Example
Exception Properties, AddTrap and RemoveTrap Example

Exception Properties, AddTrap and RemoveTrap Example

The following code segment is based on the UNIT2.PAS file included in the sample application and demonstrates the use of DataSorcerer's Exception Properties, AddTrap and RemoveTrap procedures. The sample displays exception information in a listbox when the trapped Exceptions occur.

If you are defining Exception traps on Apprentice Forms then you should make use of the OnLinked Event since AddTrap should only be called after the Apprentice is linked to its Sorcerer. This example illustrates this.

procedure TForm2.RequiredError(DS: TDataSorcerer; ErrCode: integer);

begin

MessageBeep(0);

end;

procedure TForm2.OtherError(DS: TDataSorcerer; ErrCode: integer);

begin

Form5.ListBox1.Clear;

Form5.ListBox1.Font.Name := 'FixedSys';

Form5.ListBox1.Items.Add(Format('Error Code            : %d', [ErrCode]));

Form5.ListBox1.Items.Add(Format('Error Message         : %s', [DS.EMessage]));

Form5.ListBox1.Items.Add(Format('Table Name            : %s', [DS.ETableName]));

Form5.ListBox1.Items.Add(Format('Field Name            : %s', [DS.EFieldName]));

Form5.ListBox1.Items.Add(Format('Field Display Name    : %s', [DS.EFieldDisplayName]));

Form5.ListBox1.Items.Add(Format('Field Number          : %d', [DS.EFieldNo]));

Form5.ListBox1.Items.Add(Format('Field Min Value       : %s', [DS.EFieldMinValue]));

Form5.ListBox1.Items.Add(Format('Field Max Value       : %s', [DS.EFieldMaxValue]));

Form5.ListBox1.Items.Add(Format('Field Default Value   : %s', [DS.EFieldDefValue]));

if DS.EFieldRequired then

Form5.ListBox1.Items.Add('Required              : Yes')

else

Form5.ListBox1.Items.Add('Required              : No');

Form5.ListBox1.Items.Add(Format('Token                 : %s', [DS.EToken]));

Form5.ListBox1.Items.Add(Format('Image Row             : %s', [DS.EImageRow]));

Form5.ListBox1.Items.Add(Format('User Name             : %s', [DS.EUserName]));

Form5.ListBox1.Items.Add(Format('File Name             : %s', [DS.EFileName]));

Form5.ListBox1.Items.Add(Format('Index Name            : %s', [DS.EIndexName]));

Form5.ListBox1.Items.Add(Format('Directory Name        : %s', [DS.EDirName]));

Form5.ListBox1.Items.Add(Format('Key Name              : %s', [DS.EKeyName]));

Form5.ListBox1.Items.Add(Format('Alias                 : %s', [DS.EAlias]));

Form5.ListBox1.Items.Add(Format('Drive Name            : %s', [DS.EDriveName]));

Form5.ListBox1.Items.Add(Format('Native Code           : %s', [DS.ENativeCode]));

Form5.ListBox1.Items.Add(Format('Native Message        : %s', [DS.ENativeMsg]));

Form5.ListBox1.Items.Add(Format('Line Number           : %s', [DS.ELineNumber]));

Form5.ListBox1.Items.Add(Format('Capability            : %s', [DS.ECapability]));

{$IFDEF WIN32}

Form5.ListBox1.Items.Add(Format('Client Data Repository: %s', [DS.ECDRName]));

Form5.ListBox1.Items.Add(Format('User Error Message    : %s', [DS.EUserErrMsg]));

Form5.ListBox1.Items.Add(Format('Internal Limit        : %s', [DS.EInternalLimit]));

{$ENDIF}

Form5.Show;

end;

procedure TForm2.OnLinked(Sender: TObject);

begin

Animals.AddTrap(DBIERR_KEYVIOL, OtherError);	// Key Violation errors

Animals.AddTrap(DBIERR_MINVALERR, OtherError);	// Minimum value errors

Animals.AddTrap(DBIERR_MAXVALERR, OtherError);	// Maximum value errors

Animals.AddTrap(DBIERR_REQDERR, RequiredError);	// Required field errors

end;

procedure TForm2.FormDestroy(Sender: TObject);

begin

Animals.RemoveTrap(DBIERR_KEYVIOL);

Animals.RemoveTrap(DBIERR_MINVALERR);

Animals.RemoveTrap(DBIERR_MAXVALERR);

Animals.RemoveTrap(DBIERR_REQDERR);

end;


Exception Information Properties

Example

Exception Information Properties

The following DataSorcerer Properties may be examined by your code after a Database Exception has occurred to obtain more detailed information about the Exception. All of these properties are available only at Run-time and are  Read Only

property EMessage: string;	// Error description

property EToken: string;	// Token for QBE

property ETableName: string;	// Table Name

property EFieldName: string;	// Field Name

property EImageRow: string;	// Image Row for QBE

property EUserName: string;	// eg; in locking conflicts, user involved

property EFileName: string;	// File Name

property EIndexName: string;	// Index Name

property EDirName: string;	// Directory Name

property EKeyName: string;	// Key Name

property EAlias: string;	// Alias

property EDriveName: string;	// Drive Name eg; C:

property ENativeCode: string;	// Native Error Code

property ENativeMsg: string;	// Native Error Message

property ELineNumber: string;	// Line Number

property ECapability: string;	// Capability

property EFieldDisplayName: string;	// The display name of the field

property EFieldNo: integer;	// The field's number -1 := no info logged

property EField: TField;	// The exception field object

property EFieldMinValue: string;	// Paradox field minimum value

property EFieldMaxValue: string;	// Paradox field maximum value

property EFieldDefValue: string;	// Paradox field default value

property EFieldRequired: boolean;	// Paradox field required flag

For Delphi 2.0 Only

property ECDRName: string;	// Client Data Repository Name

property EUserErrMsg: string;	// User defined error message

property EInternalLimit: string;	// Internal limit

Please Note:

The BDE does not log information for all available error properties when an exception occurs, and in some cases, for example when a Key Violation occurs, it does not log any information at all. If the value of EFieldNo is -1 then the BDE has not logged any information about the exception. If EFieldNo is 0 or greater then information has been logged in at least some of the properties. This is a BDE problem not a DataSorcerer problem. The EMessage string will always contain an error description even if the BDE has not logged any other details.

Detailed BDE information can be found in the BDE.HLP file in the  Delphi 2.0 BDE directory.

Also Note:

For Exception Trapping to work correctly you must have a TField object defined for each database field. Use the DataSet's Fields Editor to add these TFields. You must also set the Required value to False for each field using the DataSet's Fields Editor (this is the default value anyway). For required fields you should set the Required Field flag as appropriate for each field using Database Desktop, ie the Required Field flags should be set at the Database level, not from within Delphi.


How to Use DataSorcerer

See Also

How to Use DataSorcerer

In practice it is no more difficult to use DataSorcerer that any other of the Delphi Visual Controls. Its just a simple matter of dropping a DataSorcerer on a form and setting a few properties. Here is an example of how to create a Sorcerer and an Apprentice.

1)	Create a form and place a TTable (or TQuery or TStoredProc) on it. This example will be based on a TTable DataSet. Set the TTables properties to access a database (one of the Delphi samples will do just fine). Make sure you set the TTables Active state to True so you can watch the magic unfold.

2)	Place a DataSorcerer on the same form.

3)	Set the DataSet property of the TDataSorcerer component to the TTable that you have just set up.

4)	Place some Data Aware controls on the form and set their DataSource property to the TDataSorcerer component. Set their DataFields to some appropriate fields in the database table.

5)	Up until now this is exactly the same as using the Standard Delphi TDataSource component.

6)	Create another new form and place another TDataSorcerer Component on it.

IMPORTANT   IMPORTANT   IMPORTANT   IMPORTANT

7)	The new TDataSorcerer that you have just placed will become an Apprentice. IT MUST HAVE THE SAME NAME AS THE SORCERER THAT IT IS TO BE LINKED TO OR THERE WILL BE NO LINK ESTABLISHED.  If you have not changed the default names that Delphi assigns to the TDataSorcerer components when they are created then you should have a TDataSorcerer on each form both named DataSorcerer1.

8)	Place some Data Aware controls on the second form and set their DataSource Property to the TDataSorcerer component. Set their DataFields to some appropriate fields in the database table. These can be the same fields as those used on the first form or different fields, it makes no difference. For this demonstration why not make them a mixture of fields already used on the previous form and some new fields also. Then you will be able to see how the data stays in sync.

9)	Up until now you have done exactly the same thing that would be required for the standard Delphi DataSource component except that you have omitted the DataSet (TTable, TQuery or TStoredProc) from the second form.

10)	Now say the Magic Words

11)	Now cast the spell in one of two ways.

a) You can set the SorcererForm property of the second TDataSorcerer (the Apprentice) to the name of the form holding the first TDataSorcerer (the Sorcerer).

or

b) You can enter the name of the Form containing the Second TDataSorcerer (the Apprentice) into the ApprenticeForms list of the original TDataSorcerer (the Sorcerer).

12)	Presto. You have just created a Sorcerer and an Apprentice. You should now have live linked data that is automatically synced between two forms. You can add more Apprentice forms if you like using the same techniques explained above to create the second form. Remember that ALL additional Apprentices accessing the same database must have the same name as the Sorcerer and must have their SorcererForm property set to the name of the Sorcerer's form.

To confirm the linkage of all the DataSorcerers you can Left Click on one of them then Right Click on the same one to bring up its Component Editor menu. Choose the Fields Editor and use the Navigator bar in the Fields Editor to move through the database records. You should see the Data Aware controls on each form change as you move through the records.

If you like you can place a Navigator control on each of the forms and set their DataSource properties to the TDataSorcerer control on the same form. When compiled any of the Navigators can be used to move through the database, and each form's Data Aware controls will stay in sync. The sample application does exactly this.

Important Note

It is possible to assign an Apprentice to a Sorcerer with a particular DataSet and then place a TTable (for example) on the Apprentice's form which has the same name as the DataSet of the Sorcerer. This is real easy to do if you just use the default Delphi names for all components.

WARNING   WARNING   DANGER   DANGER

If you do this by accident (or by design) Delphi will get itself into such a serious knot that you probably won't be able to get it undone again short of hand editing the source code of all the forms in your application and manually deleting the offending TTable. Delphi can't distinguish between the TTable named Table1 (for example) on the Sorcerer's form and the one called Table1 on the Apprentices form.

A bit of advice

If you plan to use DataSorcerer, rename the Tables (Queries, StoredProcs) and DataSorcerers to something sensible and meaningful as they are created and this problem is unlikely to happen. This is probably good practice for any application since it will make your code a bit more readable should you or someone else have to maintain it at a later date.


InfoPower Events
DataSorcerer InfoPower Events

See Also	See the InfoPower Online Help for details of these Events

TwwTable Events

AfterCancel AfterClose AfterDelete AfterEdit AfterInsert AfterOpen	AfterPost BeforeCancel BeforeClose BeforeDelete BeforeEdit BeforeInsert	BeforeOpen BeforePost OnCalcFields OnFilter OnNewRecord
TwwQuery Events

AfterCancel AfterClose AfterDelete AfterEdit AfterInsert AfterOpen	AfterPost BeforeCancel BeforeClose BeforeDelete BeforeEdit BeforeInsert	BeforeOpen BeforePost OnCalcFields OnNewRecord
TwwQBE Events

AfterCancel AfterClose AfterDelete AfterEdit AfterInsert AfterOpen	AfterPost BeforeCancel BeforeClose BeforeDelete BeforeEdit BeforeInsert	BeforeOpen BeforePost OnCalcFields OnNewRecord


InfoPower Methods 1
DataSorcerer InfoPower Methods

See Also	See the InfoPower Online Help for details of these Events

TwwTable Methods

AddIndex ApplyRange Append AppendRecord BatchMove Cancel CancelRange CheckBrowseMode ClearFields Close CreateTable CursorPosChanged Delete DeleteIndex DeleteTable DisableControls Edit EditKey EditRangeEnd	EditRangeStart EmptyTable EnableControls FieldByName FindField FindKey FindNearest First FreeBookmark GetBookmark GetFieldNames GetIndexNames GotoBookmark GotoCurrent GotoKey GotoNearest Insert InsertRecord Last	MoveBy Next Open Post Prior Refresh SetFields SetKey SetRange SetRangeEnd SetRangeStart UpdateRecord Added Methods Pack FilterActivate wwFindKey wwFilterField wwSetRangeStart
TwwQuery Methods

TwwQBE Methods


InfoPower Methods 2
DataSorcerer InfoPower Methods

See Also	See the InfoPower Online Help for details of these Events

TwwTable Methods

TwwQuery Methods

Append AppendRecord Cancel CheckBrowseMode ClearFields Close CursorPosChanged Delete DisableControls Edit EnableControls ExecSQL	FieldByName FindField First FreeBookmark GetBookmark GetFieldNames GotoBookmark Insert InsertRecord Last MoveBy	Next Open ParamByName Post Prepare Prior Refresh SetFields UnPrepare UpdateCursorPos UpdateRecord
TwwQBE Methods


InfoPower Methods 3
DataSorcerer InfoPower Methods

See Also	See the InfoPower Online Help for details of these Events

TwwTable Methods

TwwQuery Methods

TwwQBE Methods

Cancel CheckBrowseMode Close CursorPosChanged DisableControls EnableControls ExecSQL FieldByName FindField First	FreeBookmark GetBookmark GetFieldNames GotoBookmark Last MoveBy Next Open ParamByName Prepare	Prior Refresh SetFields UnPrepare UpdateCursorPos UpdateRecord Added Properties ClearParams SetParam


InfoPower Properties
DataSorcerer InfoPower Properties

See Also	See the InfoPower Online Help for details of these Properties

TwwTable Properties

Active AutoCalcFields DatabaseName Exclusive IndexFieldNames IndexName MasterFields MasterSource Name	ReadOnly TableName TableType Tag UpdateMode	Added Properties ControlType Filter LookupFields LookupLinks NarrowSearch Modified Properties SyncSQLByRange
TwwQuery Properties

Active AutoCalcFields DatabaseName DataSource Name Params	RequestLive SQL Tag UniDirectional UpdateMode	Added Properties ControlType LookupFields LookupLinks
TwwQBE Properties

Active AutoCalcFields DatabaseName Name Tag	Added Properties AnswerTable AuxiliaryTables BlankAsZero ControlType	LookupFields LookupLinks QBE


InfoPower Support
InfoPower Support & Version Mismatch Errors

Component Only Version of DataSorcerer

Due to the large number of people experiencing "Version Mismatch" errors when using the Component only version of DataSorcerer V1.1, we are not providing support for InfoPower in the Component only version of DataSorcerer V2.0.

The "Version Mismatch" errors are due to the fact that there are many update versions of InfoPower V1.1 in use by our customers and it would only be possible for us to support the latest version in our Component only product.

Source Code Version of DataSorcerer

Since recompilation of the DataSorcerer source code using your own working version of InfoPower fixes the "Version Mismatch" problem described above, we are happy to continue support for InfoPower in the Source Code version of DataSorcerer.

Support for Other Third Party Database Products

By registering the source code you will be able to recompile DataSorcerer to match any update or future versions of InfoPower. The source code version of DataSorcerer will also allow you to modify DataSorcerer to suit other third party database access products other than InfoPower, for example Apollo.

Please Note: The Author still retains Copyright Ownership of DataSorcerer, even if you make changes to the source code to allow the use of other third party products. You are still bound by the terms and conditions of the DataSorcerer Software License Agreement even if you make changes to the source code.


Installation
DataSorcerer Installation

DataSorcerer Installation

Now that there are two versions of Delphi in concurrent use by many programmers to support both Windows 3.x and Windows 95, it is not possible to specify exact directory locations for any of Delphi's sub-directories. The Delphi Installation program allows you to install Delphi into a directory of your own choice. The installation instructions below refer to your "Delphi Library" directory. This library directory will be a sub-directory of your chosen Delphi installation directory and is named LIB. For example, if you installed Delphi V1.0 in the C:\DELPHI10 directory, the library directory is C:\DELPHI10\LIB and if you installed Delphi V2.0 in the C:\DELPHI20 directory the library directory is C:\DELPHI20\LIB. The Delphi BIN and HELP directories can be located in the same way.

If you have installed both Delphi V1.0 and Delphi V2.0 then you will need to install DataSorcerer in the library sub-directories of BOTH Delphi directories. You will need to follow the instructions for installation for both versions of Delphi.

The method for adding and/or removing components from your Delphi Component Library is different for each version of Delphi. Please refer to your manuals or Delphi Help files for precise instructions on adding and/or removing components from the Delphi Component Library.

As always, before installing or removing a component from the Component Library, it is prudent to make a backup copy of the Component Library file, just in case something goes wrong and you need to revert to the old version.

Installing the Source Code Version of DataSorcerer

To install the Source Code Version of DataSorcerer follow these steps:

1.	If you previously installed a Shareware or Component only version of DataSorcerer then you will first need to Delete the DATASORC.DCU and DATAPROP.DCU files from your Delphi Library directory.

2.	Copy the Source Code distribution EXE file to a temporary directory and run this program from the Windows File Manager / Program Manager / Explorer or Windows 95 DOS Prompt. This will Un-Zip the distribution files.

3.	Copy the DATASORC.PAS, DATASORC.INC and DATAPROP.PAS files to your Delphi Library directory.

4a.	If you are using Delphi V1.0.

Copy the DATASORC.16 file to the Delphi Library directory and rename it to DATASORC.DCR.

4b.	If you are using Delphi V2.0.

Copy the DATASORC.32 file to the Delphi Library directory and rename it to DATASORC.DCR.

5.	If you wish to enable InfoPower support then use the Delphi IDE to edit the DATASORC.INC file now in your Delphi Library directory. This file requires one simple editing change to enable or disable InfoPower support. This change is described in the file itself and is located at the very end of the file. See below for more details.

6.	If you previously installed V1.1, the Shareware or Component only version of DataSorcerer then Remove the DATASORC.DCU and DATAPROP.DCU files from the Component Library.

7.	Add BOTH the DATASORC.PAS and DATAPROP.PAS files to your Delphi Component.

8.	When the Library is Rebuilt the DataSorcerer Icon will appear in the Data Access Tool Palette. If you have enabled InfoPower support the icon will appear in the InfoPower Tool Palette.

Note:

If the DataSorcerer icon was previously displayed in the Data Access Tool Palette and you enable InfoPower support and rebuild the Component Library, you will have to manually move the icon from the Data Access Palette to the InfoPower Palette. Delphi will not move a preexisting icon in the Tool Palettes when the library is rebuilt. See the Delphi documentation or Help files for instructions on moving the Palette icons.

Enabling InfoPower Support with the Source Code Version

Enabling InfoPower Support requires only one small change to the DATASORC.INC file and a Library Rebuild as follows:

1.	Edit the following line in the DATASORC.INC file in your Delphi LIB directory (its at the end of the file)

{.$DEFINE INFPWR}

and remove the . so that it reads as follows

{$DEFINE INFPWR}

2.	Now Rebuild the Delphi Component Library using the appropriate Delphi menu option.

3.	Thats all, now DataSorcerer is a TwwDataSource descendant and provides access to the additional InfoPower DataSet properties.

4.	To disable InfoPower support just reverse the process by adding a . to the $DEFINE command and rebuilding the Component Library.

Installing the Shareware & Component Only Versions of DataSorcerer

To install DataSorcerer Shareware or Component Only versions follow these steps:

1.	Copy the distribution EXE file to a temporary directory and run the EXE program from the Windows File Manager/Program Manager/Explorer. This will Un-Zip the distribution files.

2a.	If you are using Delphi V1.0.

Unzip the 16BIT.ZIP file.

2b.	If you are using Delphi V2.0.

Unzip the 32BIT.ZIP file.

3.	Now copy the DATASORC.DCU, DATASORC.DCR and DATAPROP.DCU files to your Delphi Library directory.

4.	Add BOTH the DATASORC.DCU and DATAPROP.DCU to your Delphi Component Library.

5.	When the Library is Rebuilt the DataSorcerer Icon will appear in the Data Access Tool Palette.

Adding the DataSorcerer Help file to Delphi's Online Help

To add the DataSorcerer Help file to the Delphi Online Help system follow these steps:

1a.	If you are using Delphi V1.0.

Copy the DATASORC.HLP file to the Delphi BIN directory and copy the DATASORC.KWF file to the Delphi HELP directory.

1b.	If you are using Delphi V2.0.

Copy both the DATASORC.HLP and DATASORC.KWF files to the Delphi HELP directory.

2.	Now add the DATASORC.KWF file to the Delphi Online Help keyword list using the Help Installer program supplied with Delphi. Please refer to the Delphi documentation or Online Help for precise instructions on adding keyword files to the keyword index.

Note:

The first time that you use DataSorcerer's Help file within Delphi, you may need to tell the system where to find the Help file. Just use the path where you have installed it above. You should only have to do this once.

Installing the Sample Program

To install the sample program follow these steps:

1.	Unzip the SAMPLE.ZIP file supplied as part of the distribution archive into a directory of your own choice.

2.	Load Delphi and open the ANIMALS.DPR project you have just unzipped.

Note:

The sample assumes that you installed the Delphi Sample Database files when you installed Delphi. If you did not install the sample database files then you will need to use the Delphi Installer to add them to your system. The sample code assumes that the database Alias for the sample database files is DBDEMOS.


Instant Sorcerer

Please make sure you have first read The Sorcerer's Apprentice, The Global Village and How to Use DataSorcerer topics before attempting any of the following.

Instant Sorcerer

Here's a tip on how to convert your forms to use DataSorcerer without the tedium of reassigning the DataSource of every component on the form. (You must have DataSorcerer installed before doing this).

MAKE A BACKUP OF THE DFM FILES YOU ARE ABOUT TO EDIT.

1)	Load Delphi and close any open projects.

2)	Select Open File from the File Menu. Change the file type in the "List Files of Type" combo box to "Form File (*.DFM)" and navigate to the directory that contains the forms for your application.

3)	Load the desired form file. This method will display the form file in its Text form and it can now be manually edited.

4)	Use the Find command of the Search menu to locate references to TDataSource. Change the word TDataSource to TDataSorcerer for each instance that you find in the file.

5)	Save the file and close it and repeat steps 1 - 5 for all forms that you wish to convert.

6)	When you have made changes to all the required forms, open your project file. All the TDataSource components that you edited will have been changed into TDataSorcerers, complete with attached DataSets.

7)	If you have done this to several forms you can now ditch the redundant TTables (or TQueries or TStoredProcs). First decide which form will be the one with the Sorcerer. It makes no difference which form contains the Sorcerer (provided its created when your application starts) but its usually best to use the form defined as the MainForm in the Project Manager.

8)	Display each form that you want to link to the Sorcerer and delete the DataSet (Table, Query or StoredProc) component from the Apprentice's Form. Then set the Apprentice's SorcererForm property to the name of the Form where its Sorcerer is located. Remember that the Apprentice must have the same name as the Sorcerer so change the new DataSorcerer's name to match the Sorcerer so that the link can be established.

9)	That's all there is to it. The rest of the visual side of the application development is just the same as it always was.


MegaPanel for Delphi

MegaPanel for Delphi

MegaPanel is a Delphi control that provides all the functionality of the standard Delphi TPanel control plus:

 Supports both Delphi 1.x and Delphi 2.x

 Automatically generated Panel Labels.

 Automatic Quicken Style Labels.

 Multi-line Labels and Captions

 Rotation of Labels and Captions

 16 different Label positioning options

 12 different Caption positioning options

 Selectable Label background colors

 Selectable Caption background colors

 Each label may be assigned a separate foreground or background color

 Transparent Labels and Panels

 3 different Captioning styles

 Many options to control the Caption location

 Background bitmaps for Panel or Caption or Both

 14 different Bitmap positioning options including Stretch and Tile

 7 different Bitmap location options

 Transparent Bitmaps.

 Automatic Panel Dividers

 Automatic Child Control Centering and Resizing

 Automatic Child Control Font Resizing

 Automatic Caption Resizing and Label Resizing

 Gradient Fills in many different styles for Panel or Caption or Both

 Automatic Keyboard Fixup to allow the Enter or Arrow keys to work like the Tab key

 Automatic Hot Key Label generation from label text

 Automatic Hot Key Focusing

 Label color effects for Focused control

 Label 3D effects for Focused control

 Use Any Form as a Panel. This allows you to modularize your code

 And Lots More...

MegaPanel can create some truly spectacular results. Download a copy of the shareware version from the Compuserve Delphi Forum and try it for yourself (Filename MEGAPANL.EXE). I know you will be impressed.

Source code is available as a separate registration from Version 2.0 onwards.


New Features in Version 2
New Features of DataSorcerer V2.0

New features of DataSorcerer V2.0

These major new features have been included in DataSorcerer version 2.0

Support for both Delphi V1.x 16bit and Delphi V2.x 32bit platforms

Support for additional Delphi V2.0 database component Events, Properties and Methods

Enhanced set of Abbreviated Dataset Field Access Properties

Exception Trapping

Availability of Source Code

Delphi Online Help compatible Help File


OnLinked Event
TDataSorcerer OnLinked Event

Applies to

TDataSorcerer

Declaration

property OnLinked: TNotifyEvent;

Description

The OnLinked event calls a TNotify event procedure just after an Apprentice is linked to its Sorcerer. This may be useful when adding Exception Trapping procedures to a Form other than the one that the Sorcerer is located on.

Note

The OnLinked event procedure may be called more than once when an Apprentice is linked to its Sorcerer depending on the circumstances and time of the linking process.


OnUnLink
DataSorcerer OnUnLinked Event

Applies to

TDataSorcerer

Declaration

property OnUnLinked: TNotifyEvent;

Description

The OnUnLinked event calls a TNotify event procedure just before an Apprentice is unlinked from its Sorcerer. This event may be useful for removing Exception Trapping procedures from a Form other than the one that the Sorcerer is located on.

Note

The OnUnLinked event procedure may be called more than once when an Apprentice is unlinked from its Sorcerer depending on the circumstances and time of the unlinking process.


Ordering the Registered Version of DataSorcerer

Registration Benefits

Registered users of DataSorcerer are free to use it in their own Delphi programs without payment of additional license fees or royalties in accordance with the terms of the DataSorcerer Software License Agreement.

Registered users are entitled to bug fixes and minor version upgrades at no additional cost. All bug fixes and upgrades will be distributed via Compuserve.

By using the DataSorcerer software you are agreeing to be bound by the terms of the DataSorcerer Software License Agreement.

Registering Online via Compuserve

You may order any of the registered version of DataSorcerer via Compuserve's SWREG facility.  On Compuserve use the Services menu, GO command then enter SWREG as the service name and follow Compuserve's instructions. There are no shipping charges when you order via Compuserve.

Registering via Internet

We expect that on-line registration via Internet should be available during April/May 1996. The actual date is out of our control and up to the registration service provider. Announcements of this service should be made by the provider on Compuserve, Internet and other on-line services when the registration service comes on line. There is a $3 additional shipping charge to cover mailing of diskettes when you register via Internet. Unfortunately we have found that E-Mail delivery of Binary files via Internet is troublesome at best and we are therefore not providing E-Mail delivery via Internet at this time (until we can do it reliably to all our customers).

There are three ways to Register DataSorcerer

1. Component Only Version

This version of DataSorcerer IS NOT supplied with Source Code. It provides support for the standard Delphi database components, TTable, TQuery and TStoredProc.

The Compuserve SWREG Registration ID Number for the Component Only Version of DataSorcerer is 10924, the price of this version is $19.95 and includes delivery by Compuserve E-Mail. There is an additional $3 shipping charge when registering via Internet.

2. Source Code Version with InfoPower Support

This version of DataSorcerer IS supplied in Source Code form and provides all the same features as the Component Only version plus support for InfoPower. Because this version is supplied as source code you get both the security of having access to the source and the ability to recompile or adapt the source code for different versions of Delphi or InfoPower and other third party database products. Any changes you make to the source are still subject to the DataSorcerer Software License Agreement.

The Compuserve SWREG Registration ID number for the Source Code Version of DataSorcerer is 10925, the price of this version is $69.95 and includes delivery by Compuserve E-Mail.  There is an additional $3 shipping charge when registering via Internet.

3. Component Only Upgrade Version

This version of DataSorcerer IS NOT supplied with Source Code. It provides registered users of V1.1 of DataSorcerer an upgrade to the Component only version of DataSorcerer V2.0 at a reduced price of $10.

The Compuserve SWREG Registration ID number for the Component Only Upgrade Version of DataSorcerer is 10926, the price of this version is $10 and includes delivery by Compuserve E-Mail.  There is an additional $3 shipping charge when registering via Internet.

4. Source Code Upgrade Version

This version of DataSorcerer IS supplied in Source Code form. It provides registered users of V1.1 of DataSorcerer with an upgrade to the Source Code version of DataSorcerer V2.0 at a reduced price.

The Compuserve SWREG Registration ID number for the Source Code Upgrade Version of DataSorcerer is 11121, the price of this version is $59.95 and includes delivery by Compuserve E-Mail.  There is an additional $3 shipping charge when registering via Internet.

Credit Card Orders

At the time of writing we are not providing direct purchase via credit card. This may change should demand for this service increase.


Other products by Steve Flynn

Other products by Steve Flynn

MegaPanel for Delphi

DBFilterCombo for Delphi

DBLookupText for Delphi

DBZipMemo for Delphi

Directory Sorter for Windows 95


Overview
DataSorcerer Overview

Overview

The DataSorcerer Component gives Delphi Database Programmers the much sought after feature of a Global Datasource: The main features of DataSorcerer are:

A single DataSorcerer and its Dataset can be accessed Globally from all form within an application.

Links between DataSorcerers on different Forms can be created at Design Time.

All data linkages are present at Design time to allow testing before compilation.

There is No Code required on any Form to make the the data available.

There is No Code required on any Form to keep the data synchronized.

All Data Aware controls on all forms are automatically kept synchronized.

Direct access is available to the underlying DataSet, no matter what type it is.

Abbreviated program syntax to access database fields.

All public TDataSource methods and properties are directly accessible.

All public TDataSet methods and properties are directly accessible.

All public TDBDataSet methods and properties are directly accessible.

All public TTable methods and properties are directly accessible.

All public TQuery methods and properties are directly accessible.

All public TStoredProc methods and properties are directly accessible.

The TTable Fields Editor is available from any linked DataSorcerer.

The TQuery/TStoredProc Params Editor is available from any linked DataSorcerer.

The Master Fields Designer is available from any linked DataSorcerer.

Full support for InfoPower Data Access components

The InfoPower Property Editors are available from any linked DataSorcerer.

Exception trapping of Database errors


RemoveTrap Procedure

See Also	Example

Applies to

TDataSorcerer

Declaration

procedure RemoveTrap(ErrCode: integer; ErrProc: TTrapProc);

Description

RemoveTrap removes an Exception event procedure previously added with the AddTrap procedure.

If you are defining Exception traps on Apprentice Forms then you should make use of the OnLinked Event since AddTrap should only be called after the Apprentice is linked to its Sorcerer.


Sample Program
The DataSorcerer Sample Program

The DataSorcerer Sample Program

A sample application is included in the distribution archive. This sample is based on the Animals sample program supplied with Delphi. To use the sample application you must first install DataSorcerer before opening the ANIMALS.DPR project file.

The sample application has very little additional code added to it. Only a few lines to show all the forms at the same time when the application is run and some procedures in UNIT2 to display the results of Database Exceptions. All Database linkages were created at Design Time using DataSorcerers. The sample is for the specific purpose of demonstrating the features of DataSorcerer.

The sample is supplied with a modified Paradox version of the demonstration ANIMALS database provided with Delphi. The modifications are solely for the purpose of demonstrating Exception trapping on Key Violation, Min/Max Range errors and Required Field errors. You will need to copy the ANIMALS database files to your DBDEMOS directory to allow the sample program to be used..

Please Note: The sample project displays a picture from the database. This picture uses the Delphi DBImage control. At the time of writing there is a bug in the standard version of the Delphi V1.x DBImage control that will not allow pictures copied from the clipboard to be saved in the database under some circumstances. This is a Delphi bug not a DataSorcerer bug. You will find various fixes for the bug (including one of my own) posted in the Delphi forum of Compuserve.

My fix for the Delphi V1.x DBImage control problem follows:

Locate the DBCTRLS.PAS file. This is in the \DELPHI\DOC directory or the \DELPHI\SOURCE\VCL directory if you purchased the VCL source. Make the following change to the TDBImage.PasteFromClipboard procedure, then recompile and Rebuild your component library. Make sure the the newly compiled version of the DBCTRLS.DCU file is in your \DELPHI\LIB directory before you do the Rebuild.

procedure TDBImage.PasteFromClipboard;

var

ClipBrdBmp: TBitmap;

begin

ClipBrdBmp := TBitmap.Create;

if Clipboard.HasFormat(CF_BITMAP) and FDataLink.Edit then

begin

ClipBrdBmp.Assign(Clipboard);

Picture.Assign(ClipBrdBmp);

end;

ClipBrdBmp.Free;

end;


Shareware Limitations

Shareware Limitations

The Shareware version of DataSorcerer is fully functional except that it will only operate while Delphi is running. There are no other limitations.

The registered version of DataSorcerer has this limitation removed.


Software License Agreement
DataSorcerer Software License Agreement

DataSorcerer Software License Agreement

Use of the Software

Steven M. Flynn (the "Author") grants you, the end user, a non-exclusive single-user license to use the supplied software program and all associated materials including Source Code where supplied (the "Software").  The Software and all Intellectual Property embodied in the Software always remains the property of the Author.  Your use of the Software indicates your acceptance in full of the terms and conditions of this agreement.

Copying the Software

You may make copies of the Software for backup or archival purposes only.  You may use the Software on one or more computers provided there is no possibility of it being used concurrently by more than one person.  A separate license is required for each concurrent user of the Software.

Distribution of the Shareware Version of the Software

The Shareware version of the Software, which is limited in functionality and does not include Source Code, may be distributed royalty free in any form providing that no charge is made for the Software itself. Only a nominal fee for media and/or copying services is allowed. All files that are supplied with the Shareware version that you have received must also be included.

Distribution of the Registered Version of the Software

The Licensed or Registered version of the Software may not be distributed in any form without prior written consent from the Author.  You are granted permission to include the Software in your own original works in its Compiled Form Only.  Specifically this means that you may not distribute the Source Code Files or the Delphi Library Files (DCU or OBJ files) without paying additional License Fees to the Author.  No further License Fee or Royalty is required for including the Software in your own original works in its Compiled form.

Derived Works

You may NOT use the Software to derive any works which are based in part or in full on the Software or portion of the Software..

Modified Versions of the Software

All updated, revised, modified or improved versions of the Software are also subject to the conditions of this license agreement and shall remain the property of the Author.

Termination of this Agreement

You may terminate this License Agreement at any time by destroying the Software along with all copies in any form.

Limited Warranty

The Software is distributed and licensed "AS IS".  The Author specifically disclaims all other warranties, express or implied, including but not limited to, implied warranties of merchantability and fitness for a particular purpose, with regard to the Software.

Damages

By using the Software you do so at your own risk. In no event shall the Author be responsible for any damages whatsoever (including but not limited to, damages for loss of business profits, business interruption, loss of business information, or any other pecuniary loss or any other real or consequential damages) arising out of the use or inability to use this product.

Liability

In the event of failure of the Software for any reason, the Author's sole liability shall be to refund the purchase price of the Software or to provide a corrected version of the Software, at the option of the Author.

Copyright

The Software and the Intellectual Property embodied in the Software shall always remain the property of the Author and is protected by Australian Copyright Law and International Treaty Provisions.

Agreement

Your use of the Software indicates your agreement with the above terms and conditions. If you do not agree with these terms and conditions then you should destroy all copies of the software and return the original copy of the software (where it has been supplied on diskette) within 14 days for a refund.

Consumer Rights

If any clause in the above Software License Agreement is in violation of your consumer rights under your local laws then that clause will be deemed to be excluded in your specific case without effect on the remainder of the agreement.


Software Version
Finding the DataSorcerer Software Version

Finding the DataSorcerer Software Version

To find out the version number of your DataSorcerer software just:

1.	In Design mode select any DataSorcerer component by Left Clicking on it.

2.	Now Right Click on the same DataSorcerer. This brings up the Component Editor Menu.

3.	Choose About DataSorcerer from the popup menu.


SorcererForm Property
DataSorcerer SorcererForm Property

Applies to

TDataSorcerer

Declaration

property SorcererForm: string;

Description

The SorcererForm string holds the name of the Form which contains the Sorcerer which is linked to a particular Apprentice.

This property applies only to Apprentices.


TAbility Type
DataSorcerer TAbility Type

Applies to

TDataSorcerer

Declaration

TAbility = (Sorcerer, Apprentice);

Description

TAbility defines the enumerated values for the DataSorcerer Ability property.


TDBDataset Properties
DataSorcerer DBDataSet Properties

See Also	See the Delphi Online Help for details of these Properties

  Run-time only

CheckOpen	DBHandle	SessionName

Database	DBLocale	UpdateMode

DatabaseName	DBSession


TDBLookupText
DBLookupText for Delphi

DBLookupText Component

The idea behind DBLookupText is simple.

Its a Label control that sources its text from a Database Field. The contents of this field is not actually displayed, but is used as a Lookup reference for a second Database. The result of the Lookup operation is used as the Text that is displayed in the Label.

DBLookupText is very useful for Display Only data. This data may have been entered into a Database using one of the Lookup components like DBLookupCombo of DBFilterCombo etc.

DBLookupText is free of charge to all registered DBFilterCombo users.


TDBZipMemo
DBZipMemo for Delphi

DBZipMemo Component

DBZipMemo is two components in one. In its inactive state it looks and works just like an ordinary DBMemo control. When you double click on the DBMemo control a window pops up complete with a larger Memo control to allow easier editing and viewing of the Memo details. The window is complete with Caption and Hint lines taken from the original DBMemo's Hint property. The window also has OK and Cancel buttons to allow you to accept or reject changes. When one of the buttons is pressed the window disappears and the focus returns to the original DBMemo control (or optionally to the next control in the Tab order). If the changes were accepted then the windows contents are copied to the original DBMemo control otherwise they are discarded.

DBZipMemo is free of charge to all registered DBFilterCombo users.


TDataSetType Type
DataSorcerer TDataSetType Type

Applies to

TDataSorcerer

Declaration

TDataSetType = (dtNone, dtTable, dtQuery, dtStoredProc, dtwwTable, dtwwQuery, dtwwQBE);

Description

TDataSetType defines the enumerated values of the DataSorcerer DataSetType property.

Note:

dtwwTable, dtwwQuery, dtwwQBE enumerated values are only available when InfoPower support is available.


TDataSorcerer Events
DataSorcerer Events

See Also

OnLink	OnUnLink

All other Events are inherited from the TDataSource component.

At Run-time you can add or remove Exception Events using the AddTrap and RemoveTrap procedures.


TDataSorcerer Methods
DataSorcerer Methods

See Also

DataSorcerer provides all the methods of its ancestor TDataSource component. Two additional methods for Exception Events are also available. Theses are the AddTrap and RemoveTrap methods.


TDataSorcerer Properties
DataSorcerer Properties

See Also

DataSorcerer provides all of the Properties of its ancestor TDataSource plus the following additional Properties.

  Run-time only      [image]  Delphi 2.0 only      [image]  Key Properties

Ability	EFieldDefValue	EMessage

ApprenticeForms	EFieldDisplayName	ENativeCode

BooleanField	EFieldMaxValue	ENativeMsg

CurrencyField	EFieldMinValue	ETableName

DataSet	EFieldName	EToken

DataSetType	EFieldNo	EUserErrMsg

DateTimeField	EFieldRequired	EUserName

EAlias	EFileName	Field

ECapability	EImageRow	FloatField

ECDRName	EIndexName	IntegerField

EDirName	EInternalLimit	SorcererForm

EDriveName	EKeyName	StringField

EField	ELineNumber	VariantField


TDataSource Events
DataSorcerer Inherited TDataSource Events

See Also	See the Delphi Online Help for details of these Events

 Key events

 	OnDataChange	 	OnStateChange	 	OnUpdateData


TDataSource Methods
DataSorcerer Inherited TDataSource Methods

See Also	See the Delphi Online Help for details of these Methods

 Key methods

Create	 	Edit

Destroy	Free


TDataSource Properties
DataSorcerer Inherited TDataSource Properties

See Also	See the Delphi Online Help for details of these Properties

 Run-time only          [image] Key properties

 	AutoEdit	Name	Tag

 	Dataset	 	Owner

 	Enabled	 	 	State


TQuery Events
DataSorcerer TQuery Events

See Also	See the Delphi Online Help for details of these Events

 Key events

 	AfterCancel	 	BeforeClose	 	OnEditError

 	AfterClose	 	BeforeDelete	 	OnFilterRecord

 	AfterDelete	 	BeforeEdit	 	OnNewRecord

 	AfterEdit	 	BeforeInsert	 	OnPostError

 	AfterInsert	 	BeforeOpen	 	OnServerYield

 	AfterOpen	 	BeforePost	 	OnUpdateError

 	AfterPost	 	OnCalcFields	 	OnUpdateRecord

 	BeforeCancel	 	OnDeleteError


TQuery Methods
DataSorcerer TQuery Methods

See Also	See the Delphi Online Help for details of these methods

 Key methods

 	ActiveBuffer	 	FetchAll	 	LockTable

 	Append	 	FieldByName	 	Lookup

 	AppendRecord	 	FindField	 	MoveBy

 	ApplyUpdates	 	FindFirst	Next

 	Cancel	 	FindLast	 	Open

 	CancelUpdates	 	FindNext	 	ParamByName

 	CheckBrowseMode	 	FindPrior	 	Post

 	CheckOpen	First	 	Prepare

 	ClearFields	Free	Prior

 	Close	 	FreeBookmark	 	Refresh

 	CommitUpdates	 	GetBookmark	 	RenameTable

 	ControlsDisabled	 	GetCurrentRecord	 	Resync

Create	 	GetFieldList	 	RevertRecord

 	CursorPosChanged	 	GetFieldNames	 	SetDetailFields

 	Delete	 	GotoBookmark	 	SetFields

Destroy	 	Insert	 	UnlockTable

DisableControls	 	InsertRecord	 	UnPrepare

 	Edit	 	IsLinkedTo	 	UpdateCursorPos

EnableControls	Last	 	UpdateRecord

 	ExecSQL	 	Locate	 	UpdateStatus


TQuery Properties
DataSorcerer TQuery Properties

See Also	See the Delphi Online Help for details of these Properties

 Run-time only          [image] Key properties

 	Active	 	 	FieldDefs	 	RecNo

 	AutoCalcFields	 	 	Fields	 	 	RecordCount

 	 	BOF	 	 	FieldValues	 	 	RecordSize

Bookmark	 	Filter	 	RequestLive

 	CachedUpdates	 	Filtered	RowsAffected

 	CanModify	 	FilterOptions	 	SessionName

Constrained	 	 	Found	 	SQL

 	 	Database	 	 	Handle	SQLBinary

 	DatabaseName	 	 	KeySize	 	 	State

 	DataSource	 	 	Local	 	 	StmtHandle

 	DBHandle	 	Locale	Tag

 	DBLocale	 	 	Modified	 	Text

 	DBSession	Name	 	UniDirectional

 	 	DefaultFields	 	Owner	 	UpdateMode

 	 	Designer	ParamCheck	 	 	UpdateObject

 	 	EOF	 	 	ParamCount	 	 	UpdateRecordTypes

 	 	ExpIndex	 	Params	 	 	UpdatesPending

 	 	FieldCount	 	 	Prepared


TStoredProc Events
DataSorcerer TStoredProc Events

See Also	See the Delphi Online Help for details of these Events

 Key events

 	OnDataChange	 	OnStateChange	 	OnUpdateData


TStoredProc Methods
DataSorcerer TStoredProc Methods

See Also	See the Delphi Online Help for details of these Methods

 Key methods

Create	 	Edit

Destroy	Free


TStoredProc Properties
DataSorcerer TStoredProc Properties

See Also	See the Delphi Online Help for details of these Properties

 Run-time only          [image] Key properties

 	AutoEdit	Name	Tag

 	Dataset	 	Owner

 	Enabled	 	 	State


TTable Events
DataSorcerer TTable Events

See Also	See the Delphi Online Help for details of these Events

 Key events

 	AfterCancel	 	BeforeClose	 	OnEditError

 	AfterClose	 	BeforeDelete	 	OnFilterRecord

 	AfterDelete	 	BeforeEdit	 	OnNewRecord

 	AfterEdit	 	BeforeInsert	 	OnPostError

 	AfterInsert	 	BeforeOpen	 	OnServerYield

 	AfterOpen	 	BeforePost	 	OnUpdateError

 	AfterPost	 	OnCalcFields	OnUpdateRecord

 	BeforeCancel	 	OnDeleteError


TTable Methods
DataSorcerer TTable Methods

See Also	See the Delphi Online Help for details of these Methods

 Key methods

 	ActiveBuffer	 	EditRangeEnd	 	IsLinkedTo

 	AddIndex	 	EditRangeStart	 	Last

 	ApplyRange	 	EmptyTable	 	Locate

 	ApplyUpdates	EnableControls	 	LockTable

 	Append	 	FetchAll	 	Lookup

 	AppendRecord	 	FieldByName	 	MoveBy

 	BatchMove	 	FindField	 	Next

 	Cancel	 	FindFirst	 	Open

 	CancelRange	 	FindKey	 	OpenIndexFile

 	CancelUpdates	 	FindLast	 	Post

 	CheckBrowseMode	 	FindNearest	 	Prior

 	CheckOpen	 	FindNext	 	Refresh

 	ClearFields	 	FindPrior	 	RenameTable

 	Close	First	 	Resync

 	CloseIndexFile	Free	 	RevertRecord

 	CommitUpdates	 	FreeBookmark	 	SetDetailFields

 	ControlsDisabled	 	GetBookmark	 	SetFields

Create	 	GetCurrentRecord	 	SetKey

 	CreateTable	 	GetFieldList	 	SetRange

 	CursorPosChanged	 	GetFieldNames	 	SetRangeEnd

 	Delete	 	GetIndexNames	 	SetRangeStart

 	DeleteIndex	 	GotoBookmark	 	UnlockTable

 	DeleteTable	 	GotoCurrent	 	UpdateCursorPos

Destroy	 	GotoKey	 	UpdateRecord

DisableControls	 	GotoNearest	 	UpdateStatus

 	Edit	 	Insert

 	EditKey	 	InsertRecord


TTable Properties
DataSorcerer TTable Properties

See Also	See the Delphi Online Help for details of these Properties

 Run-time only          [image] Key properties

 	Active	 	 	FieldDefs	 	MasterFields

 	AutoCalcFields	 	 	Fields	 	MasterSource

 	 	BOF	 	 	FieldValues	 	 	Modified

 	 	Bookmark	 	Filter	Name

 	CachedUpdates	 	Filtered	 	Owner

 	CanModify	 	FilterOptions	 	RecNo

 	 	Database	 	 	Found	 	 	RecordCount

 	DatabaseName	 	Handle	 	 	RecordSize

 	DataSource	 	 	IndexDefs	 	SessionName

 	DBHandle	 	 	IndexFieldCount	 	 	State

 	DBLocale	 	IndexFieldNames	 	TableName

 	DBSession	 	IndexFiles	 	TableType

 	 	DefaultFields	 	IndexName	Tag

 	 	Designer	 	 	IndexFields	 	UpdateMode

 	 	EOF	 	 	KeyExclusive	 	 	UpdateObject

 	Exclusive	 	 	KeyFieldCount	 	 	UpdateRecordTypes

 	 	ExpIndex	 	 	KeySize	 	 	UpdatesPending

 	 	FieldCount	 	Locale


TTrapProc Type
DataSorcerer TTrapProc Type

Applies to

TDataSorcerer

Declaration

TTrapProc = procedure(DataSorcerer: TDataSorcerer; ErrCode: integer) of object;

Description

TTrapProc is the Exception event procedure type for the DataSorcerer AddTrap procedure.


Technical support
DataSorcerer Technical support

Technical Support

We are always interested in your suggestions for improvements to our products. If you would like to contact us with your ides, or if you are experiencing any problems, please E-Mail us at one of the following addressed

Compuserve:	100351,2607.

Internet:	100351,2607@compuserve.com

Because we are located in Australia we have a time difference problem with the rest of the world and can therefore only provide technical support via E-Mail.

Since it is often difficult to describe and/or duplicate problem conditions, we may ask you to E-Mail us a program sample to allow us to investigate any reported problems.


The Global Village

See Also

The Global (DataSorcerer) Village

Many people have difficulty understanding where abouts in their application they should set certain DataSorcerer attributes.

The answer to this question is easy...        It Doesn't Matter Where You Set The Attributes.

If it helps, you can think of DataSorcerer attributes like this:

There is only one set of Properties for a linked set of Sorcerer and Apprentices.

There is only one set of Methods for a linked set of Sorcerer and Apprentices.

There is only one set of Events for a linked set of Sorcerer and Apprentices.

There is only one set of Exceptions for a linked set of Sorcerer and Apprentices.

The reason for this is that all attributes (except Properties that are set at design time to link Sorcerers and Apprentices) are common to any one set of linked Sorcerers and Apprentices, or at least the code is designed to make it look and work this way. This also includes Exception event procedures added or removed  with the AddTrap and RemoveTrap procedures.

This has the potential to become very confusing and difficult to maintain, as you can imagine. Its possible, for example, to have a different Exception trapped on each of several different forms and yet they all work no matter which "Form" generated the Exception. Its not the Form that generates the exception, it just seems that way. Its the DataSet that generates it and ALL linked Sorcerers and Apprentices use the SAME DataSet.

So, to make it easier to maintain and less confusing, my suggestion is to place any code that adds or removes Exception traps or changes properties on the Form containing the Sorcerer. This should make it easy to locate your code even if you have Sorcerers for different Tables etc scattered throughout your application. If you are defining Exception traps on Apprentice Forms then you should make use of the OnLinked Event since AddTrap should only be called after the Apprentice is linked to its Sorcerer.

Note:

No...   Its not possible to temporarily suspend the linkage of a particular Apprentice. The only way to achieve a similar result is to assign the Apprentice to a different DataSet or Sorcerer.


The Sorcerers Apprentice
The Sorcerer's Apprentice

See Also

The Sorcerer's Apprentice

DataSorcerer provides all the public properties and methods of the standard Delphi TDataSource, TTable, TQuery and TStoredProc components. It is beyond the scope of this document to provide detailed information on the properties and methods of the standard Delphi components. Instead these properties and methods will simply be listed to allow you to refer to the Delphi documentation and/or Help system for a detailed explanation.

Pedigree

DataSorcerer is a descendant of TDataSource.

Sorcerers and Apprentices

DataSorcerer uses the concept of a master and slaves. The master is called a Sorcerer and the slaves are called Apprentices. This only really effects you at Design Time when you need to set the linkages between DataSorcerers on different forms. At run time and for nearly all programming purposes all DataSorcerer components appear the same so far as access to the database information and other methods and/or properties is concerned.

The two important types of DataSorcerers are really only distinguished by the way in which they are set up, they are actually the same component. The two types are defined as follows:

SORCERER

A Sorcerer is a TDataSorcerer component that:

i) Resides on the same form as the DataSet that it uses.

ii) Gives the power of its DataSet to DataSorcerers on other Forms (Apprentices)

APPRENTICES

An Apprentice is a TDataSorcerer component that:

i) Does not reside on the same form as the DataSet it uses

ii) Receives the power of a DataSet from a DataSorcerer on another Form (Sorcerer)

This leaves a third unnamed category which is a DataSorcerer that resides on a form with the DataSet that it uses but does not give the power of its DataSet to others. This is exactly the behavior of the standard Delphi DataSource component and will not be given special consideration here, although you are free to use DataSorcerer in this way if you wish. If you find that you require a particular DataSet and DataSource only on one form then by all means use DataSorcerer for the job, this will save the additional overhead of compiling both DataSource and DataSorcerer components into your application. In other words try to make all the Datasource components in your application the same type either all TDataSource or all TDataSorcerer.

For the rest of this document DataSorcerer's will be referred to simply as Sorcerers or Apprentices.

NOTE: Apprentices must have the SAME NAME as the Sorcerer that they are linked to. If they do not have the same name then they WILL NOT BE LINKED.

This means that all DataSorcerers on any Form in your application which access the same Database information HAVE THE SAME NAME.

A brief word about Properties

DataSorcerer provides quite a large list of properties in the Object Inspector at Design Time compared to its DataSource ancestor. This is because all the properties available from the Sorcerer's DataSet are made available through the Sorcerer and any linked Apprentices. This includes any specialized Component Editors such as the Fields Editor etc. Since the DataSet may be a Table, a Query or a StoredProc it is obviously not possible to edit properties that are not available for the type of DataSet selected. For example if the DataSet is a Table, you can edit the SQL property but it will have no effect and the SQL statement will not be stored because the Table does not provide such a property. Depending on the property itself you may get a warning message that tells you that a particular property is only available for a specific type of DataSet. This also applies to the TwwTable, TwwQuery and TwwQBE components in the InfoPower version of DataSorcerer.

Why are these properties made available through a Sorcerer ?

The original form containing the Sorcerer and it's DataSet may not be visible or may be closed. These properties allow you to edit the characteristics of the DataSet from any linked Apprentice without being able to see the DataSet itself.

NOTE: Remember that all Apprentices that are linked to the same Sorcerer are editing the SAME set of properties. Changing the DataSet's properties from one Apprentice will change its properties for all other Apprentices linked to the same Sorcerer and the Sorcerer also.

Renaming Sorcerers

Remember how the Sorcerer and all its Apprentices must have the same name (you should by now). Well guess what...

If you edit the name of the Sorcerer then the names of all its linked Apprentices will change to match. You need to be aware of this if your code refers to an Apprentice by name. The name of the Apprentice is changed when the Sorcerer's name is changed, but the references to the Apprentice in your code are not.


Using Abbreviated Field Access Properties

See Also

Using Abbreviated Field Access Properties

The Abbreviated Field Access Properties provides access to the DataSet's fields using a shorthand notation. The following examples will clarify this:

DataSorcerer1.Field['FieldName'] := AString;

is exactly equivalent to

DataSorcerer1.DataSet.FieldByName('FieldName').AsString := AString;

and

AString := DataSorcerer1.Field['FieldName'];

is exactly equivalent to

AString := DataSorcerer1.DataSet.FieldByName('FieldName').AsString;

There are abbreviated access properties for all the individual field types supported by Delphi. These properties are declared as follows:

property Field[const Name: string]: string;

property StringField[const Name: string]: string;

property IntegerField[const Name: string]: integer;

property FloatField[const Name: string]: double;

property BooleanField[const Name: string]: boolean;

property DateTimeField[const Name: string]: TDateTime;

For Delphi 2.0 only

property CurrencyField[const Name: string]: Currency;

property VariantField[const Name: string]: Variant;

All of these abbreviated access properties use the syntax in the example above, the only difference is the Type of the property, ie; String, Integer, Double, Boolean, TDataTime, Currency or Variant.

The Field and StringField properties are identical, Field is only provided for compatibility with DataSorcerer V1.1.


Using DataSet Properties, Methods and Events

See Also

Using DataSet Properties, Methods and Events

DataSorcerer provides access to all the DataSet's public Methods, Properties and Events without referring directly to the DataSet. This means that you no longer have to remember if the method, property or event that you want to use belongs to the DataSource or the DataSet, now they all belong to the DataSorcerer.

To access the DataSet's methods or properties use the following general forms:

If you used

Variable := TypeCast(DataSourceName.DataSetName).Function(Arguments...);

replace it with

Variable := DataSorcererName.Function(Arguments...);

If you used

TypeCast(DataSourceName.DataSetName).Procedure(Arguments...);

replace it with

DataSorcererName.Procedure(Arguments...);

If you used

TypeCast(DataSourceName.DataSetName).Property := Variable;

replace it with

DataSorcererName.Property := Variable;

If you used

Variable := TypeCast(DataSourceName.DataSetName).Property;

replace it with

Variable := DataSorcererName.Property;

This holds true for ALL the Methods, Properties and Events of any of the DataSet types, including InfoPower components.

Remember the reference to the "DataSetName" can be eliminated as can the explicit casting of the DataSet to a particular type such as TTable or TStoredProc.