mediawiki.api: Adopt async-await and assert.rejects() in various tests
[mediawiki.git] / includes / libs / rdbms / field / SQLiteField.php
blob391158a7146d655077ef162e7bb834921c7e7807
1 <?php
3 namespace Wikimedia\Rdbms;
5 use stdClass;
7 class SQLiteField implements Field {
8 private stdClass $info;
9 private string $tableName;
11 public function __construct( stdClass $info, string $tableName ) {
12 $this->info = $info;
13 $this->tableName = $tableName;
16 public function name() {
17 return $this->info->name;
20 public function tableName() {
21 return $this->tableName;
24 public function defaultValue() {
25 if ( is_string( $this->info->dflt_value ) ) {
26 // Typically quoted
27 if ( preg_match( '/^\'(.*)\'$/', $this->info->dflt_value, $matches ) ) {
28 return str_replace( "''", "'", $matches[1] );
32 return $this->info->dflt_value;
35 /**
36 * @return bool
38 public function isNullable() {
39 return !$this->info->notnull;
42 public function type() {
43 return $this->info->type;