I suggest one small addition to databases.conf in FB4 - aliases for 
directories.

Existing method to set aliases in a form:
alias = file
{
     Key1=ValueA
     Key2=ValueB
...
}
has serious disadvantage - it's hard to provide and support 
configuration for a large set of databases that should have same 
configuration, also it's impossible to configure something for an 
unknown in advance, able to grow set of databases (for example when new 
databases in that set may be sometimes created by client application). 
This problem can be solved adding aliases for directories. Directory 
alias has directory separator symbol in the end of the name, like this:
group/ = /path/to/databases
{
     Key1=ValueX
     Key2=ValueY
...
}
When client tries to attach to database with a name starting with group/ 
(CONNECT 'group/some.fdb';) name will be expanded to 
/path/to/databases/some.fdb. And any database in group/ will have same 
per-database configuration values including a case when someone wants to 
CREATE DATABASE 'group/newdb.fdb'.

Backward compatibility.
If someone has in databases.conf alias looking like directory alias
alias/ = /some/db.fdb
we may still resolve it in old manner - expand 'alias/' into 
'/some/db.fdb'. If such file exists and it's not a directory attach will 
succeed. An attempt to use alias in invalid way will in any case cause 
an error "Is a directory"/"Not a directory" depending upon what was 
attempted.
Certainly first of all passed from client db_name is checked as file 
alias and only after it as directory alias, i.e. if in addition to
group/ = /path/to/databases
we have file alias
group/db1.fdb = /other/place.fdb
or even
group/db1.fdb = /path/to/databases/db1.fdb
but with another configuration it will be used if user connects to 
'group/db1.fdb'.

Implementation.
Requires modifications in single function expandDatabaseName(), i.e. 
should not delay FB4 release.



------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to