Database Modification

Top  Previous  Next

 

These functions are used to modify the database.  Naturally these should be used with care, since modifications cannot be simply undone, and anything modified through functions is likely to be done without the user knowing it has happened.

 

There is a subtle but important issue when changing database field values -- changes are queued up and "flushed" to the logs and to other workstations only when it expects changes, e.g. in data dialogs, when a change to an entry field is noticed.  If you set fields through scripting, it won't flush those until the next time a "change" is noticed.  Even inside a dialog, you need to make sure you use DlgSetChangedFlag(.T.) if you manually change data fields directly in a record, in case no other changes are made on the dialog entry fields that would normally trigger a flush.

 

 

 

(Back to Function Types List)

 

 

Function:AddJournalEntry        
Result-type:Record        
Arguments:rRecordLinked, cNotes        
Description:Creates a new journal entry record, attached to the given database record (use NullRecord() for a global journal entry).  Returns the new journal record.        

 

 

Function:AddRecord        
Result-type:Record        
Arguments:cTable        
Description:Creates a new record in the given table and adds it to the database, with blank fields (except the record ID which is automatically generated)        

 

 

Function:AddReservation        
Result-type:Record        
Arguments:rCustomer, rSite        
Description:Creates a new reservation record for the given customer on the given site and adds it to the database. The Site may be NullRecord() for unassigned reservations. It's also properly linked to the customer        

 

 

Function:AddTransaction        
Result-type:Record        
Arguments:rCustOrResv        
Description:Creates a new transaction record for the given reservation or customer (which can be a NullRecord) and adds it to the database. It's also properly linked to the reservation and/or customer as appropriate        

 

Function:CopyRecord        
Result-type:Record        
Arguments:rRecord        
Description:Creates a new copy of the given record, copying all of its data, and adds it to the database.  Note that any links are also copied, however link-backs are not fixed up (e.g. if a Resv is copied, it still needs to be added to the Cust's Resv list manually to avoid being an 'orphaned' record, and the transaction list needs to be cleared out to avoid double-linking to any existing transactions).

 

Function:DeleteRecord        
Result-type:Record        
Arguments:rRecord        
Description:Deletes a record from the database.  Note that this won't necessarily delete it 'properly', e.g. any linked references to this record may not be cleaned up.  Transactions can be deleted safely (the references from the reservation and/or customer are handled as needed), but be very careful about deleting other record types.        

 

 

Function:HerculesLockSite        
Result-type:Boolean        
Arguments:rSite        
Description:Lock a Site on the Hercules online reservation system -- should be called before making any reservation changes that could affect its length, or on any site before creating a new reservation on it (or changing a reservation to the site), to ensure it's available.  Will return True if lock is successful, False if failed for any reason.

 

 

Function:HerculesNotifyAddResv        
Result-type:Boolean        
Arguments:rResv        
Description:Notify the Hercules online reservation system that a new reservation has been added.        

 

 

Function:HerculesNotifyCancelResv        
Result-type:Boolean        
Arguments:rResv        
Description:Notify the Hercules online reservation system that a reservation has been deleted or canceled.

 

 

Function:HerculesNotifyChangeResv        
Result-type:Boolean        
Arguments:rResv        
Description:Notify the Hercules online reservation system that a reservation may be changing (call before making the changes to the reservation itself -- the appropriate notifications will be sent when a change is detected).

 

 

Function:HerculesNotifyChangeSite        
Result-type:Boolean        
Arguments:rSite        
Description:Notify the Hercules online reservation system that a site may be changing (call before making the changes to the site itself -- the appropriate notifications will be sent when a change is detected).

 

 

Function:HerculesUnlockSite        
Result-type:Boolean        
Arguments:rSite        
Description:Unlock a Site on the Hercules online reservation system -- should be called when finished making potential changes that might affect site availability.

 

 

Function:LockRecord        
Result-type:Boolean        
Arguments:rRecord        
Description:Locks the record for upcoming changes, and returns TRUE if the lock was successful        

 

 

Function:LockSetting        
Result-type:Boolean        
Arguments:cSection, cKey        
Description:Locks the global setting (actually its whole section) for upcoming changes, and returns TRUE if the lock was successful        

 

 

Function:LockSettingLocal        
Result-type:Boolean        
Arguments:cSection, cKey [, nWorkstaton]        
Description:Locks the local setting (actually its whole section) for upcoming changes, and returns TRUE if the lock was successful. If no workstation number is specified, uses the current workstation number        

 

 

Function:ProcessEvent        
Result-type:Boolean        
Arguments:rRecord, nEventType        
Description:Process the indicated type of Event Action for the given record.  The Event Type is numeric -- look up the value through the Fixed Lists, Event Types.  The return value is the event result, e.g. if it's False for a 'Before' event, that means the operation should be aborted.        

 

 

Function:ReadAllSettings        
Result-type:Boolean        
Arguments:(none)        
Description:Reads all 'Setting' values , and refreshes the displays -- this is usually required after any SetSetting... functions in order for setting changes to actually take effect.        

 

 

Function:RefreshDisplay        
Result-type:Boolean        
Arguments:(none)        
Description:Refreshes the main display (e.g. the current Tab View being displayed).  This may need to be used after changing reservation information so the changes are reflected on the Rack, for instance.  Always returns True.        

 

 

Function:ReIndexSiteReservations        
Result-type:Boolean        
Arguments:(none)        
Description:Rebuilds an internal Site/Reservation index -- this should be called any time the site assigned to a reservation is changed, or a reservation is deleted or added.  This does not automatically refresh the screen (use RefreshDisplay).  The return value is always True.        

 

 

Function:ResvLinkAsNonSynced        
Result-type:Boolean        
Arguments:rChild, rParent        
Description:If possible, links the reservation rChild to rParent as Non-Synchronized. Returns True if the reservations were successfully linked, False if something prevented it.        

 

 

Function:ResvLinkAsSubMember        
Result-type:Boolean        
Arguments:rChild, rParent        
Description:If possible, links the reservation rChild to rParent as a Sub-member. Returns True if the reservations were successfully linked, False if something prevented it (e.g. incompatible as sub-member reservations).        

 

 

Function:ResvLinkAsSynced        
Result-type:Boolean        
Arguments:rChild, rParent        
Description:If possible, links the reservation rChild to rParent as Synchronized. Returns True if the reservations were successfully linked, False if something prevented it (e.g. incompatible as synchronized reservations).        

 

 

Function:ResvMakeNonSynced        
Result-type:Boolean        
Arguments:rResv        
Description:Changes the linking method of this reservation (to its parent) to Non-Synchronized, if possible.  Returns True if it was successfully changed, False if something prevented it..        

 

 

Function:ResvMakeSubMember        
Result-type:Boolean        
Arguments:rResv        
Description:Changes the linking method of this reservation (to its parent) to Sub-member, if possible.  Returns True if it was successfully changed, False if something prevented it.        

 

 

Function:ResvMakeSynced        
Result-type:Boolean        
Arguments:rResv        
Description:Changes the linking method of this reservation (to its parent) to Synchronized, if possible.  Returns True if it was successfully changed, False if something prevented it.        

 

 

Function:ResvUnlinkFromAll        
Result-type:Boolean        
Arguments:rRecord        
Description:Unlinks this reservation from all other reservations, making it a standalone reservation.  Rearranges any others it was linked with as needed (moving any children up to its parent, etc).  Returns True if the reservation was successfully unlinked, False if something prevented it.        

 

 

Function:ResvUnlinkFromParent        
Result-type:Boolean        
Arguments:rRecord        
Description:Unlinks this reservation from others above it, but keeps any children linked to it.  Returns True if the reservation was successfully unlinked, False if something prevented it.        

 

 

Function:SetFieldBlank        
Result-type:Boolean        
Arguments:rRecord, cFieldName        
Description:Sets the given field of a record to 'blank'. Returns TRUE if successful        

 

 

Function:SetFieldBool        
Result-type:Boolean        
Arguments:rRecord, cFieldName, bValue        
Description:Sets the boolean value for the given field of a record. Returns TRUE if successful        

 

 

Function:SetFieldDate        
Result-type:Boolean        
Arguments:rRecord, cFieldName, dValue        
Description:Sets the date value for the given field of a record. Returns TRUE if successful        

 

 

Function:SetFieldText        
Result-type:Boolean        
Arguments:rRecord, cFieldName, cValue        
Description:Sets the text value for the given field of a record. Returns TRUE if successful        

 

 

Function:SetFieldTextRaw        
Result-type:Boolean        
Arguments:rRecord, cFieldName, cValue        
Description:Sets the text value for the given field of a record (for special use with fields like linked lists, encrypted data, etc). Returns TRUE if successful        

 

 

Function:SetFieldTime        
Result-type:Boolean        
Arguments:rRecord, cFieldName, dValue        
Description:Sets the time value for the given field of a record. Returns TRUE if successful        

 

 

Function:SetFieldValue        
Result-type:Boolean        
Arguments:rRecord, cFieldName, nValue        
Description:Sets the numeric value for the given field of a record. Returns TRUE if successful        

 

 

Function:SetFieldAddLinkedRec        
Result-type:Boolean        
Arguments:rRecord, cFieldName, rAddRec        
Description:Adds a record link to the given linked list field.  Returns TRUE if successful        

 

 

Function:SetFieldRemoveLinkedRec        
Result-type:Boolean        
Arguments:rRecord, cFieldName, rRemoveRec        
Description:Removes a record link from the given linked list field.  Returns TRUE if successful        

 

 

Function:SetFieldMoveLinkedRecUp        
Result-type:Boolean        
Arguments:rRecord, cFieldName, rMoveRec        
Description:Moves a record link up in the given linked list field.  Returns TRUE if successful        

 

 

Function:SetFieldMoveLinkedRecDown        
Result-type:Boolean        
Arguments:rRecord, cFieldName, rMoveRec        
Description:Moves a record link down in the given linked list field.  Returns TRUE if successful        

 

 

Function:SetSettingBool        
Result-type:Boolean        
Arguments:cSection, cKey, bValue        
Description:Sets the boolean value for the given system global setting. Returns TRUE if successful. Note: You may need to use the ReadAllSettings() function (or restart the program) before the new settings take effect.        

 

 

Function:SetSettingLocalBool        
Result-type:Boolean        
Arguments:cSection, cKey, bValue [, nWorkstaton]        
Description:Sets the boolean value for the given system local setting. Returns TRUE if successful. If no workstation number is specified, uses the current workstation number. Note: You may need to use the ReadAllSettings() function (or restart the program) before the new settings take effect.        

 

 

Function:SetSettingLocalText        
Result-type:Boolean        
Arguments:cSection, cKey, cValue [, nWorkstaton]        
Description:Sets the text value for the given system local setting. Returns TRUE if successful. If no workstation number is specified, uses the current workstation number. Note: You may need to use the ReadAllSettings() function (or restart the program) before the new settings take effect.        

 

 

Function:        SetSettingLocalTextEncrypted        

Result-type:Boolean        
Arguments:cSection, cKey, cValue [, nWorkstaton]        
Description:Sets the text value for the given system local setting, using encryption. Returns TRUE if successful. If no workstation number is specified, uses the current workstation number. Note: You may need to use the ReadAllSettings() function (or restart the program) before the new settings take effect.        

 

 

Function:SetSettingLocalValue        
Result-type:Boolean        
Arguments:cSection, cKey, nValue [, nWorkstaton]        
Description:Sets the numeric value for the given system local setting. Returns TRUE if successful. If no workstation number is specified, uses the current workstation number. Note: You may need to use the ReadAllSettings() function (or restart the program) before the new settings take effect.        

 

 

Function:SetSettingText        
Result-type:Boolean        
Arguments:cSection, cKey, cValue        
Description:Sets the text value for the given system global setting. Returns TRUE if successful. Note: You may need to use the ReadAllSettings() function (or restart the program) before the new settings take effect.        

 

 

Function:SetSettingTextEncrypted
Result-type:Boolean        
Arguments:cSection, cKey, cValue        
Description:Sets the text value for the given system global setting, using encryption. Returns TRUE if successful. Note: You may need to use the ReadAllSettings() function (or restart the program) before the new settings take effect.        

 

 

Function:SetSettingValue        
Result-type:Boolean        
Arguments:cSection, cKey, nValue        
Description:Sets the numeric value for the given system global setting. Returns TRUE if successful. Note: You may need to use the ReadAllSettings() function (or restart the program) before the new settings take effect.        

 

 

 

 


Page URL https://CampgroundMaster.com/help/databasemodification.html

Campground Master Home