Page 1 of 1
TUniConnection: Can I define my own Specific Options?
Posted: Tue 29 Nov 2011 23:11
by invent
Hi,
in the last weeks I have some problems with UniDAC and MS Sql-Server. I cannot describe them because there are different errors on different days. So I want to debug my software with code. My idea is to use the TUniConnection.SpecificOptions.
Until today I use them like this:
Code: Select all
MyConnection.SpecificOptions.Add ('Oracle.Direct=True');
or
Code: Select all
MyConnection.SpecificOptions.Add ('SQL Server.Language=German');
My Question is: Can I define my own options? For example:
Code: Select all
MyConnection.SpecificOptions.Add ('MyOptions.DebugSQL=true');
Can I use something like that or will TUniConnection not work?
Thanks for any information and kind regards,
Gerd Brinkmann
invent GmbH
Posted: Wed 30 Nov 2011 08:41
by AlexP
Hello,
If you have Source code Edition of UniDAC, you can implement the behaviour you need in a way similar to SpecificOptions or add your suggestion at our UserVoice page:
http://devart.uservoice.com/forums/1046 ... 939-unidac
If enough users vote for this suggestion, it will be implemented in one of the future UniDAC versions.
Posted: Wed 30 Nov 2011 09:20
by invent
Hello AlexP,
sorry, but it's another example for the very small support by Devart. Why is that an answer to my question? I don't want to change TUniConnection.
Okay, I will try it by myself.
Kind regards,
Gerd Brinkmann
invent GmbH
Posted: Wed 30 Nov 2011 10:05
by AlexP
Hello,
To add any specific option, you need to add a new option and methods that implement the behaviour of this option into the source code. If you give a more detailed description of the behaviour you need, we will try to help you implement this feature in UniDAC.
Posted: Wed 30 Nov 2011 10:34
by invent
Hello,
again, I don't ask you to change TUniConnection. I only want to use the existing specific options to store some more informations. And I'm not sure what happens in this case.
For example I add an unknown option to TUniConnection:
Code: Select all
MyConnection.SpecificOptions.Add ('MyOptions.Logfile=c:\Test.log');
Then I use this information in TUniQuery:
Code: Select all
MyUniQuery.SQL.Clear;
MyUniQuery.SQL.Add ('select * from emp');
try
MyUniQuery.Open;
except
for i := 0 to MyUniQuery.Connection.SpecificOptions.Count - 1 do
begin
if Pos ('MyOptions.Logfile', MyUniQuery.Connection.SpecificOptions [i]) > 1) then ...
end;
end;
I made this and it works good with InterBase. No errors, no exception, working connection.
But then I read in the documentation for TUniConnection.SpecificOptions:
"If an option name is not recognized, an exception is raised and connection is not established."
I only ask you to take a look in the source code of TUniConnection and tell me what really happens when there is an unkown specific option.
Kind regards,
Gerd Brinkmann
invent GmbH
Posted: Wed 30 Nov 2011 12:17
by AlexP
Hello,
The old behaviour is described in the help (we will correct this description). In the current versions you can specify specific options that don't exist, and this will not result in an error.
Posted: Wed 30 Nov 2011 12:37
by invent
Hello,
that is fine. So I have a good way to debug my work.
Thank you very much for your answer.
Kind regards,
Gerd Brinkmann
invent GmbH
Posted: Fri 02 Dec 2011 15:33
by AlexP
Hello,
If you have any other questions, feel free to contact us.