[ghelda-devel] [12] Convert to MDB2; thus lowercase the options. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/ghelda-devel Archives
]
Revision: 12
Author: odyx
Date: 2009-03-04 17:56:55 +0100 (Wed, 04 Mar 2009)
Log Message:
-----------
Convert to MDB2; thus lowercase the options.
This is a big change, but should work correctly (at least not worse as now). Please report if not.
Modified Paths:
--------------
trunk/init/auth.php
trunk/init/db.php
trunk/plugins/Address/config.php
trunk/plugins/Address/config_core.php
trunk/plugins/People/config_core.php
Modified: trunk/init/auth.php
===================================================================
--- trunk/init/auth.php 2009-03-04 16:27:40 UTC (rev 11)
+++ trunk/init/auth.php 2009-03-04 16:56:55 UTC (rev 12)
@@ -38,7 +38,7 @@
);
// TODO: Use the same DataBase Handler
-$g_H_Auth = new g_Auth($g_H_DB,"DB", $g_AuthOptions,'',false);
+$g_H_Auth = new g_Auth($g_H_DB,"MDB2", $g_AuthOptions,'',false);
$g_H_Auth->setIdle($g_Config['Auth']['idle']);
$g_H_Auth->setIdle($g_Config['Auth']['expire']);
Modified: trunk/init/db.php
===================================================================
--- trunk/init/db.php 2009-03-04 16:27:40 UTC (rev 11)
+++ trunk/init/db.php 2009-03-04 16:56:55 UTC (rev 12)
@@ -21,11 +21,11 @@
*/
require_once 'PEAR.php';
-require_once 'DB.php';
-require_once "DB/mysqli.php";
+require_once 'MDB2.php';
+require_once "MDB2/Driver/mysql.php";
//! Automagically report of the queries sent in class DB_mysqli
-class DB_mysqlilog extends DB_mysqli
+class MDB2_Driver_mysqllog extends MDB2_Driver_mysql
{
//! Standard error level of the given queries
/*!
@@ -33,23 +33,26 @@
*/
private $errorLevel = E_USER_WARNING;
- function simpleQuery($query)
+ function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
trigger_error('[SQL] '.$query,$this->errorLevel);
- return parent::simpleQuery($query);
+ return parent::_doQuery($query, $is_manip = false, $connection = null, $database_name = null);
}
}
-$g_Config['DB']['DSN']['phptype'] = 'mysqlilog';
+$g_Config['DB']['DSN']['phptype'] = 'mysqllog';
// Create the Database handler (debug < 2 to avoid the errors of inclusion)
-$g_H_DB =& DB::connect($g_Config['DB']['DSN'],array('debug' => 1));
+$g_H_DB =& MDB2::connect($g_Config['DB']['DSN'],array('debug' => 1));
+// Use the extended Module (access to getAssoc() )
+$g_H_DB->loadModule('Extended');
+
if (PEAR::isError($g_H_DB)) {
$Logger->err($g_H_DB->getMessage());
} else {
// Configure it to always render results in "assoc" mode
- $g_H_DB->setFetchMode(DB_FETCHMODE_ASSOC);
+ $g_H_DB->setFetchMode(MDB2_FETCHMODE_ASSOC);
}
/*
Modified: trunk/plugins/Address/config.php
===================================================================
--- trunk/plugins/Address/config.php 2009-03-04 16:27:40 UTC (rev 11)
+++ trunk/plugins/Address/config.php 2009-03-04 16:56:55 UTC (rev 12)
@@ -19,18 +19,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-$conf['select']['list'][] = 'Country_iso2';
-$conf['select']['list'][] = 'ZipCode';
-$conf['select']['list'][] = 'City';
-$conf['select']['list'][] = 'PostalBox';
-$conf['select']['list'][] = 'Address';
+// Values must be lowercase (see config_core.php)
-$conf['select']['orderby'][] = 'ZipCode';
-$conf['select']['orderby'][] = 'Address';
+$conf['select']['list'][] = 'country_iso2';
+$conf['select']['list'][] = 'zipcode';
+$conf['select']['list'][] = 'city';
+$conf['select']['list'][] = 'postalbox';
+$conf['select']['list'][] = 'address';
-$conf['select']['optgroup']['id'] = '<Country_iso2>_<ZipCode>';
-$conf['select']['optgroup']['name'] = '<Country_iso2>, <ZipCode> <City>';
+$conf['select']['orderby'][] = 'zipcode';
+$conf['select']['orderby'][] = 'address';
-$conf['select']['format'] = '<Address>';
+$conf['select']['optgroup']['id'] = '<country_iso2>_<zipcode>';
+$conf['select']['optgroup']['name'] = '<country_iso2>, <zipcode> <city>';
+$conf['select']['format'] = '<address>';
+
?>
\ No newline at end of file
Modified: trunk/plugins/Address/config_core.php
===================================================================
--- trunk/plugins/Address/config_core.php 2009-03-04 16:27:40 UTC (rev 11)
+++ trunk/plugins/Address/config_core.php 2009-03-04 16:56:55 UTC (rev 12)
@@ -18,6 +18,9 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
+// All fields values _must_ be lowercase due to MSDB2 weird handling of field names.
+
// Required
$conf['fields']['address_id']['type'] = 'INT( 10 )';
$conf['fields']['address_id']['name'] = T_('Identifier');
@@ -26,37 +29,37 @@
// Optional
-$conf['fields']['Address']['type'] = 'TEXT';
-$conf['fields']['Address']['name'] = T_('Address');
-$conf['fields']['Address']['order'] = 50;
+$conf['fields']['address']['type'] = 'TEXT';
+$conf['fields']['address']['name'] = T_('Address');
+$conf['fields']['address']['order'] = 50;
-$conf['fields']['PostalBox']['type'] = 'VARCHAR( 256 )';
-$conf['fields']['PostalBox']['name'] = T_('Postal Box');
-$conf['fields']['PostalBox']['order'] = 45;
+$conf['fields']['postalbox']['type'] = 'VARCHAR( 256 )';
+$conf['fields']['postalbox']['name'] = T_('Postal Box');
+$conf['fields']['postalbox']['order'] = 45;
-$conf['fields']['City']['type'] = 'VARCHAR( 256 )';
-$conf['fields']['City']['name'] = T_('City');
-$conf['fields']['City']['order'] = 40;
+$conf['fields']['city']['type'] = 'VARCHAR( 256 )';
+$conf['fields']['city']['name'] = T_('City');
+$conf['fields']['city']['order'] = 40;
-$conf['fields']['Region']['type'] = 'VARCHAR( 256 )';
-$conf['fields']['Region']['name'] = T_('Region');
-$conf['fields']['Region']['order'] = 30;
+$conf['fields']['region']['type'] = 'VARCHAR( 256 )';
+$conf['fields']['region']['name'] = T_('Region');
+$conf['fields']['region']['order'] = 30;
-$conf['fields']['ZipCode']['type'] = 'VARCHAR( 10 )';
-$conf['fields']['ZipCode']['name'] = T_('Zip Code');
-$conf['fields']['ZipCode']['order'] = 45;
+$conf['fields']['zipcode']['type'] = 'VARCHAR( 10 )';
+$conf['fields']['zipcode']['name'] = T_('Zip Code');
+$conf['fields']['zipcode']['order'] = 45;
-$conf['fields']['Country_iso2']['type'] = 'COUNTRY';
-$conf['fields']['Country_iso2']['name'] = T_('Country');
-$conf['fields']['Country_iso2']['order'] = 20;
+$conf['fields']['country_iso2']['type'] = 'COUNTRY';
+$conf['fields']['country_iso2']['name'] = T_('Country');
+$conf['fields']['country_iso2']['order'] = 20;
-$conf['fields']['Phone']['type'] = 'VARCHAR( 16 )';
-$conf['fields']['Phone']['name'] = T_('Phone number');
-$conf['fields']['Phone']['order'] = 15;
+$conf['fields']['phone']['type'] = 'VARCHAR( 16 )';
+$conf['fields']['phone']['name'] = T_('Phone number');
+$conf['fields']['phone']['order'] = 15;
-$conf['fields']['Fax']['type'] = 'VARCHAR( 16 )';
-$conf['fields']['Fax']['name'] = T_('Fax number');
-$conf['fields']['Fax']['order'] = 10;
+$conf['fields']['fax']['type'] = 'VARCHAR( 16 )';
+$conf['fields']['fax']['name'] = T_('Fax number');
+$conf['fields']['fax']['order'] = 10;
// Needed.
$conf['select']['list'][] = G_ADDRESS_ID;
Modified: trunk/plugins/People/config_core.php
===================================================================
--- trunk/plugins/People/config_core.php 2009-03-04 16:27:40 UTC (rev 11)
+++ trunk/plugins/People/config_core.php 2009-03-04 16:56:55 UTC (rev 12)
@@ -18,6 +18,9 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
+// All fields values _must_ be lowercase due to MSDB2 weird handling of field names.
+
// Required
$conf['fields_core'][G_DB_PEOPLE_ID]['type'] = 'INT( 10 )';
$conf['fields_core'][G_DB_PEOPLE_ID]['name'] = T_('Identifier');
@@ -46,41 +49,40 @@
// Optional
-$conf['fields']['Name']['type'] = 'VARCHAR( 128 )';
-$conf['fields']['Name']['name'] = T_('Name');
-$conf['fields']['Name']['order'] = 50;
+$conf['fields']['name']['type'] = 'VARCHAR( 128 )';
+$conf['fields']['name']['name'] = T_('Name');
+$conf['fields']['name']['order'] = 50;
-$conf['fields']['Surname']['type'] = 'VARCHAR( 128 )';
-$conf['fields']['Surname']['name'] = T_('Surname');
-$conf['fields']['Surname']['order'] = 60;
+$conf['fields']['surname']['type'] = 'VARCHAR( 128 )';
+$conf['fields']['surname']['name'] = T_('Surname');
+$conf['fields']['surname']['order'] = 60;
-$conf['fields']['Genre']['type'] = 'ENUM';
-$conf['fields']['Genre']['name'] = T_('Genre');
-$conf['fields']['Genre']['values']['female'] = T_('female - ♀');
-$conf['fields']['Genre']['values']['male'] = T_('male - ♂');
-$conf['fields']['Genre']['order'] = 40;
+$conf['fields']['genre']['type'] = 'ENUM';
+$conf['fields']['genre']['name'] = T_('Genre');
+$conf['fields']['genre']['values']['female'] = T_('female - ♀');
+$conf['fields']['genre']['values']['male'] = T_('male - ♂');
+$conf['fields']['genre']['order'] = 40;
-$conf['fields']['Date_Birth']['type'] = 'DATE';
-$conf['fields']['Date_Birth']['name'] = T_('Date of birth');
-$conf['fields']['Date_Birth']['order'] = 30;
+$conf['fields']['date_birth']['type'] = 'DATE';
+$conf['fields']['date_birth']['name'] = T_('Date of birth');
+$conf['fields']['date_birth']['order'] = 30;
-$conf['fields']['Date_Death']['type'] = 'DATE';
-$conf['fields']['Date_Death']['name'] = T_('Date of death');
-$conf['fields']['Date_Death']['order'] = 0;
+$conf['fields']['date_death']['type'] = 'DATE';
+$conf['fields']['date_death']['name'] = T_('Date of death');
+$conf['fields']['date_death']['order'] = 0;
-$conf['fields']['Mobile_phone']['type'] = 'VARCHAR( 10 )';
-$conf['fields']['Mobile_phone']['name'] = T_('Mobile phone number');
-$conf['fields']['Mobile_phone']['preg'] = '~^[0-9]{10}$~';
-$conf['fields']['Mobile_phone']['order'] = 20;
+$conf['fields']['mobile_phone']['type'] = 'VARCHAR( 10 )';
+$conf['fields']['mobile_phone']['name'] = T_('Mobile phone number');
+$conf['fields']['mobile_phone']['preg'] = '~^[0-9]{10}$~';
+$conf['fields']['mobile_phone']['order'] = 20;
-$conf['fields']['NNSS']['type'] = 'VARCHAR(16)';
-$conf['fields']['NNSS']['name'] = T_('New Social Security Number');
-$conf['fields']['NNSS']['default'] = '000.0000.0000.00';
-// $conf['fields']['AVS']['ereg'] = '[0-9]{3}\.[0-9]{2}\.[0-9]{3}\.[0-9]{3}';
-$conf['fields']['NNSS']['preg'] = '~^[0-9]{3}[.][0-9]{4}[.][0-9]{4}[.][0-9]{2}$~';
+$conf['fields']['nnss']['type'] = 'VARCHAR(16)';
+$conf['fields']['nnss']['name'] = T_('New Social Security Number');
+$conf['fields']['nnss']['default'] = '000.0000.0000.00';
+// $conf['fields']['nnss']['ereg'] = '[0-9]{3}\.[0-9]{2}\.[0-9]{3}\.[0-9]{3}';
+$conf['fields']['nnss']['preg'] = '~^[0-9]{3}[.][0-9]{4}[.][0-9]{4}[.][0-9]{2}$~';
-$conf['fields']['Comment']['type'] = 'TEXT';
-$conf['fields']['Comment']['name'] = T_('Comment');
+$conf['fields']['comment']['type'] = 'TEXT';
+$conf['fields']['comment']['name'] = T_('Comment');
-
?>
\ No newline at end of file