[BUGFIX] Better performance of DatabaseConnection->getDateTimeFormats
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Database / DatabaseConnection.php
index 7814790..7fe5ab5 100644 (file)
@@ -166,6 +166,22 @@ class DatabaseConnection {
 
 
        /**
+        * the date and time formats compatible with the database in general
+        *
+        * @var array
+        */
+       static protected $dateTimeFormats = array(
+               'date' => array(
+                       'empty' => '0000-00-00',
+                       'format' => 'Y-m-d'
+               ),
+               'datetime' => array(
+                       'empty' => '0000-00-00 00:00:00',
+                       'format' => 'Y-m-d H:i:s'
+               )
+       );
+
+       /**
         * Initialize the database connection
         *
         * @return void
@@ -952,16 +968,7 @@ class DatabaseConnection {
         * @return array
         */
        public function getDateTimeFormats($table) {
-               return array(
-                       'date' => array(
-                               'empty' => '0000-00-00',
-                               'format' => 'Y-m-d'
-                       ),
-                       'datetime' => array(
-                               'empty' => '0000-00-00 00:00:00',
-                               'format' => 'Y-m-d H:i:s'
-                       )
-               );
+               return self::$dateTimeFormats;
        }
 
        /**************************************