DBRemove

(Engine-Level Function)

Maintained only to provide backward compatibility with legacy applications. Do not use in new code.

Description: Executes in its own thread to remove a record from a VTScada database and returns an indication of parameter errors.
Returns: Numeric
Usage: Script Only.
Function Groups: Database and Data Source
Related to: DBAdd | DBInsert |DBGetStream | DBListGet | DBListSize | DBSystem | DBTransaction | DBUpdate | DBValue
Threaded: Yes
Format: DBRemove(DBSysVal, IDKey [, EventCode])
Parameters:  
DBSysVal
Required. The database value to use. This is the return value from a DBSystem call.
IDKey   
Required. Any text expression used for designating the record(s) to delete. Can contain the wildcard characters "*" and "?".
EventCode  

Optional. Any variable in which the event code for the function is returned. This parameter may be used to indicate completion of the function, as it will not be set to a valid value until execution is complete. It has one of the following meanings

EventCode

Meaning

Record(s) deleted

Error occurred - record(s) not deleted

EventCode will not be set if there is a parameter error (see comments).

Comments: This function executes in the thread created by the DBSystem call, so it will not block other statements from executing. This does mean, however, that the timing for EventCode becoming valid (marking that the statement has finished executing) is unpredictable and should therefore be checked for validity prior to executing other statements that rely on this statement's results.
The return value for this function indicates if any of its key parameters (DBSysVal or IDKey) are invalid. It will immediately return a value of false (0) unless a key parameter was invalid, in which case it will return true (1). Note that the return value only signals completion of the function's execution if it is true, otherwise the function will continue executing in the thread created for it.
If the database file has its read-only attribute set when this function is executed, it will be cleared automatically by execution of the function.

Example:

  MyDB = DBSystem(DbFile, "", 0, 0, 64 { key }, 10 { field 1 });
  If Valid(MyDB) && ! Killed;
  [
    Killed = 1; 
    DBRemove(MyDB { Database to use }, 
             "Digital*" { ID key }, 
             eCode { Event code returned }); 
  ]