ImportCumulusFile: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
1,374 bytes added ,  12:45, 11 May 2020
m
no edit summary
No edit summary
mNo edit summary
Line 1: Line 1:
{{AddOnBanner|name=ImportCumulusFile|type=PHP|author=David A Jamieson / Mark Crossley|contact='DAJ' / 'mcrossley' via the forum|updated=05 May 2020|version=4.1}}
{{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 webserver and import Cumulus log files into a MySQL database on your server.
This is a PHP script designed to run on your web 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=
=Requirements=
The web server must have..
The web server must have..
*PHP
*PHP
Line 9: Line 13:
*A My SQL database, username and password
*A My SQL database, username and password
*a Cumulus Log already uploaded
*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+=
=IMPORTANT NOTE FOR VERSION 4.0+=
Line 180: Line 186:


== Dayfile table ==
== 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>
<pre>
'LogDate',        'date NOT NULL'
'LogDate',        'date NOT NULL'
Line 190: Line 197:
'MaxTemp',        'decimal(5,1) NOT NULL'
'MaxTemp',        'decimal(5,1) NOT NULL'
'TMaxTemp',      'varchar(5) NOT NULL'
'TMaxTemp',      'varchar(5) NOT NULL'
'MinPress',      'decimal(6,2) NOT NULL'),                   // 8
'MinPress',      'decimal(6,2) NOT NULL'),                
'TMinPress',      'varchar(5) NOT NULL'
'TMinPress',      'varchar(5) NOT NULL'
'MaxPress',      'decimal(6,2) NOT NULL'
'MaxPress',      'decimal(6,2) NOT NULL'
Line 234: Line 241:


== Monthly table ==
== 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>
<pre>
'LogDateTime',        'DATETIME NOT NULL'
'LogDateTime',        'DATETIME NOT NULL'
5,838

edits

Navigation menu