Programmatic access to list of specific options

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
cbc700
Posts: 46
Joined: Fri 03 Aug 2007 17:25

Programmatic access to list of specific options

Post by cbc700 » Tue 16 Aug 2011 07:21

Is it possible to get the list of SpecificOptions for a given provider? I've looked for such but can't seem to find it. Hoping there is a way to do this. Thanks.

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

Post by AlexP » Tue 16 Aug 2011 10:04

Hello,

You can use the following code to get the SpecificOptions list in run-time:

Code: Select all

var
  OptionsList: TOptionsList;
  i: integer;
begin
  OptionsList:= TUniProvider(UniProviders.GetProvider(UniConnection1.ProviderName)).GetConnectionOptions;
  for i:= 0 to  OptionsList.Count - 1 do
    ShowMessage(Format('Option Name = %s %s Default Options Value = %s',[OptionsList[i].OptionName, #13,VarToStr(OptionsList[i].GetDefaultValue)]));

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

Post by invent » Mon 22 Aug 2011 16:23

Hello AlexP.

please update the CHM documentation, because the Topic "TUniProvider Members" is empty.

Thanks and kind regards,
Gerd Brinkmann
invent GmbH

AndreyZ

Post by AndreyZ » Tue 23 Aug 2011 12:24

You can find the description of provider specific options in the Provider-Specific Notes subsection of the UniDAC documentation. Provider specific options are described in the corresponding topic in this subsection. For example, you can find SQL Server specific options in the "Using UniDAC with SQL Server" topic.

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

Post by invent » Wed 24 Aug 2011 11:53

Hello AndreyZ,

I'm sorry but my english is not so good. Sometimes I think that you don't unsterstand what I mean. So I have to try it again:

- I don't need information about specific options. I use these without problems.

- But when reading this I see that there is a function called "TUniProvider(...).GetConnectionOptions" and I want to learn more about the methods from TUniProvider. But I found nothing in the Help-File. The topic there is empty.

Kind regards,
Gerd Brinkmann
invent GmbH

AndreyZ

Post by AndreyZ » Fri 26 Aug 2011 15:19

This is internal functionality of UniDAC and for the time being we don't plan to document it.

nacTyx
Posts: 11
Joined: Wed 12 Dec 2012 19:19

Re: Programmatic access to list of specific options

Post by nacTyx » Fri 14 Dec 2012 13:35

Dear AlexP,
You can use the following code to get the SpecificOptions list in run-time:
You code show only Default value. Other question: how to get current value of SpecificOption?
Any example will help me.

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

Re: Programmatic access to list of specific options

Post by AlexP » Mon 17 Dec 2012 11:15

Hello,

You can retrieve the values of all the edited options in the loop

Code: Select all

UniConnection1.SpecificOptions.Values['UseUniсode'] := 'True';
  for i:= 0 to UniConnection1.SpecificOptions.Count - 1 do
   ShowMessage(UniConnection1.SpecificOptions[i]); //only the edited option will be displayed UseUniсode
or specify the option name explicitly

Code: Select all

ShowMessage(UniConnection1.SpecificOptions.Values['UseUniCode']);

jota
Posts: 34
Joined: Tue 22 Nov 2011 19:21

Re: Programmatic access to list of specific options

Post by jota » Wed 20 Feb 2013 11:53

Hi all

Can i also retrieve possible values ​​of a given 'SpecificOptions'?.

For example the 'EncryptionAlgorithm'; can i retrieve the values ​​'leTripleDES, leBlowFish, AES128,...'

Thank in advance.

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

Re: Programmatic access to list of specific options

Post by AlexP » Wed 20 Feb 2013 12:58

Hello,

You can retrieve this option value using the following code:

Code: Select all

var
  lst: TStringList;
  i: integer;
begin
  lst := TStringList.Create;
  try
    for i := 0 to TUniProvider(UniProviders.GetProvider('SQLite')).GetConnectionOptions.Count - 1 do
      if TUniProvider(UniProviders.GetProvider('SQLite')).GetConnectionOptions[i].OptionName = 'EncryptionAlgorithm' then
      begin
        TUniProvider(UniProviders.GetProvider('SQLite')).GetConnectionOptions[i].GetValuesList(lst);
        break;
      end;
    for i := 0 to lst.Count - 1 do
      ShowMessage(lst[i]);
  finally
    lst.Free;
  end;
end;

Post Reply