Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use -database isql parameter in create database statement [CORE5444] #5715

Open
firebird-automations opened this issue Jan 10, 2017 · 2 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Konstantin Kuzvesov (kuzvesov)

Votes: 1

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.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

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?

@firebird-automations
Copy link
Collaborator Author

Commented by: Konstantin Kuzvesov (kuzvesov)

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant