Subject | Re: [IBO] TIB_Connection & TIBODatabase and ReadOnly |
---|---|
Author | Helen Borrie |
Post date | 2003-10-13T23:36:38Z |
At 10:48 PM 13/10/2003 +0000, you wrote:
transaction; and, of course, even a read-only transaction is a transaction
and has to be maintained in the database accounting system (transaction
inventory pages).
You *can* make a database read-only. This is a physical setting you have
to make either with gifx or by connecting to a restored version of the
database that has been restored in read-only mode. Then Fb maintains the
transaction accounting in the cache only and never tries to write to the
TIP on disk. A database can't be both read-only and read-write.
And, no, a read-only database doesn't receive any physical I/O at
all. Generators don't fire on any step value except 0 and the RDB$DB_KEY
is stable. It would be impossible, in any event, if the r/o database were
being read from a CDRom.
If you need the db to be read-write sometimes and read-only other times,
then your solution is to take explicit control of every transaction,
including the default one. Set a CanWrite variable with sufficient scope,
e.g. a private or public property of the datamodule, a dataset, or whatever
you need, and read it for every transaction.
All that said, if you are using TIBODatabase according to the BDE model
(one and one only transaction) then setting its ReadOnly property true will
be equivalent to having a global CanWrite property always False, so you
wouldn't need it.
Helen
>A TIBODatabase has a ReadOnly property but a TIB_Connection does not.A connection can't be read only, since the connection itself starts a
>Any way to get a TIB_Connection be read only? I would prefer on the
>connection verses the transaction. (I need to set the read only
>property based on certain situations). And while I am asking, if a
>Connecion/Database is read only can I assume that FB will not change
>the date of the FB DB?
transaction; and, of course, even a read-only transaction is a transaction
and has to be maintained in the database accounting system (transaction
inventory pages).
You *can* make a database read-only. This is a physical setting you have
to make either with gifx or by connecting to a restored version of the
database that has been restored in read-only mode. Then Fb maintains the
transaction accounting in the cache only and never tries to write to the
TIP on disk. A database can't be both read-only and read-write.
And, no, a read-only database doesn't receive any physical I/O at
all. Generators don't fire on any step value except 0 and the RDB$DB_KEY
is stable. It would be impossible, in any event, if the r/o database were
being read from a CDRom.
If you need the db to be read-write sometimes and read-only other times,
then your solution is to take explicit control of every transaction,
including the default one. Set a CanWrite variable with sufficient scope,
e.g. a private or public property of the datamodule, a dataset, or whatever
you need, and read it for every transaction.
All that said, if you are using TIBODatabase according to the BDE model
(one and one only transaction) then setting its ReadOnly property true will
be equivalent to having a global CanWrite property always False, so you
wouldn't need it.
Helen