ImportCumulusFile: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
{{AddOnBanner|name=ImportCumulusFile|type=PHP|author=David A Jamieson / Mark Crossley|contact='DAJ' / 'mcrossley' via the forum|updated=05 May 2020|version=4.1}}
 
This is a PHP script designed to run on your webserverweb server and will import Cumulus log files into a MySQL database table on your server.
 
= Applicability to Cumulus 1 and MX =
This script was originally written for Cumulus 1, but from Version 4.0 onwards it will only work with Cumulus MX. Please be aware that for Cumulus MX the daily and monthly tables in the database can also be updated with rows for past dates by using ExportMySQL.exe. For infor
 
=Requirements=
 
The web server must have..
*PHP
*A My SQL database, username and password
*a Cumulus Log already uploaded
 
'''This script will create a table if no table exists for the selected log file'''. Be aware that as the schema varies for different script versions, ''if a table already exists it must already have the number of columns in the table to match the number of columns populated in the version of the script you choose to use''. It does not matter if the table has more column than the number of fields in the Cumulus log file, because from version 1.3(b) of the script all schemas only prohibit nulls in the columns that are present in log file for all cumulus versions. Columns for fields only present in newer Cumulus versions permit nulls, so any columns where no filed is available will be populated with a null.
 
=IMPORTANT NOTE FOR VERSION 4.0+=
 
== Dayfile table ==
 
The database table that mirrors dayfile.txt (as at version 1.9.4) has the following schema (column names and their format):
The database table that mirrors dayfile.txt (with its fields as at Cumulus version 1.9.4) has the following schema at version 1.3 to 3.2 inclusive (column names and their format), for earlier Cumulus 1 versions with fewer fields, the schema will also work because all columns after 'TotWindRun' can default to null values:
<pre>
'LogDate', 'date NOT NULL'
'MaxTemp', 'decimal(5,1) NOT NULL'
'TMaxTemp', 'varchar(5) NOT NULL'
'MinPress', 'decimal(6,2) NOT NULL'), // 8
'TMinPress', 'varchar(5) NOT NULL'
'MaxPress', 'decimal(6,2) NOT NULL'
 
== Monthly table ==
For versions below 2.0, the first column as shown below did not exist, instead there was one column for date and one column for time.
<pre>
'LogDateTime', 'DATETIME NOT NULL'
5,838

edits