Function to check the existence of the specified key in the built-in database of MyChat Server.

 

Syntax

function mDBStorageKeyExists(sKey: string): boolean;

 

Parameters and return values

Parameter

Type

Value

sKey

string

text key for search. The letter case matters.

 

Function result

True, if the key exists, false — such key does not exist or you specified the key with empty name.

 

Example


const
  TOTAL = 12;
var
  i, iCount: integer;
  sKey: string;
begin
  iCount := 0;
  
    for i := 1 to TOTAL do begin
      sKey := 'month_name_' + IntToStr(i);
      
        if mDBStorageKeyExists(sKey) then inc(iCount);
    end;  
    
    if iCount > 0 then mLogScript('Total ' + IntToStr(iCount) + ' keys found', '')
      else mLogScript('Keys are not found', '');
end.


Script work result

[20:11:55] (Log "DBStorageKeyExists"): Total 12 keys found

[20:11:55] (Run "DBStorageKeyExists"): Script operation time: 10 ms

[20:11:55] (Run "DBStorageKeyExists"): Script done successfully.

 

See also

mLogScript

IntToStr

Created with the Personal Edition of HelpNDoc: Effortlessly Convert Your Markdown Content with HelpNDoc