Allow deleting a record at database creation.

Using a magical record type "#" will allow the user to
delete previously created record  from the database.
This commit is contained in:
Hinko Kocevar
2024-06-12 19:48:34 +02:00
committed by Andrew Johnson
parent 057eb87101
commit 535c9c2a06
2 changed files with 28 additions and 0 deletions

View File

@@ -1119,6 +1119,19 @@ static void dbRecordHead(char *recordType, char *name, int visible)
return;
}
if (recordType[0] == '#' && recordType[1] == 0) {
status = dbFindRecord(pdbentry, name);
if (status == 0) {
dbDeleteRecord(pdbentry);
fprintf(stderr, ERL_WARNING ": Record \"%s\" DELETED!\n", name);
return; /* done */
}
fprintf(stderr, ERL_ERROR ": Record \"%s\" not found\n", name);
yyerror(NULL);
duplicate = TRUE;
return;
}
status = dbFindRecordType(pdbentry, recordType);
if (status) {
fprintf(stderr, "Record \"%s\" is of unknown type \"%s\"\n",