Special case opus mime detction
[mediawiki.git] / includes / libs / rdbms / field / MySQLField.php
blob8cf964cc3d9a9007326aae93b51acdc766ee72c0
1 <?php
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;
25 /**
26 * @return string
28 function name() {
29 return $this->name;
32 /**
33 * @return string
35 function tableName() {
36 return $this->tablename;
39 /**
40 * @return string
42 function type() {
43 return $this->type;
46 /**
47 * @return bool
49 function isNullable() {
50 return $this->nullable;
53 function defaultValue() {
54 return $this->default;
57 /**
58 * @return bool
60 function isKey() {
61 return $this->is_key;
64 /**
65 * @return bool
67 function isMultipleKey() {
68 return $this->is_multiple;
71 /**
72 * @return bool
74 function isBinary() {
75 return $this->binary;
78 /**
79 * @return bool
81 function isNumeric() {
82 return $this->is_numeric;
85 /**
86 * @return bool
88 function isBlob() {
89 return $this->is_blob;
92 /**
93 * @return bool
95 function isUnsigned() {
96 return $this->is_unsigned;
99 /**
100 * @return bool
102 function isZerofill() {
103 return $this->is_zerofill;