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: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: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: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 http://CampgroundMaster.com/help/databasemodification.html

Campground Master Home