Index: mysqlhistlog2300.c =================================================================== --- mysqlhistlog2300.c (revisione 9) +++ mysqlhistlog2300.c (copia locale) @@ -56,8 +56,8 @@ MYSQL mysql, *mysql_connection; int mysql_state; char mysql_insert_stmt[512] = - "INSERT INTO weather(timestamp, rec_date, rec_time, temp_in,temp_out, dewpoint, rel_hum_in, " - "rel_hum_out, windspeed, wind_angle, wind_direction,wind_chill, rain_total, rel_pressure)"; + "INSERT INTO weather(datetime, temp_in, temp_out, dewpoint, rel_hum_in, " + "rel_hum_out, wind_speed, wind_angle, wind_direction,wind_chill, rain_total, rel_pressure)"; char mysql_values_stmt[512], mysql_stmt[1024]; int interval, countdown, no_records; @@ -182,7 +182,7 @@ // If humidity is > 100 the record is skipped if(humidity_out < 100) { - strftime(datestring,sizeof(datestring),"\"%Y%m%d%H%M%S\",\"%Y-%m-%d\",\"%H:%M:%S\"", + strftime(datestring,sizeof(datestring),"\"%Y-%m-%d %H:%M:%S\"", &time_lastrecord_tm); // Line up all value in order of appearance in the database sprintf(mysql_values_stmt," VALUES(%s", datestring); Index: mysql2300.c =================================================================== --- mysql2300.c (revisione 9) +++ mysql2300.c (copia locale) @@ -43,40 +43,20 @@ * * The open2300.conf config file must contain the following parameters * - * Table structure for table `weather` + * Table structure for table `weather` is shown in mysql2300.sql file * -DROP TABLE IF EXISTS `weather`; -CREATE TABLE `weather` ( - `datetime` datetime NOT NULL default '0000-00-00 00:00:00', - `temp_in` decimal(3,1) NOT NULL default '0.0', - `temp_out` decimal(3,1) NOT NULL default '0.0', - `dewpoint` decimal(3,1) NOT NULL default '0.0', - `rel_hum_in` tinyint(3) NOT NULL default '0', - `rel_hum_out` tinyint(3) NOT NULL default '0', - `wind_speed` decimal(3,1) NOT NULL default '0.0', - `wind_angle` decimal(3,1) NOT NULL default '0.0', - `wind_direction` char(3) NOT NULL default '', - `wind_chill` decimal(3,1) NOT NULL default '0.0', - `rain_1h` decimal(3,1) NOT NULL default '0.0', - `rain_24h` decimal(3,1) NOT NULL default '0.0', - `rain_total` decimal(4,1) NOT NULL default '0.0', - `rel_pressure` decimal(4,1) NOT NULL default '0.0', - `tendency` varchar(7) NOT NULL default '', - `forecast` varchar(6) NOT NULL default '', - UNIQUE KEY `timestamp` (`datetime`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - - * If you already have the 'weather' table of the previous * release(<=1.3), launch these SQL commands to modify it correctly: -ALTER TABLE `open2300`.`weather` MODIFY COLUMN `timestamp` DATETIME DEFAULT '0000-00-00 00:00:00'; +ALTER TABLE `open2300`.`weather` MODIFY COLUMN `timestamp` DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL; ALTER TABLE `open2300`.`weather` DROP COLUMN `rec_date`; ALTER TABLE `open2300`.`weather` DROP COLUMN `rec_time`; -ALTER TABLE `open2300`.`weather` CHANGE COLUMN `timestamp` `datetime` DATETIME NOT NULL DEFAULT 0; -ALTER TABLE `open2300`.`weather` CHANGE COLUMN `windspeed` `wind_speed` DECIMAL(3,1) NOT NULL DEFAULT 0; +ALTER TABLE `open2300`.`weather` CHANGE COLUMN `timestamp` `datetime` DATETIME NOT NULL DEFAULT 0; +ALTER TABLE `open2300`.`weather` CHANGE COLUMN `windspeed` `wind_speed` DECIMAL(3,1) NOT NULL DEFAULT 0; +ALTER TABLE `open2300`.`weather` CHANGE COLUMN `rel_pressure` `rel_pressure` DECIMAL(5,1) NOT NULL; +ALTER TABLE `open2300`.`weather` CHANGE COLUMN `rain_total` `rain_total` DECIMAL(5,1) NOT NULL; +ALTER TABLE `open2300`.`weather` CHANGE COLUMN `wind_angle` `wind_angle` DECIMAL(4,1) NOT NULL; - * It takes one parameters. The config file name with path * If this parameter is omitted the program will look at the default paths * See the open2300.conf-dist file for info Index: mysql2300.sql =================================================================== --- mysql2300.sql (revisione 9) +++ mysql2300.sql (copia locale) @@ -1,31 +1,15 @@ -# phpMyAdmin SQL Dump -# version 2.5.4 -# http://www.phpmyadmin.net # -# Host: localhost -# Generation Time: Feb 21, 2004 at 02:04 AM -# Server version: 4.0.16 -# PHP Version: 4.3.3 -# -# Database : `weather` -# - -# -------------------------------------------------------- - -# # Table structure for table `weather` # CREATE TABLE `weather` ( - `timestamp` bigint(14) NOT NULL default '0', - `rec_date` date NOT NULL default '0000-00-00', - `rec_time` time NOT NULL default '00:00:00', + `datetime` datetime NOT NULL default '0000-00-00 00:00:00', `temp_in` decimal(3,1) NOT NULL default '0.0', `temp_out` decimal(3,1) NOT NULL default '0.0', `dewpoint` decimal(3,1) NOT NULL default '0.0', `rel_hum_in` tinyint(3) NOT NULL default '0', `rel_hum_out` tinyint(3) NOT NULL default '0', - `windspeed` decimal(3,1) NOT NULL default '0.0', + `wind_speed` decimal(3,1) NOT NULL default '0.0', `wind_angle` decimal(4,1) NOT NULL default '0.0', `wind_direction` char(3) NOT NULL default '', `wind_chill` decimal(3,1) NOT NULL default '0.0',