Changeset 601 for trunk/lib/DB.inc.php


Ignore:
Timestamp:
Apr 27, 2017 4:43:35 PM (7 years ago)
Author:
anonymous
Message:

Updated every instance of 'zero' date 0000-00-00 to use 1000-01-01 if mysql version >= 5.7.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/DB.inc.php

    r575 r601  
    6565        // Script stops on db error. TRUE recommended for production sites.
    6666        'db_die_on_failure' => true,
     67
     68        // Special date settings. These will dynamically changes depending on MySQL version or settings.
     69        'zero_date' => '0000-00-00',
     70        'infinity_date' => '9999-12-31',
    6771    );
    6872
     
    7882
    7983    /**
     84     * Constructor.
     85     */
     86    public function __construct()
     87    {
     88        // Initialize default parameters.
     89        $this->_params = array_merge($this->_params, $this->_param_defaults);
     90    }
     91
     92    /**
    8093     * This method enforces the singleton pattern for this class.
    8194     *
     
    181194        } else {
    182195            $app->logMsg(sprintf('%s is not a known character_set.', $app->getParam('character_set')), LOG_ERR, __FILE__, __LINE__);
     196        }
     197
     198        // Update config for this version of MySQL.
     199        if (version_compare(mysql_get_server_info(), '5.7.4', '>=')) {
     200            $this->setParam(array('zero_date' => '1000-01-01'));
    183201        }
    184202
Note: See TracChangeset for help on using the changeset viewer.