Skip to content

Commit

Permalink
Accommodate field types with zero length
Browse files Browse the repository at this point in the history
  • Loading branch information
drbyte committed May 1, 2021
1 parent b2887b4 commit 3e0ecea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/classes/db/mysql/query_factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @copyright Portions Copyright 2003 osCommerce
* @copyright Portions adapted from http://www.data-diggers.com/
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: DrByte 2021-03-22 $
* @version $Id: DrByte 2021-04-22 $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
Expand Down Expand Up @@ -716,5 +716,10 @@ function __construct($zp_field) {
$rgx = preg_match('/^[a-z]*/', $type, $matches);
$this->type = $matches[0];
$this->max_length = preg_replace('/[a-z\(\)]/', '', $type);
if (empty($this->max_length)) {
if (strtoupper($type) === 'DATE') $this->max_length = 10;
if (strtoupper($type) === 'DATETIME') $this->max_length = 19; // ignores fractional which would be 26
if (strtoupper($type) === 'TIMESTAMP') $this->max_length = 19; // ignores fractional which would be 26
}
}
}

0 comments on commit 3e0ecea

Please sign in to comment.