Save settings to the database as in an *.ini file or in registry
Many applications use TiniFile or TRegistry for saving their settings. However sometimes one user can work on several workstations with his login and password. He wants to have the same settings on all of his workplaces, and that settings, saved on one computer, were available on other ones.
To implement this feature we may add classes or components with interface similar to TiniFile or TRegistry that save data not on the local computer, but in a database.
-
Abdollah Nouri commented
I save ini settings in database blob field. it is easy
ini: TMemIniFile;
sl: TStringList;
st: TMemoryStream;st := TMemoryStream.Create;
sl := TStringList.Create;ini.WriteString('Section','indent','value');
ini.GetStrings(sl);
sl.SaveToStream(st);qry.ParamByName('ini_content').LoadFromStream(st,ftBlob);
qry.Exeute;You can create simple function and use it.
-
Lithium™ commented
It's extremely fine thing. I vote 3 :)
And I would like to add:
One user can work both at several workstations and in several databases (as a rule in that case one of them is the primary, rest is the copies for various purposes) with all the consequences. He would like to have the same settings on all his workstations and databases.
I suppose I will have to create special common database with settings, haven't I? -
Роман commented
...or in *.xml file
-
Stephane Wierzbicki commented
-
AnHa commented
And make the ConnectionDialog aware of this and don't use it's own settings in the registry.