TUniConnection: Can I define my own Specific Options?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
invent
Posts: 92
Joined: Tue 16 Jun 2009 10:59
Location: Bielefeld, Germany

TUniConnection: Can I define my own Specific Options?

Post by invent » Tue 29 Nov 2011 23:11

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 30 Nov 2011 08:41

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.

invent
Posts: 92
Joined: Tue 16 Jun 2009 10:59
Location: Bielefeld, Germany

Post by invent » Wed 30 Nov 2011 09:20

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 30 Nov 2011 10:05

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.

invent
Posts: 92
Joined: Tue 16 Jun 2009 10:59
Location: Bielefeld, Germany

Post by invent » Wed 30 Nov 2011 10:34

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 30 Nov 2011 12:17

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.

invent
Posts: 92
Joined: Tue 16 Jun 2009 10:59
Location: Bielefeld, Germany

Post by invent » Wed 30 Nov 2011 12:37

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Fri 02 Dec 2011 15:33

Hello,

If you have any other questions, feel free to contact us.

Post Reply