Programmatic access to list of specific options
Programmatic access to list of specific options
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.
Hello,
You can use the following code to get the SpecificOptions list in run-time:
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)]));-
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.
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
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
Re: Programmatic access to list of specific options
Dear AlexP,
Any example will help me.
You code show only Default value. Other question: how to get current value of SpecificOption?You can use the following code to get the SpecificOptions list in run-time:
Any example will help me.
Re: Programmatic access to list of specific options
Hello,
You can retrieve the values of all the edited options in the loop
or specify the option name explicitly
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сodeCode: Select all
ShowMessage(UniConnection1.SpecificOptions.Values['UseUniCode']);Re: Programmatic access to list of specific options
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.
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
Hello,
You can retrieve this option value using the following code:
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;