Journalreadtodatasource()
Reads a journal file into the database table specified, returning back a structure with the details of the request. The table will have the columns: T_OFFSET, CODE, FILE_ID, SESSION, FILE_DEPTH, TAG_DEPTH, TAG, LINE, COL, FN, SCRIPTLINE, JOURNALID, ID
Usage
STRUCTURE = Journalreadtodatasource(
file,
datasource,
id,
table
)
Argument | Summary |
---|---|
file | full path of the journal file to read |
datasource | the datasource to use to store the journal to |
id | id to use for this journal. this makes it possible to store multiple journal files in a single table; defaults to 1 [optional] |
table | the name of the table to insert the data to; defaults to 'journal' [optional] |
Calling
Supports named-parameter calling allowing you to use the function like:
Journalreadtodatasource( file=?, datasource=?, id=?, table=? );
Supports passing parameters as a structure using ArgumentCollection:
Journalreadtodatasource( ArgumentCollection={ file : ?, datasource : ?, id : ?, table : ? } );
Extra
This function makes it easy to read the session data into a table. For large journal files, it is more efficient to read the data into a database to work with. If you do not have a database handy, you can easily use the embedded database that ships with OpenBD, H2 (http://h2database.com/).
This function will create the underlying table if it does not already exist. There is a primary key placed on the JOURNAL_ID and ID columns.
<cfscript> if ( !DataSourceIsValid("tmpJournal") ){ ds = { databasename : "Session1", drivername : "org.h2.Driver", hoststring : "jdbc:h2:file:c:/data/tmpjournal;MODE=MYSQL" }; DataSourceCreate( "tmpJournal", ds ); } JournalReadToDataSource( datasource="tmpJournal", file="c:/tmp/2015-02-07_11.51.07-34.txt" ); </cfscript>