Vote for this Product at ClarionShop  
Buy now at ClarionShop
Version Gold

www.capesoft.com
Updated
Friday 12 September 2008
c3pa approved
     
 


 

Technical Documentation


Contents
  csLog Class  
csLogManager Class
csLogConnectionManager Class
Complete Documentation
     


Note:The term 'a file change' is used to refer to an add, edit or delete of a record.

Can't find what you're looking for? Click here to search the entire Replicate documentation.

csLog Class

Introduction  
Methods

AddExtraTag
AddSetting
AddToLog
AutoInit
ChangeFields
CheckDirectory
CheckEOF
ClearSavedFields
Close
CloseFile
Commit
Configure
Construct
DeRegister
Destruct
GenerateCRC
GenerateTranslationFile
GetArray
GetFileDate
GetFileName
GetFileNumber
GetGlobalSetting
GetGUID
GetLastFileNumber
GetLogFileFooter
GetLogFileHeader
GetMemo
GetNextNumber
GetSetting
GetSettingWindow
GetTranslation
GUIDFieldToText

GUIDFieldToString
HexFormat
HexToLong
IgnoreField
Init
Insert
Kill
LogToTemp
MemoChanged
Open
OpenFile
OpenTempFile
PrimeLog

PrimeString

Register
RegisterArray
RegisterSuppressed
Registration
RepMessage

RestoreBuffer
SetArray
SetGlobalSetting
SetMemo
SetNextNumber
SetPathTo
SortFileQ
StampEOF
StoreBuffer
UpdateSetting

Properties
Source Code Examples

Introduction

The csLog Class is Replicate's base class for all Replicate's classes. Basically the csLog class handles handles the actual logging of the records. In order to make this happen, it needs to have all the files registered and some of the site details setup (like which site am I, etc). The csLog class definitions are located in the Replicate.inc file, and the method source code is in Replicate.clw.

Methods

Method Parameters Method Description
Init ( ) This method just initializes the queues that the object uses. The Global Template populates this method in the global module (before any windows are open/run).
Methods Called:
The Registration method and the Configure method.
Kill ( ) This method clears and disposes the object's queues, and closes the log files (if open).
Open () This method opens the logfile. Before opening, it checks if the logfile must be ended, and a new logfile created and used. 

Methods Called:
The Close method (if the file is already open), the GetNextNumber method (if a new file must be created), and the Insert method (if it needs to stamp the header site at the top of the file). StampEOF, CheckEOF, GetFileName
Open (*file pFile,
*string pData,
*string pFileName,
byte pCreateNew=0),long
This method opens a logfile (log, export, import, etc). Returns a 0 if successful, otherwise the errorcode.
Parameters:
pFile - a handle to the file structure
pData - a handle to the data string
pFileNamge - a handle to the string containing the filename.
pCreateNew - If set, then the logfile will be CREATEd (even if it exists already)
Close (byte pCloseTemp=0
,byte pStampeEOF=0)
This method closes the logfile.
Parameters: 
pCloseTemp - If set, then the TempLogFile (which is used during logout mode) is closed.
pStampEOF - if set, stamps the EOF stamp onto the end of the file.
Insert (string DataString,
<string FileLabel>)
This method is used to insert entries into the logfile (or tempfile depending on whether a file is logged out or not) - this calls the other insert method. 
Parameters:
DataString - the string that must be entered into the logfile
FileLabel - the name of the Table that had the change (used to identify files that have been loggedout). 
Insert (string DataString,
<*File FileID>,
*string pData,
byte pOptions=0)
This method is used to insert entries into the logfile (or tempfile depending on whether a file is logged out or not). 
Parameters:
DataString - the string that must be entered into the logfile
FileID -  the file handle of the logfile File
pData - a handle to the DataString of the logfile
pOptions - Passed on to AddToLog method.
Register (*File FileID,
string FileLabel,
*Group RecordID,
*String GUID,
*Group RecordHist
,<*string SiteField>
,<string pSuperPre>)
This method is used to build an internal file queue of all the files whose changes must be logged.
Parameters:
FileID - the handle of the file to be registered
FileLabel - the label of the file to be registered.
RecordID - the handle of the Record group.
GUID - the handle of the GUID field.
RecordHist - the handle of the variable that contains a copy of the record when a record is read.
SiteField - the handle of the SiteField in the file.
pSuperPre - the SuperPrefix of anExternal DLL table (for unique identification).
RegisterArray (string pFieldLabel
,*string ArrayID
,*string ArrayHistID
,byte threaded=0
,<string pFileLabel>
,long pFieldPosition=0)
This method registers any arrays that occur in your file structures.
Parameters:
FileLabel - the label of the file which contains the array
ArrayID - the handle of the array in the Record structure
ArrayHistID - the handle of the variable that contains a copy of the array when a record is read.
Threaded - indicates that the file is opened in a new thred.
pFileLabel - the label of the file that this array belongs to (for External DLL tables)
pFieldPosition - the position of the array in the Record of the table (for External DLL tables)
GetMemo (String MemoLabel),String Returns the value of the specified memo (code is generated into the application's default module). 
Parameters:
Memolabel - the label of the memo to be returned
GetGUID ( ),string Returns the GUID value to be used in an insert record.
Configure ( ) Warns if the site details aren't setup. Template generates code into the child to set the site details up.
Methods Called:
GetNextNumber, CheckDirectory
GetNextNumber (String SiteID,
<long Number>),Long
This returns the number of the current log file that should be used for logging (for self.site), or it returns the logfile number of the last completed import (from the site specified). (code is generated into the application's default module)
Parameters:
SiteID - the label of the site whose lastnumber must be returned.
MethodsCalled:
StampEOF (if a new LogFile must be logged to, and the last one must be ended). CheckEOF
SetMemo (string MemoLabel,
*string Value)
This method is used to set the valuelabel of the Memo field specified (code is generated into the application's default module).
Parameters:
Memolabel - the label of the memo to be changed
Value - the handle of the variable containing the value for the memo
RepMessage (string MessageID,
<string ButtonText>,
<long DefaultButton>)
,long,proc
This method calls the message() function and allows for translation of the messages used in the Replicate objects.
Parameters:
MessageID - an index used to identify the messagetext.
ButtonText - a string containing the buttonstring or the button equates.
DefaultButton - identifies the default button.
CloseFile (string FileLabel,
<string pDebugString>),long
Closes the file specified.
Parameters:
FileLabel - the label of the file to be closed.
pDebugString - a string to output to the debugger
OpenFile (string FileLabel,
<string pFromWhere>,
long pMode=0),long
Opens the file specified.
Parameters:
FileLabel - the label of the file to be opened.
pFromWhere - a string to output to the debugger
pMode - indicates what mode the file must be opened in (if zero, then opened in default mode).
PrimeLog (string opCode,
 *File FileID,
<string pSiteID>,
byte pOptions=0),string
Returns a string configured for a complete log file entry when a file changes.
Parameters:
opCode - contains a label of the change type (insert/update/delete,etc)
FileID - the handle of the file which has been changed.
pSiteID - reserved for derived methods
pOptions - reserved for later use
MethodsCalled:
GetMemo, MemoChanged (checks if a memo has changed when an update occurs)
RegisterSuppressed (*File FileID,
string FileLabel,
<*? SuppressedField>,
<string FieldLabel>,
byte pOptions=0)

This method registers a field to be omitted from replication, or a file for directional replication if the fields are omitted. 
Parameters:
FileID -  a pointer to the file (containing the omitted field)
FileLabel - the dictionary label of the file
SuppressedField - a pointer to the field to be omitted
FieldLabel - the dictionary of the field to be omitted.
pOptions - b1 - Read, b0 - write.
StoreBuffer (*File FileID,<string pAction>,byte pImporting=0) Stores the record, memos and arrays into the history variables when a record is fetched (code is generated into the application's default module).
Parameters:
FileID - the handle of the file whose record is fetched.
pAction - if the LogManager is importing a change, then Action will be set to Insert, Update, UpdateFull or Delete.
pImporting - set if the StoreBuffer is called immediately prior to an imported Insert, Update, UpdateFull or Delete.

Note: be careful deriving this method as it is used to store previous file buffer states before a filechange. For file activity, set a flag and then perform the activity after Replicate has done the action. IOW, rather use the FileChange method (in the LogManager) to handle file activity after the LogManager has imported the file change that it is about to perform.

MemoChanged (string MemoLabel),Byte Returns whether the specified memo has changed(1) or not (0).
Parameters:
Memolabel - the label of the memo to check.
Commit ( ) Commits the file changes occuring during a logout to the logfile.
LogToTemp (*File FileID),long Opens a TempLogFile when a Logout is issued, and stores each logged out file in a queue. Returns: 0 = file opened, 1 = file already open, 2 = error opening file.
Parameters:
FileID - the handle of the file to add to the logout queue.
StampEOF (long Number,
long DateStamp,
byte ForceStamp=0)
This method calls the generic StampEOF method.
Parameters:
Number = Number of the log file to stamp.
DateStamp = Date to stamp the EOF tag.
ForceStamp = set if stamp must be stamped, even if we should be using this logfile.
StampEOF (*file pFile,
*string pData,
long DateStamp,
byte ForceStamp=0),long
Stamps the EOF tag onto the end of the log file.
Parameters:
pFile - a handle to the file structure to stamp the EOF into.
pData - a handle to the data string.
DateStamp = Date to stamp the EOF tag.
ForceStamp = set if stamp must be stamped, even if we should be using this logfile.
Methods Called:
CheckEOF, GetFileName, Open, Close
HexFormat (long LongValue,
byte places),string
Formats a long into a HexNumber. Returns the Hex number (in a string).
Parameters:
LongValue - The long value to be converted
Places - Number of digits to return.
Registration ( ) This method is an entirely generated child method, used to register each file, array and omitted field.
GetSettingWindow (<string Setting>),string Returns a string input for a setting requested by the object. This method provides the user with a window to return a string input for a setting requested by the object.
Parameters:
Setting - the text for the window title bar describing the setting.
AddSetting (string Setting,
<long option>),string
This method is used to create a setting that has not been entered before. This is used for required settings, and directs the selection help to either the GetSettingWindow or the filedialog window. Returns the setting (or blank if not selected).
Parameters:
Setting - the label of the setting occuring in the ini file.
Option - Unused (reserved for later).
Methods Called:
UpdateSetting, GetSettingWindow
UpdateSetting (string setting,
string value)
Updates the ini file settings.
Parameters:
Setting -  the ini label of the setting
Value - the value of the variable and the setting.
GetSetting (string setting,
byte pOptions=0),string
Returns the setting specified (from the ini file, or from a window). Template generates code into the child method.
Parameters:
Setting - the label of the setting from the ini file.
pDontUpdate - b0 set don't update the setting if it is not correct. b1 set, then prime FTP with the default.
ClearSavedFields (string FileName) This method is used to clear the saved fields variables (code generated into the derived method by the template).
Parameters:
FileName - the label of the file whose variables must be cleared.
SetNextNumber (String SiteName,
Long Number,
long LastSize=0)
This method is used to record the log file number used (in the last completed import) or that must be used (for our own logging). Code is generated into the child method.
Parameters:
SiteName - the name of the site who's number must be set.
Number - the number to set the next number to. (if 0 then only the size will be updated).
LastSize - the size of the imported file received (if no EOF was received).
Methods Called:
GetGUID
CheckEOF (<string pLogFileName>,
byte OnlyEnd=0),long
This method calls the generic CheckEOF.
CheckEOF (*File pFile,
*string pData,
byte OnlyEnd=0),long
This method checks if there is an End of File stamp in the log file. If there is, it returns the date of the End Of File stamp, otherwise (if no stamp) it returns a 0 or a negative number (if and error occurred).
Parameters:
pFile - the handle of the file structure to check.
pData - the handle of the data string.
OnlyEnd = only checks the last record length of bytes.
GetFileName (<string SiteName>,
long Number,
byte NoPath=0),string
This method returns a correctly formed the logfile name.
Parameters:
SiteName - if omitted, assumes self.site.
Number - the number for the log file.
NoPath - if set, then the filename returned will not include a path.
Methods Called:
HexFormat
CheckDirectory (*? DirToCheck,
byte MakeDir=0),long
This method checks the existence of a directory and returns a 1 if it is available and 0 if not.
Parameters:
DirToCheck = a handle to a string that contains the path of the directory to check.
MakeDir = b6 Set if the directory must be created.
Methods Called:
SetPathTo
GUIDFieldToText (*group FileRecord,
long GUIDPosition,
<*long GUIDTextLen>,
<string pExtraTag>,
long pMakeUpper=0)
This method takes the passed record, separates the GUID and decodes it into a string with 4 components and separated by commas. It returns the string
Parameters:
FileRecord - the handle of the RECORD group containing the GUID.
GUIDPosition - the position of the GUID in the group.
GUIDTextLen - this value is incremented by the length of the string returned
pExtraTag - tags to place in the GUID tag (to make it a parent).
pMakeUpper - makes the GUID label upper (for CRC comparison), otherwise leaves the GUID label as is in the dct.
SetPathTo (string PathName),long
This method is used to do a SETPATH() for  short form directory names (like '.' , '..' , '.\' , etc). Returns a 0 if Path set, otherwise the errorcode() of the last SetPath.
Parameters:
PathName - the name of the directory to change to.
GetBlob (string BlobName,
*long BlobSize),STRING
This method is used to return the contents of a BLOB. The template generates a derived method.
Parameters:
BlobName - the field name of the BLOB.
BlobSize - the handle of the variable to contain the size of the BLOB.
BlobChanged (string BlobName,
*long BlobSize),long
This Method is used to test if the BLOB has changed (since the last get). Returns a 1 if it has changed. The template generates a derived method.
Parameters:
BlobName - the field name of the BLOB.
BlobSize - the handle of the variable to contain the size of the BLOB.
SetBlob (string BlobName, 
*? FieldValue)
This method is used to Set the contents of a BLOB.The template generates a derived method.
Parameters:
BlobName - the field name of the BLOB.
FieldValue - a handle to the ANY containing the BLOB contents.
ChangeBlobTouched (*File FileId,
byte SaveTouched=0)
This method is used to store the contents of the prop:touched value of the BLOBs in a file in their respective History global variables.The template generates a derived method.
Parameters:
FileID - a handle to the file containing the BLOBs.
SaveTouched - if set, will save the current PROP:Touched values, otherwise clears the saved ones.
GetBlobName (*File FileID,
long BlobNumber),STRING
This method is used to return the names of BLOBs in a file.The template generates a derived method.
Parameters:
FileID - a handle to the file containing the BLOBs.
BlobNumber - a BLOB Index number. 
SetArray (string ArrayName) This function is used (in Clarion6) if a threaded file is used to set the Array field when importing
GetArray (string ArrayName) This function is used to get the array and it's history field.
Construct ( ) This method is run everytime a thread is started in Clarion6. From here the Init method is called to initialise the threaded class.
Destruct ( ) This method is run everytime a thread is killed in Clarion6. From here the Kill method is called to dispose the threaded class.
GenerateTranslationFile (string pFilename) This method will generate a translation file with all the text needed to be translated (that is used in the Replicate classes).
Parameters:
pFilename - the name of the translation file to be created/appended.
GetTranslation (string pINISection,
string pINIVariable,
<string pINIValue>)
,string,proc
This method returns the translated text from the translation file. It will also place default text there if the Translation file is not found.
Parameters:
pINISection - The section of the translation file
pINIVariable - The variable.
pINIValue - the default value (if omitted the pINIVariable is assumed the default)
GenerateCRC (*file pFileID,
*string pData,
*long pFileSize,
byte pOptions=0),long
This method adds a CRC to a logfile. It is also used to check a CRC and correct (if nec). 0 = fine, -1 if the CRC exists but is incorrect, -2 if no CRC exists, and errorcode() if there is a problem opening, closing, reading or writing to the file.
Parameters:
pFileID - the handle of the file
pData - the handle of the string containing the data
pFileSize - the handle of a long containing the size of the data (set to 0 if unknown)
pOptions - bit0 is set if the CRC must just be checked.
IgnoreField (*file pFileID,
long pFieldNo,
<? pValue>,
byte pImporting=0,
<string pAction>),long
This method is called by the PrimeLog method as its writes the file changes to the logfile. Overed fields and Groups are (by default ) not written to the file, but if you need to write these, you can enter code in here to make sure the field is not ignored. Returns a 1 if Field must be ignored, a 2 if the entire record must be ignored, otherwise it will not be ignored.
Parameters:
pFileID - the handle of the table that was changed.
pFieldNo - the Number of the field in the record group.
pValue - the value of the field (for value dependant ignoring)
pImporting - set if currently importing from the logfile.
pAction - the file action that will be performed (insert, update, updatefull or delete)
ChangeFields (*file pFileID,
long pOpcode)
This method allows you to add code to change fields before the record is written to the file.
Parameters:
pFileID - the handle of the file being written to
pOpCode - a long containing the code of the instruction written to the file
DeRegister (*file pFileID) This method allows you to de-register a file on the file, if the file should no longer be logged.
Parameters:
pFileID - the handle of the file to be de-registered.
PrimeSiteField (<*file pFileID>,
<string pSiteID>,
<string pOldSiteValue>,
byte pOptions=0),long
Goes through a table (or your entire database) and replaces the OldSite value with the new SiteValue.
Parameters:
pFileID - the handle of the file to scan and replace. If omitted, will perform the replacement on all the tables in your dictionary.
pSiteID - the new SiteID to prime (generally RepGLO:Site)
pOldSiteValue - the SiteID to search for
pOptions - b0 Rep_CheckIfDone - registers when this operation occurs and prevents this from running again.
GetFileNumber
(string FileName) This method returns the number from a logfile name passed.
Parameters:
FileName - the name of the logfile to return the number of.
GetLastFileNumber 
(<string pDirectory>,
<string pSiteID>),long
This method returns the number of the last logfile used.
Parameters:
pDirectory - the directory in which the logfiles reside (logpath used if omitted)
pSiteID - the label of the site (self.site used if omitted)
HexToLong (String HexVal),long This method returns the long value of a Hex string.
Parameters:
HexVal - the string containing the Hex number
SortFileQ (*RepDirQueue pFileQueue,
byte pOptions=0)
This method sorts the pFileQueue into Replicate logfile number order.
Parameters:
pFileQueue - the handle of the FileQueue 
pOptions - bit loaded flag. If bit1 set, then corrects the FileDate field.
GetFileDate (string pFileName,
long pFileDate),long
This method extracts the date from a logfile. This would normally be the date in the EOF stamp, but if not stamped, then it would be the date of the file.
pFileName - the name of the file
pFileDate - the default date (should the be no EOF stamp)
AddToLog (? pDataToAdd,
long pDataLen,
long pNumberOfTries=10,
byte pOptions=0,
*file pFile,
*string pData),long
This method is used to add to the logfile (or tempfile or external file). Returns an errorcode() if not successful, otherwise a 0.
Parameters:
pDataToAdd - the string of data to add to the file
pDataLen - the length of the string of data to add
pNumberOfTries - number of times to attempt writing before erroring out.
pOptions - a bit loaded flag, indicating whether to lock the file or not and whether to CheckEOF or not.Use Rep_NoFileLock and Rep_CheckEOF.
OpenTempFile (),long This method opens the Temporary file (for logout). Returns the errorcode if an error occured, otherwise a 0.
AutoInit ( ) This method calls the Init method if the CanConstruct is set. This method is called from the Construct method.
AddExtraTag (string opCode,*File pFileID),string This method is used to return an extra string to add into a log entry.
Parameters:
opCode - the file action (Insert, Update or Delete)
pFileID - the handle of the file edited
GetLogFileHeader (),string This method is used to return the generic logfile header string.
GetLogFileFooter (),string This method is used to return the generic logfile footer string.
SetGlobalSetting (string pSetting,
? pValue)
This method locks the thread and sets the global property specified in the pSetting to pValue. You can also increment or decrement a Setting using '+' and '-' in the value.
pSetting = name of the property to set.
pValue = the value to set the property to.
GetGlobalSetting (string pSetting),? This method locks the thread and returns the global property specified in the pSetting.
PrimeString (string opCode,
*File FileID,
<string pSiteID>,
byte pOptions=0,
*long pLen),string
This method calls the PrimeLog method, but sets the length variable as well.
Parameters:
opCode - code of the function
pSiteID - if this table has a site field
pLen - the handle of a long to receive the length of the primed string.
RestoreBuffer (*File FileID) Restores the specified file's record buffer from that stored in the history.
FileID - the handle of the file to restore.
GUIDFieldToString (string pGUIDField),string This method returns a string value of the passed GUID value that will be displayed in the XML file.

Properties

The Following Properties are in the GlobalSettings class - (an unthreaded class in Clarion6). You must use the SetGlobalSetting method to set them. They were previously in the Threaded class, so if you're upgrading from a version prior to 1.69, then you will get errors wherever there is a reference to the property that was in the threaded class.

Property Type Property Description
LogFileName string(255) The current log file name
LogFileNumber Long The current log file number
LogFileDate Long The Date of the log file (when closed)
LogFileTime Long The time of the logfile (when closed - for more than daily log files)
Configured byte A flag to indicate that the Replicate methods have been configured.
User string(255) An optional string containing the user (which if present will be written into the logfile)
Silent byte A flag indicating, progress windows (during import, etc) must not be displayed.
Active byte A flag indicating that the logging is inactive/active (during configuring)
SuppressWarnings byte A flag indicating whether to display(0) or suppress(1) warning messages.
TranslationFile string(255) The name of the file to be used for translating where nec. (messages, etc)
DebugMode byte A flag indicating that debug postings must be sent to the debugger.
NoLogging byte You can set this property if you do not want your application to Log a transaction. You must clear this in order to resume logging.
CanConstruct byte(0) C6 only. This property is set in the Init method the first time it is called. From there on, all Inits from the construct method will be executed completely.
Inited byte,dim(MaxNoOfThreads) A flag to indicate that the Replicate methods have been initialized.
LogOff byte,dim(MaxNoOfThreads) A flag used to temporarily prevent loggings from occurring.
Inside byte,dim(MaxNoOfThreads) A flag to indicate that the method is inside the locally derived FileCallBackInterFace methods.
TempOpened byte,dim(MaxNoOfThreads) A flag indicating that the Temporary logging file has been opened (during logout mode).
Debug Group A group of flags to specify what debug output to track.
AbortNow byte Set this flag to abort out of a processing loop. Normally this is to interrupt the ProcessLogFiles and exit the program. If the program is resumed, then you must reset the AbortNow once the task required is completed (otherwise none of the processing will execute).

The following properties are in both the GlobalSettings class and in the Threaded class as well. These are set once at runtime, and each time a thread is opened, a copy is made into the threaded class from the GlobalSettings. You must not change these settings at runtime.

Property Type Property Description
SiteFieldID cstring(20) Contains an identifier for the site fields in the dictionary files.
LogExtension string(3) Contains the extension of all log files used by the program (log by default).
SettingsFile CSTRING(255) This property contains the ini filename where all the necessary configuration settings are kept.
LogFilePath string(255) The path where the log files will be opened
Machine string(255) An optional string containing the machine (which if present will be written into the logfile)
Site string(4) Contains the ID of the current site.
ParentSite string(4) Contains the parent site for this site.

These properties exist only in the Threaded class, and are thus related only to the thread that the threaded class is in existence. 

Property Type Property Description
RecordQueueType Queue,Type This queue type is used to make a queue to store the information of the files in your dictionary for the Replicate objects use.
File &file A pointer to the file
Label string(255) The file's dictionary name.
Record &Group A pointer to the record structure
GUID &String A pointer to the GUID field
GUIDField Long The where value of the GUID field.
GUIDLabel string(50) The Label of the GUID field
GUIDKey &Key A pointer to the GUID key.
BestKey &Key For site related tables - the best key to handle site-related data.
LastRecord &Group A pointer to the saved record field (a created global variable)
SiteField long The where value of the Site field
SiteFieldID &String A pointer to the Site field
SuperPrefix string(20) Used for tables in external DLLs - gives a unique identifier.
end
ArraysQueueType Queue,Type This queue type is used to make a queue to store dimensioned field info of arrays in your dictionary.
label string(255) The label of the array.
sub &string A pointer to the string over the array (a created global variable)
size long The byte size of the array.
stored &string A pointer to the saved string (a created variable).
threaded byte For Clarion6 support - set if the File is a threaded file.
filelabel string(FileNameSize) Stores the label of the file where this array exists (for external DLL files).
FieldPosition long For external DLL tables.
end
OmitQueueType Queue,Type This queue type is used to make a queue to store a list of the fields (in your dictionary defined files) that must not be replicated.
File &File A pointer to the file containing the field (to be omitted).
Filelabel string(255) The label of the file.
Field any A pointer to the omitted field.
FieldLabel string(255) The label of the omitted field.
FieldID long The where value of the omitted field.
WriteOnly byte If set, writes the field to the log file, but does not read it.
end
LogoutQueueType Queue,Type This queue type is used to make a queue to store a list of the files that are in logout mode after a logout command.
File &File A pointer to the file
FileLabel string(255) The label of the file
end
OmitFileQueueType Queue,Type Stores a list of the tables to omit (with the directional parameter).
File &File A handle to the file
Label string(FileNameSize) The dictionary label of the file
ReadWrite byte Read (b1) - allows importing, Write (b0) - allows exporting. This should be XOR true (otherwise file either registered, or not register).
end
q &RecordQueueType The actual file queue (as defined above).
aq &ArraysQueueType The actual array queue (as defined above)
Omitq &OmitQueueType The actual Omitted fields queue (as defined above)
OmitFileq &OmitFileQueueType The actual Omitted file queue (as defined above)
Lq &LogoutQueueType The actual Logout files queue (as defined above)
Opened byte A flag to indicate that the log file is open (1) or closed (0)
StampSite string(4) Contains the ID of the site to be stamped on the records in the logfile (either parent or own).
TempFileName string(255) Contains the name of the Temporary logging file during logout mode.
ExportFileName string(255) Contains the filename for the data to be exported to.
Exporting byte A flag to indicate that Replicate is in the process of exporting to dataset.
InGetNextNumber byte This property gets incremented at the start of the GetNextNumber method (generated code) and decremented at the end). This is to prevent nested looping.
_StringHandle long The handle of a string that was created in the method called (where applicable). This means that the memory can be disposed at the calling procedure to prevent memory leaks.
ThisThread long Contains the thread for the threaded class (so we don't have to use the Thread() function every time).
SiteFile String(255) Contains the label of the SiteFile.

Source Code Examples

NB - if you are handcoding calls to the Insert, PrimeString, Export and/or SearchAndReplace methods, then you must dispose the returned string using the _StringHandle property as follows:

self.FTPInDir = self.SearchAndReplace(self.GetSetting('FTPInDir',Loc:FTPDone),'\',self.FTPDirSeparator)
if self._StringHandle
     
!What we're basically doing here is disposing the string
      !that was created in the PrimeString method. ANYs don't get freed so
      !they keep chowing memory.

  Loc:SendString &= (self._StringHandle)
  dispose(Loc:SendString)
  self._StringHandle = 0
end

csLogManager Class

Introduction  
Methods

AddToHistory
AssignQueue
AutoExport
AutoProcessFiles
BulkArchive
BytesDone
CheckRequestFile
CompareCRCFile
ConnectionDetails
CopyIn
CopyOut
CriticalErrorInImport
DisposeQueues

DoCRCWithSite
DecryptString
EncryptString
Export
FileChange
FileCRC
FileCrypt
GetFromArchive
Import
ImportFullDataSet
IgnoreTable
LoadCRCStringToQ
LoadField
LoadSitesProperties
MakeMissingLogFiles
MoveFilesIn
MoveFilesOut
Open
ProcessLine
ProcessMovedFiles

ProcessLogFiles
PutToArchive
ReceiveRequest
RemoveAllFiles
Requisition
ReturnStatus
ResolveCRCQ
RestoreBackup
RestoreGUID
SendAllOutgoing
SetStatusFlag
Setup
StringToFile
TagReceived
UpdateBasicSettings

Properties

Introduction

This class makes use of the csLog Class as it's base object to build in some useful features. These features are described in more detail in the ReplicateDocumentation in the following sections:

Methods

Method Parameters Method Description
MoveFilesIn (string FileExtension),
byte
This method imports the files that are located in the incoming directory, and then moves them to the log directory. Returns a (1) if successfully moved in, else a 0.
Parameters:
FileExtension - the file names of the log files to import (can contain wild cards).
MethodsCalled:
Import, CopyIn.
MoveFilesOut (long FromFileNumber=0,
byte pOnlyThisOne=0),long
This method is used to copy our own log files from the log path to the outgoing directory. Returns an error, or 0 if OK.
Parameters:
FromFileNumber - the number of the file to move out. If 0 , uses the LastOut property.
pOnlyThisOne - if set, then only the file specified will be moved out.
Methods called:
UpdateSetting (updates the LastCopiedOut value)
Import (string ImportFileName, byte Manual=0),long This method imports a log file and impliments all the file changes to the relevant files as specified in the log file. Returns a -1 if a complete log file was imported, a 0 if a partial log file was the last to be imported, a 1 if the ImportFile could not be opened.
Parameters:
ImportFileName - the log file to import (no path)
Manual - a bit loaded flag to indicate:
bit1 - if set then this is a manual import.
bit2 - if set then use LOGOUT/COMMIT to increase the import speed.
bit3 - if set, Append/Build is used during Manual instead of ADD.
Methods Called:
GetNextNumber, HexFormat, SetNextNumber, AddToHistory, Close, BytesDone, CloseFile, PrimeLog, Insert, Storebuffer, SetMemo, OpenFile, FileChange, TagReceived
Setup ( ) This method setups up the transporting of the logfiles (Incoming dirs, out going, etc)
Methods Called:
AddSetting, GetSetting, UpdateSetting
CopyIn (*string Source,
string Destination, byte pOptions=0),
LONG
This method copies the files (including extensions) from the source to the destination names.
Parameters:
Source - Directory and complete file name of the existing files.
Destination - the directory and complete file name to where the files must be copied.
pOptions - can specify whether the files must not be deleted after copy in.
CopyOut (string Source,
string Destination,
byte DeleteAfter=0),
LONG
This method copies the files (excluding extensions) from the source to the destination names. The extension used is the log extension specified in the LogExtension property.
Parameters:
Source - Directory and file name (no extension) of the existing files.
Destination - the directory and file name (no extension) to where the files must be copied.
DeleteAfter - if b7 set, then the files in the source directory are removed after a succesfull copy.
AddToHistory (string SiteID,
string LogFile1)
This method is used to add the imported Log file's details to the LogHistory file (generated into child method).
Parameters:
SiteID - the site identifier from whence the log file came.
LogFile1 - the name of the logfile to be recorded.
Export (<*File FileID>,
<string SiteLow>,
<string SiteHi>,
<string pSiteID>,
byte pOptions=0)
This method is used to export the data (or portions of the data) to a log file.
Parameters:
FileID - the data file to export (if omitted all registered data files are exported)
SiteLow - the site limiter (i.e. only export the records pertaining to this site). If omitted, all are exported.
SiteHi - the site range limiter. If present, the records pertaining to the site range SiteID to Site Hi are exported.
Methods Called:
SiteID - the Site for which this export is intended.
pOptions - bit loaded flag. Indicates if this is a Synchronization.
Open, OpenFile, Insert, PrimeLog, CloseFile.
ProcessMovedFiles (string FilesTo, 
<string SiteID>,
<string ToSiteID>, <string LastFileOut>,
<string LowSiteID>), string
This method makes subsets of the log files for distribution to children. Returns the last file name that was processed
Parameters:
FilesTo - the directory where the logfile subset will be made (cannot be the same as the outgoingdir property)
SiteID - If not omitted the records in the subset are limited to this site.
ToSiteID - if not omitted, this is the top limit of the range for the records included in the subset.
LastFileOut - if not omitted, contains the file to start processing. 
LowSiteID - if not omitted, this forms the low Site limit (in place of SiteID).
CopyOut (if files must be copied directly out and not processed)
BytesDone (string SiteID,
long CurrentNumber),
long
This method is used to return the amount of bytes of the last partial log file received from a particular Site. Returns a -2 (we've missed some files), a -1 (we've done this file), a 0 (imported completely) or the LastSize. 
Parameters:
SiteID - the site name 
CurrentNumber - the number of the file to import
NewInDir (string SiteID,
byte Options=0),
string
This method creates a new out going directory for a specific site. It returns the name of the directory created.
Parameters:
SiteID - The name of the site.
Options - bit loaded flag. b0 = complete path sent (if set)
FileChange (*File FileID,
string FileName,
string FileCommand)
This method provides a callback during import when you can place some code to perform a calculation on an adjusted field.
Parameters:
FileID - the handle of the file which is receiving the change
FileName - the name of the table which is receiving the change
FileCommand - specifies whether record is being added, changed or deleted.
SendRequestedFiles (string FromFile,
string FromSite,
string SiteHi,
string Outpath,
<string ToEmail>,
byte MissingEOF=0), string
This method enables you to send requested logfiles to a relating site. It can also stamp an EOF if this has been omitted from one of the log files.
Parameters:
FromFile = The first logfile to resend
FromSite = The site (or Site low range) to send the logfiles to
SiteHi = The high range site limiter
OutPath =  Directory to place the logfiles
ToEmail = the address to send the logfiles to
MissingEOF = check for EOF and stamp if necessary.
Methods called:
ProcessMovedFiles, StampEOF 
TagReceived (string Action,
string FileLabel,
string Tag,
<string ValueStr>)
This method is used to indicate a tag (in a file) that is not a field/MEMO that is received. This allows code to be placed in the import routine if a Custom Command is used in the logfile.
Parameters:
Action - insert/update/delete/updatefull
FileLabel - the label of the file containing the tag.
Tag - the label of the command/tag/field.
ValueStr - the value associated with the Tag.
FileCrypt 
(*string FileName,
long options),long
This method loops through a logfile and en/decrypts it. Returns a 0 if file is correctly encrypted. -1 for no file found, or errorcode().
Parameters:
FileName - the name of the logfile to en/decrypt
Option - bit0 - set to decrypt and clear to encrypt.
EncryptString (*string UnEncryptedData,
long StringLen),long
This method encrypts the data passed to the method. This requires an encryptor (like Capesoft's encryption - included in Replicate). Returns a 0 for a successful encryption.
Parameters:
UnEncryptedData - the string handle of the data to encrypt
StringLen - the bytes size of the data to encrypt
DecryptString (*string EncryptedData,
long StringLen),long
This method decrypts the data passed to the method. This requires an encryptor (like Capesoft's encryption - included in Replicate). Returns a 0 for a successful decryption.
Parameters:
EncryptedData - the string handle of the data to decrypt
StringLen - the bytes size of the data to decrypt
Requisition (string pRequest,
string pSiteID,
<string pPathName>,
<string pRequestDetails>,
<string pInform>,
byte pOptions=0),
string
This method generates a request file for (a) logfile(s) from a relating site. It returns a the file name (if successful) or errorcode or 0 if not.
Parameters:
pRequest: The request to be generated.
pSiteID: The SiteID of the requisition to be made to.
pPathname: Path to copy the MessageFile to.
pRequestDetails: include if requesting a file.
pInform: name of the tag for the request (bydefault request)
pOptions: Bit loaded flagif set the MessageFile is not removed from the logpath, Request is a Synchronization.
LoadSitesProperties (string pSiteID),long This method is used to Get the relationship record (to the pSiteID) and set any connection properties.
Parameters:
SiteID - the label of the Site's properties to load.
CheckRequestFile (string pFileName),long This method tests if a logfile is a Request file or not. Returns a 1 if true, otherwise a 0.
Parameters:
pFileName - The File to be tested.
ReceiveRequest (string pRequestFile,
byte pOptions=0),long
This method processes a request file and sends the required files to the relevant sites.
Parameters:
pRequestFile - The name of the RequestFile.
pOptions - Reserved for later use.
AutoProcessFiles (<string pSiteID>,
<string pFromFile>,
byte pOnlyThisOne=0)
This method will process loops through the SiteFile and processes the logfiles for each relating site. It is template generated.
Parameter:
pSiteID - Omit for all sites, otherwise only does the logfiles for the Site specified.
pFromFile - If not omitted, does from the specified file, otherwise takes from the latest (as in the SiteFile).
OnlyThisOne - if set, then only the one logfile is sent (and not subsequent as well).
ConnectionDetails (string pRelatingSite,
<string pRelatingOutDir>,
<string pTransport>,
long pLogFileNumber=0,
byte pDontSendFiles=0),
string
This method populates a string with all the connection details required to setup the