Subject Re: [IBO] Re: Philosophy of using IBObjects
Author Svein Erling Tysvær
Welcome to IBO, Materna!

In general it is recommended to have one field as the primary key, often a
meaningless field populated by a generator which the user doesn't even know
exists.

Stored procedures are fine, but my guess is that you will benefit far more
from trying to get away from TIBOTable and into TIB_Query. IB is a
client/server database and not a desktop database like dBase, and you
really ought to start thinking in terms of datasets rather than tables.
With dBase you generally show all fields of all records to the user, with a
c/s database you should only show a selected set of fields for a selected
set of records. IB is a great c/s database, but a lousy replacement for
dBase if you don't change your way of thinking.

I suggest you add another (integer) field and use this new field as the
primary key. Use this new field for linking to other tables. Then set your
symbol and number combination to a unique key rather than a primary key.
When you want to insert a new value, use a TIB_Cursor with SQL:
select max(<number>)
from <table>
where <symbol> = :symbol
set the parameter, open the cursor and read the value, close the cursor and
then start your incrementing loop until your insertion succeeds (that is,
if it is really neccessary that it is a sequence).

Questions specifically regarding ibobjects belongs to this group. General
questions about IB - like this question about sequence numbers - is more
suitable for ib-support@yahoogroups.com.

Good luck in getting to grips with client/server technology and IBO,
Set