Re: Keeping Mears in Database
Brought to you by:
iridium
From: Ondrej J. <ne...@po...> - 2003-04-07 00:29:11
|
On Sun, 6 Apr 2003, Martin Geisler wrote: > >> Is there a quick workaround to keep the old metars? Or do I have to > >> adjust db/pw_db_mysql.php and subsequently date_retrieval.php to > >> have a fourth column with the actual system time as part of the > >> key? > > Several times ago I also wanted to have this feature. But there was > > no such time for its implementation. Martin, I think this is written > > on the long-term TODO list, isn't it? ;-) > But as Klaus notes, then it shouldn't be that difficult for the SQL > based backends: just fetch the newest METAR for a given station per > default and then always insert new METARs instead of replacing the one > ones. But looking at the database schema of "metars" table [1], "icao" is a primary key, thus inserting additional metar for particular airport may cause problems. So this won't be possible to implementent without database schema change. We can remove primary key completely, or extend it with "timestamp" field. In the second case new primary key will contain "icao" and "timestamp" columns. [1] Database schema of "metars" table mysql/phpweather> \d metars +--------+-----------+-----------+-----+--------------------------------------+ | table | name | type | len | flags | +--------+-----------+-----------+-----+--------------------------------------+ | metars | icao | string | 4 | not_null primary_key unique_key | | metars | metar | string | 255 | not_null | | metars | timestamp | timestamp | 14 | not_null unsigned zerofill timestamp | +--------+-----------+-----------+-----+--------------------------------------+ mysql/phpweather> -- _/| Ondrej Jombik - ne...@ph... - http://www.nepto.sk - OJ812-RIPE <_ \ Platon SDG - open source software development - http://platon.sk `\| This message was written with Pine, the fastest IMAP mail client '` |