Issue Details (XML | Word | Printable)

Key: CORE-5444
Type: Improvement Improvement
Status: Open Open
Priority: Trivial Trivial
Assignee: Unassigned
Reporter: Konstantin Kuzvesov
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Use -database isql parameter in create database statement

Created: 10/Jan/17 07:01 AM   Updated: 11/Jan/17 01:00 PM
Component/s: ISQL
Affects Version/s: 2.5.6
Fix Version/s: None

Environment: N/A

QA Status: No test


 Description  « Hide
Now 'create database' ddl statement has the only required parameter - the specification of primary database file, while many other database creation parameters can be specified using interactive sql command line switches.

I suggest to use value of '-database' isql switch in 'create database' statement, this will reduce 'create database ...' statement in create database scripts to just 'create database;' and simplify database creation sql scripts.

To explain a bit why I made this suggestion: at this time the database creation script of an application being installed must contain database connection parameters - i.e. server, port(?), database alias - and thus the script must be either modified or created for each system the application is being installed into, or database must be created manually. I want the database creation script to stay the same for each system it is being applied to, so I want to specify database connection parameters outside of the script (at first I event took '-database' switch as the switch that allows to do what I want, because it is described as 'database name to put in script creation' in isql help).

Now:
isql-fb < create_database.sql

create_database.sql:
create database "host/port:alias" user 'sysdba' -password 'masterkey' page_size=4096 default character set utf8 collation unicode_ci_ai;
<many more other statements creating domains, tables, triggers, etc...>

In the possible future:
isql-fb -database "host/port:alias" -user 'database-creator-account' -password 'database-creator-password' < create_database.sql

create_database.sql:
create database page_size=4096 default character set utf8 collation unicode_ci_ai;
<many more other statements creating domains, tables, triggers, etc...>

I think, since any application stores database connection parameters in its configuration, the better way is to provide these parameters to database tools called rather than inject these parameters into sql scripts.

I understand that the scheme I suggest doesn't allow to specify more than the primary database file, but I think that in most cases a database consists of the only file.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dmitry Yemanov added a comment - 10/Jan/17 08:31 AM
CREATE DATABASE is not a ISQL specific command, it's a common DSQL command that can be executed via API. How is it gonna to work in this case?

Konstantin Kuzvesov added a comment - 11/Jan/17 01:00 PM
In this case ISQL can complete the statement with missing database primary file specification using the specification given in the isql command line switch, in the same manner it goes with user name, and password, and, probably, with page size (I don't know what actually does 'pagelength' isql command line switch).