Page 1 of 1
Programmatic access to list of specific options
Posted: Tue 16 Aug 2011 07:21
by cbc700
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.
Posted: Tue 16 Aug 2011 10:04
by AlexP
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)]));
Posted: Mon 22 Aug 2011 16:23
by invent
Hello AlexP.
please update the CHM documentation, because the Topic "TUniProvider Members" is empty.
Thanks and kind regards,
Gerd Brinkmann
invent GmbH
Posted: Tue 23 Aug 2011 12:24
by AndreyZ
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.
Posted: Wed 24 Aug 2011 11:53
by invent
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
Posted: Fri 26 Aug 2011 15:19
by AndreyZ
This is internal functionality of UniDAC and for the time being we don't plan to document it.
Re: Programmatic access to list of specific options
Posted: Fri 14 Dec 2012 13:35
by nacTyx
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.
Re: Programmatic access to list of specific options
Posted: Mon 17 Dec 2012 11:15
by AlexP
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']);
Re: Programmatic access to list of specific options
Posted: Wed 20 Feb 2013 11:53
by jota
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.
Re: Programmatic access to list of specific options
Posted: Wed 20 Feb 2013 12:58
by AlexP
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;