2 class MySQLField
implements Field
{
3 private $name, $tablename, $default, $max_length, $nullable,
4 $is_pk, $is_unique, $is_multiple, $is_key, $type, $binary,
5 $is_numeric, $is_blob, $is_unsigned, $is_zerofill;
7 function __construct( $info ) {
8 $this->name
= $info->name
;
9 $this->tablename
= $info->table
;
10 $this->default = $info->def
;
11 $this->max_length
= $info->max_length
;
12 $this->nullable
= !$info->not_null
;
13 $this->is_pk
= $info->primary_key
;
14 $this->is_unique
= $info->unique_key
;
15 $this->is_multiple
= $info->multiple_key
;
16 $this->is_key
= ( $this->is_pk ||
$this->is_unique ||
$this->is_multiple
);
17 $this->type
= $info->type
;
18 $this->binary
= isset( $info->binary
) ?
$info->binary
: false;
19 $this->is_numeric
= isset( $info->numeric ) ?
$info->numeric : false;
20 $this->is_blob
= isset( $info->blob
) ?
$info->blob
: false;
21 $this->is_unsigned
= isset( $info->unsigned
) ?
$info->unsigned
: false;
22 $this->is_zerofill
= isset( $info->zerofill
) ?
$info->zerofill
: false;
35 function tableName() {
36 return $this->tablename
;
49 function isNullable() {
50 return $this->nullable
;
53 function defaultValue() {
54 return $this->default;
67 function isMultipleKey() {
68 return $this->is_multiple
;
81 function isNumeric() {
82 return $this->is_numeric
;
89 return $this->is_blob
;
95 function isUnsigned() {
96 return $this->is_unsigned
;
102 function isZerofill() {
103 return $this->is_zerofill
;