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

user-friendly DPB-string in new api [CORE4716] #5023

Open
firebird-automations opened this issue Mar 21, 2015 · 6 comments
Open

user-friendly DPB-string in new api [CORE4716] #5023

firebird-automations opened this issue Mar 21, 2015 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Nick (nick)

Votes: 2

Now DPB looks like this: #⁠1'?'#⁠1#⁠3'0'#⁠7'WIN1251'#⁠$1C#⁠6'SYSDBA'#⁠$1D#⁠9'masterkey' (in Delphi).
It is not so easy to generate it correctly.
Something like 'ConnectionSqlDialect=[3], ConnectionCharSet=[WIN1251], UserName=[SYSDBA], Password=[masterkey]' seems more friendly.

@firebird-automations
Copy link
Collaborator Author

Commented by: @aafemt

Should it be case-sensitive?
Comma-separated, zero-separated or semicolon separated?
Why use square braces instead of ODBCstandard braces?
Encoding? wchar_t?..
How to handle mistyped/unknown parameter names?

@firebird-automations
Copy link
Collaborator Author

Commented by: Doug Chamberlin (greymont)

Please pick an established standard for this syntax, such as JSON, rather than using something new! That would answer all the questions from Dimitry, I think.

Also, avoid XML as the point is to make the options more readable.

@firebird-automations
Copy link
Collaborator Author

Commented by: @aafemt

Is ODBC standard established enough?..

@firebird-automations
Copy link
Collaborator Author

Commented by: Nick (nick)

I think...
>Should it be case-sensitive?
as in DPB

>Comma-separated, zero-separated or semicolon separated?
something human-printable and human-readable

>Why use square braces instead of ODBCstandard braces?
symbols ' and " are used for strings in many languages.
Now I think it will be useful if developer can use any of them, and maybe square braces too.
In C#⁠: string dpb = "ConnectionSqlDialect='3', ConnectionCharSet='WIN1251', UserName='SYSDBA', Password='masterkey'";
In Delphi: DPB: string = 'ConnectionSqlDialect="3", ConnectionCharSet="WIN1251", UserName="SYSDBA", Password="masterkey"';

>Encoding? wchar_t?..
binary, with utf-8 encoded values if needed (username, path to database, etc. ), with doubling quote symbol if it is in param value (like UserName='it''s user').

>How to handle mistyped/unknown parameter names?
with smart skiping and error if parameter does not exists and not defined in skipped list for current version.
something like this:

with error for NoDbTriggers and ProcessName params for FB < 2.1 (they not exists there):
'EngineParams(ConnectionSqlDialect="3", ConnectionCharSet="WIN1251", UserName="SYSDBA", Password="masterkey", NoDbTriggers, ProcessName="D:\App.exe")'

with skip NoDbTriggers and ProcessName for FB < 2.1, and skipping SomeFB3Param for FB3:
'EngineParams(ConnectionSqlDialect="3", ConnectionCharSet="WIN1251", UserName="SYSDBA", Password="masterkey", NoDbTriggers, ProcessName="D:\App.exe", SomeFB3Param="ParamValue" ,SkipParamsForVersionsLowerThan("2.1.0")="NoDbTriggers, ProcessName"), SkipParamsForVersionsLowerThan("3")="SomeFB3Param")'

and with plugin params:
'EngineParams(ConnectionSqlDialect="3", ConnectionCharSet="WIN1251", UserName="SYSDBA", Password="masterkey"), PluginParams(PluginName="DS_Replication", Timeout="30"), PluginParams(PluginName="SmartLogging", LogLevel="12")'

with skip:
'EngineParams(ConnectionSqlDialect="3", ConnectionCharSet="WIN1251", UserName="SYSDBA", Password="masterkey"), PluginParams(PluginName="DS_Replication", Timeout="30"), PluginParams(PluginName="SmartLogging", LogLevel="12", SkipParamsForVersionsLowerThan("0.1")="LogLevel")'

@firebird-automations
Copy link
Collaborator Author

Commented by: Nick (nick)

JSON is good too.
{
"Engine": {
"ConnectionSqlDialect": 3,
"ConnectionCharSet": "WIN1251",
"UserName": "SYSDBA",
"Password": "masterkey",
"VersionParams": {
"2.1": {
"NoDbTriggers": True,
"ProcessName": "D:\App.exe"
},
"3": {
"SomeFB3Param": "ParamValue"
}
}
},
"Plugin": {
"Name": "DS_Replication",
"Timeout": 30
},
"Plugin": {
"Name": "SmartLogging",
"PluginVersionParams": {
"0.1": {
"LogLevel": 12
}
}
}
}

@firebird-automations
Copy link
Collaborator Author

Commented by: PizzaProgram Ltd. (szakilaci)

While this seems to be a great feature at first sight, please consider following aspects too:
1.) SPEED:
- it is obvious that parsing a JSON gives much more overhead than analysing a simple #⁠1 char
- The ideal DB connection is, if you: <Connect><do things><Disconnect> ... as quickly as possible.
- param-parsing + encrypting + compressing should happen at the client side BEFORE a connection attempt is made

2.) Encryption / safety / password protection:
- it is very hard to protect something encrypted, if there are always standard keywords at standard places.
(Think about how they decrypted the enigma machine ... )
Think about if YOUR personal data would be hacked from a DB.

3.) Separating:
- maybe if there would be a feature to send more specific (JSON formed) parameters AFTER a connection has been established with minimum params.

4.) Enhancements:
- it would be nice to be able to disable showing DB-PATHs in the 'firebird.log' file.
(Currently you can easily find a database hidden on a PC or server by simply looking at this log file and search for errors when connection broke. It reveals the full path. :(( )
- or turn OFF logging completely during a specific connection.
- overwriting connection/command/idle timeouts (See: CORE985)

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