CVS: phpweather/db pw_db_dba.php,1.6,1.7
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2002-03-26 18:50:10
|
Update of /cvsroot/phpweather/phpweather/db In directory usw-pr-cvs1:/tmp/cvs-serv13610 Modified Files: pw_db_dba.php Log Message: Aha! Some METARs had colons in them, which is the same character I use to separate the METAR from the timestamp. When the data was retrieved later and run through explode, this caused trouble. Index: pw_db_dba.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/pw_db_dba.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- pw_db_dba.php 25 Mar 2002 23:26:10 -0000 1.6 +++ pw_db_dba.php 26 Mar 2002 18:50:06 -0000 1.7 @@ -141,6 +141,10 @@ /** * Inserts a METAR into the database. * + * Any colons (:) in the METAR is changed into semi-colons (;). The + * colons has nothing to do in the body of the METAR, so this wont + * effect the parsing as the remarks isn't parsed anyway. + * * @param string The ICAO of the station. * @param string The raw METAR. * @param integer A standard UNIX timestamp. @@ -149,12 +153,16 @@ */ function insert_metar($station, $metar, $timestamp) { $this->debug("Inserting this row into the DBA database:<br><code>$metar:$timestamp</code>"); - dba_insert($station, $metar . ':' . $timestamp, $this->link_id); + dba_insert($station, strtr($metar, ':', ';') . ':' . $timestamp, $this->link_id); } /** * Updates an existing METAR in the database. * + * Any colons (:) in the METAR is changed into semi-colons (;). The + * colons has nothing to do in the body of the METAR, so this wont + * effect the parsing as the remarks isn't parsed anyway. + * * @param string The ICAO of the station. * @param string The raw METAR. * @param integer A standard UNIX timestamp. @@ -163,7 +171,7 @@ */ function update_metar($station, $metar, $timestamp) { $this->debug("Updating this row in the DBA database:<br><code>$metar:$timestamp</code>"); - dba_replace($station, $metar . ':' . $timestamp, $this->link_id); + dba_replace($station, strtr($metar, ':', ';') . ':' . $timestamp, $this->link_id); } /** |