remappedTableName( $table ); foreach ( $db->getCoreSchemas() as $schema ) { $res = $db->query( sprintf( $q, $db->addQuotes( $schema ), $db->addQuotes( $table ), $db->addQuotes( $field ) ) ); $row = $db->fetchObject( $res ); if ( !$row ) { continue; } $n = new PostgresField; $n->type = $row->typname; $n->nullable = ( $row->attnotnull == 'f' ); $n->name = $field; $n->tablename = $table; $n->max_length = $row->attlen; $n->deferrable = ( $row->deferrable == 't' ); $n->deferred = ( $row->deferred == 't' ); $n->conname = $row->conname; $n->has_default = ( $row->atthasdef === 't' ); $n->default = $row->adsrc; return $n; } return null; } function name() { return $this->name; } function tableName() { return $this->tablename; } function type() { return $this->type; } function isNullable() { return $this->nullable; } function maxLength() { return $this->max_length; } function is_deferrable() { return $this->deferrable; } function is_deferred() { return $this->deferred; } function conname() { return $this->conname; } /** * @since 1.19 * @return bool|mixed */ function defaultValue() { if ( $this->has_default ) { return $this->default; } else { return false; } } }