Page 1 of 1

TimeTrex and MySQL Timezone

Posted: Mon Sep 25, 2006 7:37 pm
by matthewk
Ok, I have read the FAQ from here in regards to the timezone import, and have done those steps, checked inside phpMyAdmin and the zimezone tables appear and are now populated with data.
http://forums.timetrex.com/viewtopic.php?t=40

However, im still getting an error as soon as I log in, and it goes to EditUser.php (freshly installed timetrex)

Code: Select all

Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysqlt error: [1298: Unknown or incorrect time zone: ''] in EXECUTE("SET SESSION time_zone=''") ' in /opt/lampp/htdocs/timetrex/classes/adodb/adodb-exceptions.inc.php:78 Stack trace: #0 /opt/lampp/htdocs/timetrex/classes/adodb/adodb.inc.php(886): adodb_throw('mysqlt', 'EXECUTE', 1298, 'Unknown or inco...', 'SET SESSION tim...', false, Object(ADODB_mysqlt)) #1 /opt/lampp/htdocs/timetrex/classes/adodb/adodb.inc.php(861): ADOConnection->_Execute('SET SESSION tim...', false) #2 /opt/lampp/htdocs/timetrex/includes/Interface.inc.php(77): ADOConnection->Execute('SET SESSION tim...') #3 /opt/lampp/htdocs/timetrex/interface/users/EditUser.php(29): require_once('/opt/lampp/htdo...') #4 {main} thrown in /opt/lampp/htdocs/timetrex/classes/adodb/adodb-exceptions.inc.php on line 78
Any idea's, as I cant seem to work out what it actually wants.

Re: TimeTrex and MySQL Timezone

Posted: Tue Sep 26, 2006 2:08 pm
by mikeb
matthewk wrote:Ok, I have read the FAQ from here in regards to the timezone import, and have done those steps, checked inside phpMyAdmin and the zimezone tables appear and are now populated with data.
http://forums.timetrex.com/viewtopic.php?t=40

However, im still getting an error as soon as I log in, and it goes to EditUser.php (freshly installed timetrex)

Code: Select all

Fatal error: Uncaught exception 'ADODB_Exception' with message 'mysqlt error: [1298: Unknown or incorrect time zone: ''] in EXECUTE("SET SESSION time_zone=''") ' in /opt/lampp/htdocs/timetrex/classes/adodb/adodb-exceptions.inc.php:78 Stack trace: #0 /opt/lampp/htdocs/timetrex/classes/adodb/adodb.inc.php(886): adodb_throw('mysqlt', 'EXECUTE', 1298, 'Unknown or inco...', 'SET SESSION tim...', false, Object(ADODB_mysqlt)) #1 /opt/lampp/htdocs/timetrex/classes/adodb/adodb.inc.php(861): ADOConnection->_Execute('SET SESSION tim...', false) #2 /opt/lampp/htdocs/timetrex/includes/Interface.inc.php(77): ADOConnection->Execute('SET SESSION tim...') #3 /opt/lampp/htdocs/timetrex/interface/users/EditUser.php(29): require_once('/opt/lampp/htdo...') #4 {main} thrown in /opt/lampp/htdocs/timetrex/classes/adodb/adodb-exceptions.inc.php on line 78
Any idea's, as I cant seem to work out what it actually wants.
Unfortunately this bug sneaked in to v1.2.0-beta2, it'll be fixed for beta3. In the mean time you can fix it by doing the following:

At line 74 of includes/Interface.inc.php change:

Code: Select all

                //Since MySQL can't store timezones in timestamp columns,
                //We need to set the timezone for this MySQL session.
                if ( $db->dataProvider == 'mysql' ) {
                        $db->Execute('SET SESSION time_zone=\''. $current_user_prefs->getTimeZone() .'\'');
                }
to:

Code: Select all

                //Since MySQL can't store timezones in timestamp columns,
                //We need to set the timezone for this MySQL session.
                $db_time_zone_error = FALSE;
                if ( $db->dataProvider == 'mysql' AND $current_user_prefs->getTimeZone() != '' ) {
                        //Instead of using timezone names, we could set time_zone = "-08:00";
                        //This might get around the fact that MySQL doesn't always have timezone data imported.
                        if ( @$db->Execute('SET SESSION time_zone=\''. $current_user_prefs->getTimeZone() .'\'') ==
FALSE ) {
                                //Setting timezone failed, alert user to this fact.
                                $db_time_zone_error = TRUE;
                        }
                }


Posted: Wed Sep 27, 2006 2:32 pm
by shaunw
Mathew, TimeTrex v1.2.0 beta3 fixes this bug and was released yesterday. If you get a chance please give it a try and let us know.