MediaWiki  1.34.0
MySQLField.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Wikimedia\Rdbms;
4 
5 class MySQLField implements Field {
9 
10  function __construct( $info ) {
11  $this->name = $info->name;
12  $this->tablename = $info->table;
13  $this->default = $info->def;
14  $this->max_length = $info->max_length;
15  $this->nullable = !$info->not_null;
16  $this->is_pk = $info->primary_key;
17  $this->is_unique = $info->unique_key;
18  $this->is_multiple = $info->multiple_key;
19  $this->is_key = ( $this->is_pk || $this->is_unique || $this->is_multiple );
20  $this->type = $info->type;
21  $this->binary = $info->binary ?? false;
22  $this->is_numeric = $info->numeric ?? false;
23  $this->is_blob = $info->blob ?? false;
24  $this->is_unsigned = $info->unsigned ?? false;
25  $this->is_zerofill = $info->zerofill ?? false;
26  }
27 
31  function name() {
32  return $this->name;
33  }
34 
38  function tableName() {
39  return $this->tablename;
40  }
41 
45  function type() {
46  return $this->type;
47  }
48 
52  function isNullable() {
53  return $this->nullable;
54  }
55 
56  function defaultValue() {
57  return $this->default;
58  }
59 
63  function isKey() {
64  return $this->is_key;
65  }
66 
70  function isMultipleKey() {
71  return $this->is_multiple;
72  }
73 
77  function isBinary() {
78  return $this->binary;
79  }
80 
84  function isNumeric() {
85  return $this->is_numeric;
86  }
87 
91  function isBlob() {
92  return $this->is_blob;
93  }
94 
98  function isUnsigned() {
99  return $this->is_unsigned;
100  }
101 
105  function isZerofill() {
106  return $this->is_zerofill;
107  }
108 }
Wikimedia\Rdbms\MySQLField\$is_multiple
$is_multiple
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\$is_blob
$is_blob
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\isNullable
isNullable()
Definition: MySQLField.php:52
Wikimedia\Rdbms\MySQLField\isUnsigned
isUnsigned()
Definition: MySQLField.php:98
Wikimedia\Rdbms\MySQLField\$tablename
$tablename
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\isNumeric
isNumeric()
Definition: MySQLField.php:84
Wikimedia\Rdbms
Definition: ChronologyProtector.php:24
Wikimedia\Rdbms\MySQLField\isMultipleKey
isMultipleKey()
Definition: MySQLField.php:70
Wikimedia\Rdbms\MySQLField\isKey
isKey()
Definition: MySQLField.php:63
Wikimedia\Rdbms\MySQLField\$max_length
$max_length
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\$binary
$binary
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\tableName
tableName()
Definition: MySQLField.php:38
Wikimedia\Rdbms\MySQLField\$is_key
$is_key
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField
Definition: MySQLField.php:5
Wikimedia\Rdbms\MySQLField\$default
$default
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\$type
$type
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\defaultValue
defaultValue()
Definition: MySQLField.php:56
Wikimedia\Rdbms\MySQLField\type
type()
Definition: MySQLField.php:45
Wikimedia\Rdbms\MySQLField\$is_pk
$is_pk
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\isBinary
isBinary()
Definition: MySQLField.php:77
Wikimedia\Rdbms\Field
Base for all database-specific classes representing information about database fields.
Definition: Field.php:9
Wikimedia\Rdbms\MySQLField\$is_unsigned
$is_unsigned
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\$is_zerofill
$is_zerofill
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\isZerofill
isZerofill()
Definition: MySQLField.php:105
Wikimedia\Rdbms\MySQLField\$nullable
$nullable
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\__construct
__construct( $info)
Definition: MySQLField.php:10
Wikimedia\Rdbms\MySQLField\isBlob
isBlob()
Definition: MySQLField.php:91
Wikimedia\Rdbms\MySQLField\name
name()
Definition: MySQLField.php:31
Wikimedia\Rdbms\MySQLField\$name
$name
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\$is_numeric
$is_numeric
Definition: MySQLField.php:6
Wikimedia\Rdbms\MySQLField\$is_unique
$is_unique
Definition: MySQLField.php:6