"For developers", "Server scripts", "Functions description", "Database", "mDBStorageKeyExists".
Function to check the existence of the specified key in the built-in database of MyChat Server.
function mDBStorageKeyExists(sKey: string): boolean;
Parameter |
Type |
Value |
---|---|---|
sKey |
string |
text key for search. The letter case matters. |
True, if the key exists, false — such key does not exist or you specified the key with empty name.
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.
[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 succesfully.