Save the string to the built-in database by the specified key.

 

Syntax

function mDBStorageGetData(sKey, sData: string): integer;

 

Parameters and return values

Parameter

Type

Value

sKey

string

text key for writing data. The letter case matters. Not name limitations;

sData

string

key, text string. Can be empty.

 

Function result

0 function executed successfully;

-1 key value can't consist spaces or be empty.

 

Example


const
  TOTAL = 12;
var
  i: integer;
  sKey, sData: string;
  dt: double;
begin
  mLogScript('Start saving month names to database...', '');
    for i := 1 to TOTAL do begin
      dt := EncodeDate(2018, i, 1); 
      sData := FormatDateTime('mmmm', dt); // name of month
      mDBStorageSetData('month_name_' + IntToStr(i), sData);
    end;
    
  mLogScript('Ready. Start reading:', '');  
    for i := 1 to TOTAL do begin
      sKey := 'month_name_' + IntToStr(i);
      mLogScript('Key: ' + sKey + ', value: "' + mDBStorageGetData(sKey) + '"', '');  
    end;  
end.


Script work result

[19:36:15] (Log "DBStorage"): Start saving month names to database...

[19:36:15] (Log "DBStorage"): Ready. Start reading:

[19:36:15] (Log "DBStorage"): Key: month_name_1, value: "Janyary"

[19:36:15] (Log "DBStorage"): Key: month_name_2, value: "February"

[19:36:15] (Log "DBStorage"): Key: month_name_3, value: "March"

[19:36:15] (Log "DBStorage"): Key: month_name_4, value: "April"

[19:36:15] (Log "DBStorage"): Key: month_name_5, value: "May"

[19:36:15] (Log "DBStorage"): Key: month_name_6, value: "June"

[19:36:15] (Log "DBStorage"): Key: month_name_7, value: "July"

[19:36:15] (Log "DBStorage"): Key: month_name_8, value: "August"

[19:36:15] (Log "DBStorage"): Key: month_name_9, value: "September"

[19:36:15] (Log "DBStorage"): Key: month_name_10, value: "October"

[19:36:15] (Log "DBStorage"): Key: month_name_11, value: "November"

[19:36:15] (Log "DBStorage"): Key: month_name_12, value: "December"

[19:36:15] (Run "DBStorage"): Script operation time: 199 ms

[19:36:15] (Run "DBStorage"): Script done successfully.

 

See also

FormatDateTime

EncodeDate

mDBStorageGetData

mLogScript

IntToStr