Copyright: Copyright 1995 Tomasz Stanczak


Introduction
RtDbIniFile Ver. 1.02

Copyright 1995 Tomasz Stanczak

Compuserve: 100735,3273

Every customer wants something different, even if your code is as general as you can. This truth is nothing new, its just a principle I learned in the last years, it doesnt wonder me, it doesnt make me angry any more. I know I have to build my programms with as many parameters as I can. Well, it works, but if I let my user input all of the parameters needed every time he enters the programm hes going to hate me. So I make configuration files. With plain DOS I used to work with DBF files because of my Clipper background. In Windows we have INI files. There is only one problem with INI files - everybody can change it, put garbage in or delete it. If you come with an application into bigger companies they certainly will ask you about security of you data. Well, TRtDbIniFile does all TIniFile can do with INI files with the same methods but it saves all this in database you are connected to, say Oracle, Sybase and the like. So you configuration data can be so secure as you database backend. If I needed to I could have used my old DBF files also.

TRtDbIniFile

Registration

Licence

Warranty

Support

Technical Notes

Revision History


TRtDbIniFile

Properties	Methods	Example

Aktually all of the methods are just the same as those of TIniFile. You can use them in the same manner, and the effects should be the same. On big difference is that it is a component that is placed on your component palette, so that you can use it in the Form Designer. To get it to work you have to set some of its properties. First of all Table property defines where you data should go. If doesnt need to exist - it will be created if needed. Then with SectionField, EntryField and ValueField you can change field names for RtDbIniFile Table, where SectionField and EntryField comprise its primary key. SectionLen, EntryLen and ValueLen let you change default field length in the case that your database backend doesnt support default values. At the end OnAccessClose and OnNewCreate decide what should happen after Table has been accessed or the particular entry doesnt exist.


BoolValues

Declaration

property BoolValues: TStringList;

Description

This editable string list contains Boolean string representations to be used by ReadBool, and WriteBool methods. Every line should contain one value for True and one for False separated with a semicolon. For example this is the default list:

1;0

on;off

true;false

yes;no


OnAccessClose

Declaration

property OnAccessClose: Boolean;

Description

By default after every access the INI table will be closed. This is to make sure that changes are written into database. To speed things up you can set thos property to false, but then you have to close the table yourself.


OnNewCreate

Declaration

property OnNewCreate: Boolean;

Description

Like Windows INI files TRtDbIniFile writes data into INI table with Write methods by default. If you know your options that should go there and want to have all of them saved the very first time one will be accessed this property makes also Read methods save options, if they are not present, with default values.


EntryField

See Also

Declaration

property EntryField: string; default FENTRY

Description

This property names database field for option name.


EntryLen

Declaration

property EntryLen: integer; default 64

Description

This is the length of the EntryField. Since the EntryField is a part of the primary key definition you should be careful not to overrun maximal length of an index key definition.


SectionField

See Also

Declaration

property SectionField: string; default FSECTION

Description

This property names database field for section name.


SectionLen

Declaration

property SectionLen: integer; default 64

Description

This is the length of the SectionField. Since the SectionField is a part of the primary key definition you should be careful not to overrun maximal length of an index key definition.


Table

Declaration

property Table: TTable;

Description

This is your database table, where all the options should be saved. If it doesnt exist it will be created.


ValueField

See Also

Declaration

property ValueField: string; default FVALUE

Description

This property names database field for options values.


ValueLen

Declaration

property ValueLen: integer; default 254;

Description

This is the length of the ValueField. It musnt be bigger then the maximal length for CHAR type on you database system.


BoolToString

Declaration

function BoolToString(const Value: Boolean; const Pattern: string): string;

Description

This public method returns string representation of a Boolean value based on BoolValues property contents and Pattern value, for example given that following line exists in BoolValues:

on;off

and Pattern=off

BoolToString(True,off)

returns on.


StringToBool

Declaration

function StringToBool(const Value: string): Boolean;

Description

This public method returns boolean value of a string based on BoolValues property contents, for example given that following line exists in BoolValues:

on;off

StringToBool(off)

returns False.


INI File Definition

Standard Windows INI file has following structure:

[Section]

Entry = Value

In the INI table all properties holding field names are called similiar: SectionField, EntryField and ValueField, where SectionField and EntryField are in the primary index definition. It means that you have to know both of them on order to get an options value.


INI Table Create Statement

SQL Statement used to create INI table is as follows:

CREATE TABLE 	<Table.TableName>

(<SectionField> 	CHAR (<SectionLen>),

<EntryField>	CHAR (<EntryLen>),

<ValueField>	CHAR (<ValueLen>),

PRIMARY KEY 	(<SectionField>,<EntryField>))

where all <...> should be substiuted with actual properties values.


Registration

Product	Price	s&h
RtDbIniFile	$10 (15 DM)	2$ (3 DM)
RtControls	$39 (60 DM)	2$ (3 DM)

Only following payment methods will be accepted:

Compuserve: GO SWREG

ID# 7194 RtDbIniFile alone

ID# 7197 RtControls

Checks: Only checks drawn on a US bank valued in US$ or drawn on a German bank and valued in DM will be accepted. The checks should be made payable to Tomasz Stanczak. Please let us time after sending check, we cannot send you our product before the money is transferred.

Please fill in the Order Form and send with a payment to:

Tomasz Stanczak

Hardenbergstr. 8

31275 Lehrte

Germany

Credit Card Orders: You can order with MC, Visa, Amex, or Discover from Public (software) Library by calling 800-2424-PsL or 713-524-6394 or by FAX to 713-524-6398 or by CIS Email to 71355,470. You can also mail credit card orders to PsL at P.O.Box 35705, Houston, TX 77235-5705.

THE ABOVE NUMBERS ARE FOR CREDIT CARD ORDERS ONLY.

THE AUTHOR OF THIS PROGRAM CANNOT BE REACHED AT THESE NUMBERS.

Any questions about the status of the shipment of the order, refunds, registration options, product details, technical support, volume discounts, dealer pricing, site licenses, non-credit card orders, etc, must be directed to Tomasz Stanczak:

CIS: 	100735,3273

Internet:	100735.3273@compuserve.com

WWW:	http://ourworld.compuserve.com/homepages/tomasz

To order please specify Item# 14429, RtControls Delphi VCL Pack, price $39 plus s&h $2 (e-mail) or $4 (Europe) or $6 overseas.

To insure that you get the latest version, PsL will notify us the day of your order and we will ship the product directly to you.

Shipping:

Currently only e-mail shipping is supported, so please always state your e-mail address!. In the future post shipping including printed documentation will be possible (no promise!).

Registered users will receive components full source code. Contact the author for multi-user discounts and site licenses.


Order Form

Name (block

letters please):	______________________________________________________

Company Name:	______________________________________________________

Street Address:	______________________________________________________

______________________________________________________

City, State,

Zip Code:	______________________________________________________

Country:	______________________________________________________

Phone Number:	______________________________________________________

E-Mail Address:	______________________________________________________

Product Name	Quantity	Price

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

Shipping__________________________________________________________

Total Fee_________________________________________________________


Technical Notes

The shareware version of this component runs only if Delphi will be found in memory.


Licence

Program and documentation Copyright 1995 Tomasz Stanczak (RiT).  Source code and design time use licensed for a single registered developer. Unlimited royalty-free distribution permitted as part of an EXE file, provided that internal copyright notice is not altered or removed.

Non-registered users may use the software to test it without any time frame, as long as they use the shareware version of RtDbIniFile. A limited license is granted to copy and distribute shareware version of RtDbIniFile only for the trial use of others.


Warranty

LIMITED WARRANTY

EXCEPT AS PROVIDED ABOVE, AUTHOR DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE PRODUCT.  SHOULD THE PROGRAM PROVE DEFECTIVE, THE PURCHASER ASSUMES THE RISK OF PAYING THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION AND ANY INCIDENTAL OR CONSEQUENTIAL DAMAGES.  IN NO EVENT WILL AUTHOR BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION AND THE LIKE) ARISING OUT OF THE USE OR THE INABILITY TO USE THIS PRODUCT EVEN IF AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


Support

Support is available from the author via Compuserve Mail to 100735,3273 , Internet Mail to 100735.3273@compuserve.com or http://ourworld.compuserve.com/homepages/tomasz. Currently there is no postal, telephone, or fax support. All support is on a "best effort" basis, and no promise is made that all questions can be answered, problems solved, features added nor bugs exterminated.


Revision History

1.02	11.12.95	a more general solution then above was proposed by Jan Strube (100333,2744): if TableName contains DOS file separator characters like '.' or '\' then it will be enclosed in quotation-marks.
1.01	27.11.95	If a TTable with an extension .DB in TableName was used as IniFile storage and this table hasnt existed physically before first access, than an invalid SQL was used to create it.
1.00	19.08.95	this is the intial version.


Properties

OnAccessClose	EntryLen	Table
OnNewCreate	SectionField	ValueField
EntryField	SectionLen	ValueLen


Methods

Create	ReadSectionValues	WriteBool
Destroy	ReadBool	WriteInteger
EraseSection	ReadInteger	WriteString
ReadSection	ReadString


Example

Ini := TRtDbIniFile.Create(self);

{lets assume that we saved contents of WIN.INI in this table}

Ini.Table := WinIniTable;

{now we read the character for decimal separator. In reality we dont need it, Delphi has done it already}

DecimalSeparator :=  INI.ReadBool(intl,sThousend,,);

Ini.Free;


SeeAlso

INI File

INI Table