/usr/share/php/Horde/Db/Adapter/Mysql/Column.php is in php-horde-db 2.3.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <?php
/**
* Copyright 2007 Maintainable Software, LLC
* Copyright 2008-2016 Horde LLC (http://www.horde.org/)
*
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd
* @category Horde
* @package Db
* @subpackage Adapter
*/
/**
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
* @author Chuck Hagenbuch <chuck@horde.org>
* @license http://www.horde.org/licenses/bsd
* @category Horde
* @package Db
* @subpackage Adapter
*/
class Horde_Db_Adapter_Mysql_Column extends Horde_Db_Adapter_Base_Column
{
/**
* @var array
*/
protected $_hasEmptyStringDefault = array('binary', 'string', 'text');
/**
* @var string
*/
protected $_originalDefault = null;
/**
* Construct
* @param string $name
* @param string $default
* @param string $sqlType
* @param boolean $null
*/
public function __construct($name, $default, $sqlType=null, $null=true)
{
$this->_originalDefault = $default;
parent::__construct($name, $default, $sqlType, $null);
if ($this->_isMissingDefaultForgedAsEmptyString()) {
$this->_default = null;
}
}
/**
*/
protected function _setSimplifiedType()
{
if (strpos(Horde_String::lower($this->_sqlType), 'tinyint(1)') !== false) {
$this->_type = 'boolean';
return;
} elseif (preg_match('/enum/i', $this->_sqlType)) {
$this->_type = 'string';
return;
}
parent::_setSimplifiedType();
}
/**
* MySQL misreports NOT NULL column default when none is given.
* We can't detect this for columns which may have a legitimate ''
* default (string, text, binary) but we can for others (integer,
* datetime, boolean, and the rest).
*
* Test whether the column has default '', is not null, and is not
* a type allowing default ''.
*
* @return boolean
*/
protected function _isMissingDefaultForgedAsEmptyString()
{
return !$this->_null && $this->_originalDefault == '' &&
!in_array($this->_type, $this->_hasEmptyStringDefault);
}
}
|