CVS: phpweather/db pw_db_mysql.php,1.2,1.3
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2002-03-25 19:32:23
|
Update of /cvsroot/phpweather/phpweather/db In directory usw-pr-cvs1:/tmp/cvs-serv3394 Modified Files: pw_db_mysql.php Log Message: It seams that the Debian guys have decided to include MySQL support as a loadable module for Apache. So I needed these lines to make things work. I've looked at how things are done in phpMyAdmin so I think it will work on Windows too. Index: pw_db_mysql.php =================================================================== RCS file: /cvsroot/phpweather/phpweather/db/pw_db_mysql.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- pw_db_mysql.php 20 Mar 2002 19:26:50 -0000 1.2 +++ pw_db_mysql.php 25 Mar 2002 19:32:18 -0000 1.3 @@ -13,11 +13,20 @@ class pw_db_mysql extends pw_db_common { /** - * This constructor does nothing besides calling the parent constructor. + * This constructor does nothing besides calling the parent + * constructor. * * @param array the initial properties of the object */ function pw_db_mysql($input) { + /* We have to load the MySQL extension on some systems: */ + if (!extension_loaded('mysql')) { + if (ereg('win', PHP_OS)) { + dl('mysql.dll'); + } else { + dl('mysql.so'); + } + } $this->pw_db_common($input); } @@ -219,8 +228,7 @@ metar varchar(255) NOT NULL, timestamp timestamp(14), PRIMARY KEY (icao), - UNIQUE icao (icao) -)'); + UNIQUE icao (icao))'); /* Then we make a table for the stations. */ $this->query('DROP TABLE IF EXISTS ' . $this->properties['db_stations']); @@ -231,8 +239,7 @@ country varchar(128) NOT NULL, PRIMARY KEY (icao), UNIQUE icao (icao), - KEY cc (cc) -)'); + KEY cc (cc))'); return true; // Succes! |