Subject Re: [firebird-support] Re: Implement maximum database size
Author Aage Johansen
btrumba wrote:
> Thanks for help.
> I'm now aware that psychical database file size does nothing to do
> with actual amount of user data stored into the database.
>
> Just one more question:
> Any tip on how to implement database limit restriction on user?
>
> Only solution I can think of is to place triggers on all tables, count
> all records in all tables, and then prevent user to insert/modify more
> data then he is allowed. But, this will be slow and not 100% accurate
> because of possible ongoing transactions...
>


It is possible to retrieve the PageSize and AllocatedPages. I don't
know how, but if you run IB_SQL and look at the "Characteristics"
pane after connecting to a database you can see these values. You
might consider refusing to insert new records after
PageSize*AllocatedPages exceeds some value, although this is pretty crude.
It is probably better to occasionally count the number of records in
a few "important" tables, and use this as the limiting criteria.

--
Aage J.