| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | namespace Yiisoft\Db\Schema; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use PDO; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Throwable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Yiisoft\Cache\Dependency\TagDependency; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Yiisoft\Db\Cache\SchemaCache; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Yiisoft\Db\Connection\ConnectionInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Yiisoft\Db\Constraint\Constraint; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Yiisoft\Db\Exception\NotSupportedException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use function gettype; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use function is_array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use function preg_match; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | abstract class Schema implements SchemaInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     public const SCHEMA = 'schema'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     public const PRIMARY_KEY = 'primaryKey'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     public const INDEXES = 'indexes'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     public const CHECKS = 'checks'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     public const FOREIGN_KEYS = 'foreignKeys'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     public const DEFAULT_VALUES = 'defaultValues'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     public const UNIQUES = 'uniques'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     public const TYPE_PK = 'pk'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     public const TYPE_UPK = 'upk'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     public const TYPE_BIGPK = 'bigpk'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     public const TYPE_UBIGPK = 'ubigpk'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     public const TYPE_CHAR = 'char'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     public const TYPE_STRING = 'string'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     public const TYPE_TEXT = 'text'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     public const TYPE_TINYINT = 'tinyint'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     public const TYPE_SMALLINT = 'smallint'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     public const TYPE_INTEGER = 'integer'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     public const TYPE_BIGINT = 'bigint'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     public const TYPE_FLOAT = 'float'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     public const TYPE_DOUBLE = 'double'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     public const TYPE_DECIMAL = 'decimal'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     public const TYPE_DATETIME = 'datetime'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     public const TYPE_TIMESTAMP = 'timestamp'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     public const TYPE_TIME = 'time'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     public const TYPE_DATE = 'date'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     public const TYPE_BINARY = 'binary'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     public const TYPE_BOOLEAN = 'boolean'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     public const TYPE_MONEY = 'money'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     public const TYPE_JSON = 'json'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     public const PHP_TYPE_INTEGER = 'integer'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     public const PHP_TYPE_STRING = 'string'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     public const PHP_TYPE_BOOLEAN = 'boolean'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     public const PHP_TYPE_DOUBLE = 'double'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     public const PHP_TYPE_RESOURCE = 'resource'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     public const PHP_TYPE_ARRAY = 'array'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     public const PHP_TYPE_NULL = 'NULL'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     public const CACHE_VERSION = 'cacheVersion'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      * Schema cache version, to detect incompatibilities in cached values when the data format of the cache changes. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     protected const SCHEMA_CACHE_VERSION = 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      * @var string|null the default schema name used for the current session. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     protected string|null $defaultSchema = null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     private array $schemaNames = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |     private array $tableNames = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     protected array $viewNames = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     private array $tableMetadata = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     public function __construct(protected ConnectionInterface $db, private SchemaCache $schemaCache) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |      * Returns the cache key for the specified table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      * @param string $name the table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |      * @return array the cache key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |     abstract protected function getCacheKey(string $name): array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |      * Returns the cache tag name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |      * This allows {@see refresh()} to invalidate all cached table schemas. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |      * @return string the cache tag name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |     abstract protected function getCacheTag(): string; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |      * Loads all check constraints for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |      * @param string $tableName table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |      * @return array check constraints for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     abstract protected function loadTableChecks(string $tableName): array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |      * Loads all default value constraints for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 | 2532 |  |      * @param string $tableName table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 | 2532 |  |      * @return array default value constraints for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 | 2532 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 | 2532 |  |     abstract protected function loadTableDefaultValues(string $tableName): array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |      * Loads all foreign keys for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      * @param string $tableName table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 | 963 |  |      * @return array foreign keys for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 | 963 |  |     abstract protected function loadTableForeignKeys(string $tableName): array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 | 963 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |      * Loads all indexes for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 | 963 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |      * @param string $tableName table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 | 1665 |  |      * @return array indexes for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 | 1665 |  |     abstract protected function loadTableIndexes(string $tableName): array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * Loads a primary key for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      * @param string $tableName table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      * @return Constraint|null primary key for the given table, `null` if the table has no primary key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 | 18 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |     abstract protected function loadTablePrimaryKey(string $tableName): Constraint|null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 | 18 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |      * Loads all unique constraints for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |      * @param string $tableName table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 | 1322 |  |      * @return array unique constraints for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 | 1322 |  |     abstract protected function loadTableUniques(string $tableName): array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |      * Loads the metadata for the specified table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |      * @param string $name table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 | 13 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |      * @return TableSchemaInterface|null DBMS-dependent table metadata, `null` if the table does not exist. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 | 13 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |     abstract protected function loadTableSchema(string $name): TableSchemaInterface|null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |     public function getDefaultSchema(): string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |         return $this->defaultSchema; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 | 4 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 | 4 |  |     public function getPdoType(mixed $data): int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 | 4 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |         /** @psalm-var array<string, int> */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         $typeMap = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 | 4 |  |             // php type => PDO type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |             self::PHP_TYPE_BOOLEAN => PDO::PARAM_BOOL, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |             self::PHP_TYPE_INTEGER => PDO::PARAM_INT, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             self::PHP_TYPE_STRING => PDO::PARAM_STR, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |             self::PHP_TYPE_RESOURCE => PDO::PARAM_LOB, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |             self::PHP_TYPE_NULL => PDO::PARAM_NULL, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 | 23 |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 | 23 |  |         $type = gettype($data); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 | 23 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |         return $typeMap[$type] ?? PDO::PARAM_STR; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 | 23 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |     public function getRawTableName(string $name): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         if (str_contains($name, '{{')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |             $name = preg_replace('/{{(.*?)}}/', '\1', $name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 | 1360 |  |             return str_replace('%', $this->db->getTablePrefix(), $name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 | 1360 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         return $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |      * @throws NotSupportedException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |     public function getSchemaChecks(string $schema = '', bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 | 1360 |  |         return $this->getSchemaMetadata($schema, self::CHECKS, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 | 1360 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |      * @throws NotSupportedException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     public function getSchemaDefaultValues(string $schema = '', bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 | 96 |  |         return $this->getSchemaMetadata($schema, self::DEFAULT_VALUES, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 | 96 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 | 96 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      * @throws NotSupportedException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 | 96 |  |     public function getSchemaForeignKeys(string $schema = '', bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 | 96 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 | 96 |  |         return $this->getSchemaMetadata($schema, self::FOREIGN_KEYS, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |      * @throws NotSupportedException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 | 103 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |     public function getSchemaIndexes(string $schema = '', bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 | 103 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |         return $this->getSchemaMetadata($schema, self::INDEXES, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 | 103 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 | 103 |  |     public function getSchemaNames(bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 | 103 |  |         if (empty($this->schemaNames) || $refresh) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 | 103 |  |             $this->schemaNames = $this->findSchemaNames(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 | 103 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |         return $this->schemaNames; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 | 36 |  |      * @throws NotSupportedException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 | 36 |  |     public function getSchemaPrimaryKeys(string $schema = '', bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 | 36 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 | 36 |  |         return $this->getSchemaMetadata($schema, self::PRIMARY_KEY, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |      * @throws NotSupportedException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |     public function getSchemaUniques(string $schema = '', bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |         return $this->getSchemaMetadata($schema, self::UNIQUES, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 | 10 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |     public function getTableChecks(string $name, bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 | 10 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         /** @var mixed */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |         $tableChecks = $this->getTableMetadata($name, self::CHECKS, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |         return is_array($tableChecks) ? $tableChecks : []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 | 4 |  |     public function getTableDefaultValues(string $name, bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 | 4 |  |         /** @var mixed */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 | 4 |  |         $tableDefaultValues = $this->getTableMetadata($name, self::DEFAULT_VALUES, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |         return is_array($tableDefaultValues) ? $tableDefaultValues : []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |     public function getTableForeignKeys(string $name, bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |         /** @var mixed */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |         $tableForeignKeys = $this->getTableMetadata($name, self::FOREIGN_KEYS, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |         return is_array($tableForeignKeys) ? $tableForeignKeys : []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |     public function getTableIndexes(string $name, bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 | 4 |  |         /** @var mixed */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |         $tableIndexes = $this->getTableMetadata($name, self::INDEXES, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 | 4 |  |         return is_array($tableIndexes) ? $tableIndexes : []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 | 4 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |     public function getTableNames(string $schema = '', bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |         if (!isset($this->tableNames[$schema]) || $refresh) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 | 8 |  |             /** @psalm-var string[] */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |             $this->tableNames[$schema] = $this->findTableNames($schema); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 | 8 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 | 8 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |         return is_array($this->tableNames[$schema]) ? $this->tableNames[$schema] : []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |     public function getTablePrimaryKey(string $name, bool $refresh = false): Constraint|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 | 28 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |         /** @var mixed */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 | 28 |  |         $tablePrimaryKey = $this->getTableMetadata($name, self::PRIMARY_KEY, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |         return $tablePrimaryKey instanceof Constraint ? $tablePrimaryKey : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 | 28 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |     public function getTableSchema(string $name, bool $refresh = false): TableSchemaInterface|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 | 28 |  |         /** @var mixed */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 | 28 |  |         $tableSchema = $this->getTableMetadata($name, self::SCHEMA, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |         return $tableSchema instanceof TableSchemaInterface ? $tableSchema : null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 | 28 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 | 26 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 | 24 |  |     public function getTableSchemas(string $schema = '', bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 | 24 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |         /** @var mixed */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |         $tableSchemas = $this->getSchemaMetadata($schema, self::SCHEMA, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 | 4 |  |         return is_array($tableSchemas) ? $tableSchemas : []; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 | 28 |  |     public function getTableUniques(string $name, bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |         /** @var mixed */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |         $tableUniques = $this->getTableMetadata($name, self::UNIQUES, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |         return is_array($tableUniques) ? $tableUniques : []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 | 1075 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 | 1075 |  |      * Returns a value indicating whether a SQL statement is for read purpose. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 | 6 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |      * @param string $sql the SQL statement. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 | 1075 |  |      * @return bool whether a SQL statement is for read purpose. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 | 1075 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |     public function isReadQuery(string $sql): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |         $pattern = '/^\s*(SELECT|SHOW|DESCRIBE)\b/i'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |         return preg_match($pattern, $sql) > 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |      * Refreshes the schema. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 | 1574 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |      * This method cleans up all cached table schemas so that they can be re-created later to reflect the database | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 | 1574 |  |      * schema change. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 | 4 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |     public function refresh(): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 | 1574 |  |         if ($this->schemaCache->isEnabled()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 | 146 |  |             $this->schemaCache->invalidate($this->getCacheTag()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 | 1550 |  |         $this->tableNames = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 | 1467 |  |         $this->tableMetadata = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 | 287 |  |     public function refreshTableSchema(string $name): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 | 287 |  |         $rawName = $this->getRawTableName($name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 | 287 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |         unset($this->tableMetadata[$rawName]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 | 287 |  |         $this->tableNames = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |         if ($this->schemaCache->isEnabled()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |             $this->schemaCache->remove($this->getCacheKey($rawName)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 | 1698 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |     public function schemaCacheEnable(bool $value): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 | 1698 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 | 149 |  |         $this->schemaCache->setEnable($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 | 1683 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 | 232 |  |      * Returns all schema names in the database, including the default one but not system schemas. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 | 232 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |      * This method should be overridden by child classes in order to support this feature because the default | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 | 1673 |  |      * implementation simply throws an exception. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |      * @throws NotSupportedException if this method is not supported by the DBMS. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 | 1683 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 | 4 |  |      * @return array all schema names in the database, except system schemas. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |     protected function findSchemaNames(): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 | 1683 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |         throw new NotSupportedException(static::class . ' does not support fetching all schema names.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |      * Returns all table names in the database. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 | 1344 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |      * This method should be overridden by child classes in order to support this feature because the default | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 | 1344 |  |      * implementation simply throws an exception. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 | 987 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |      * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 | 357 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |      * @throws NotSupportedException if this method is not supported by the DBMS. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 | 1344 |  |      * @return array all table names in the database. The names have NO schema name prefix. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |     protected function findTableNames(string $schema): array | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |         throw new NotSupportedException(static::class . ' does not support fetching all table names.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 | 1683 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 | 1683 |  |      * Extracts the PHP type from abstract DB type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 | 1357 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |      * @param ColumnSchemaInterface $column the column schema information. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 | 326 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |      * @return string PHP type name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 | 1683 |  |     protected function getColumnPhpType(ColumnSchemaInterface $column): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 | 1683 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |         /** @psalm-var string[] */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |         $typeMap = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |             // abstract type => php type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |             self::TYPE_TINYINT => self::PHP_TYPE_INTEGER, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |             self::TYPE_SMALLINT => self::PHP_TYPE_INTEGER, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 | 5 |  |             self::TYPE_INTEGER => self::PHP_TYPE_INTEGER, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |             self::TYPE_BIGINT => self::PHP_TYPE_INTEGER, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 | 5 |  |             self::TYPE_BOOLEAN => self::PHP_TYPE_BOOLEAN, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 | 5 |  |             self::TYPE_FLOAT => self::PHP_TYPE_DOUBLE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |             self::TYPE_DOUBLE => self::PHP_TYPE_DOUBLE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |             self::TYPE_BINARY => self::PHP_TYPE_RESOURCE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |             self::TYPE_JSON => self::PHP_TYPE_ARRAY, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 | 5 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |         if (isset($typeMap[$column->getType()])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |             if ($column->getType() === self::TYPE_BIGINT) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |                 return PHP_INT_SIZE === 8 && !$column->isUnsigned() ? self::PHP_TYPE_INTEGER : self::PHP_TYPE_STRING; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |             if ($column->getType() === self::TYPE_INTEGER) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |                 return PHP_INT_SIZE === 4 && $column->isUnsigned() ? self::PHP_TYPE_STRING : self::PHP_TYPE_INTEGER; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |             return $typeMap[$column->getType()]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |         return self::PHP_TYPE_STRING; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |      * Returns the metadata of the given type for all tables in the given schema. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |      * @param string $schema the schema of the metadata. Defaults to empty string, meaning the current or default schema | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 | 1622 |  |      * name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |      * @param string $type metadata type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 | 1622 |  |      * @param bool $refresh whether to fetch the latest available table metadata. If this is `false`, cached data may be | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 | 130 |  |      * returned if available. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 | 130 |  |      * @throws NotSupportedException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |      * @return array of metadata. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 | 1622 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |      * @psalm-return list<Constraint|TableSchemaInterface|array> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |     protected function getSchemaMetadata(string $schema, string $type, bool $refresh): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |         $metadata = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 | 50 |  |         /** @psalm-var string[] */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |         $tableNames = $this->getTableNames($schema, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 | 50 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |         foreach ($tableNames as $name) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |             if ($schema !== '') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |                 $name = $schema . '.' . $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 | 50 |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 | 50 |  |             $tableMetadata = $this->getTableTypeMetadata($type, $name, $refresh); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 | 50 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 | 13 |  |             if ($tableMetadata !== null) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |                 $metadata[] = $tableMetadata; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 | 50 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 | 50 |  |         return $metadata; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 | 50 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |      * Returns the metadata of the given type for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |      * @param string $name table name. The table name may contain schema name if any. Do not quote the table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |      * @param string $type metadata type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 | 12 |  |      * @param bool $refresh whether to reload the table metadata even if it is found in the cache. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 | 12 |  |      * @return mixed metadata. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 | 12 |  |      * @psalm-suppress MixedArrayAccess | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |      * @psalm-suppress MixedArrayAssignment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |     protected function getTableMetadata(string $name, string $type, bool $refresh = false): mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |         $rawName = $this->getRawTableName($name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 | 375 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |         if (!isset($this->tableMetadata[$rawName])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 | 375 |  |             $this->loadTableMetadataFromCache($rawName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 | 375 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |         if ($refresh || !isset($this->tableMetadata[$rawName][$type])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 | 375 |  |             $this->tableMetadata[$rawName][$type] = $this->loadTableTypeMetadata($type, $rawName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |             $this->saveTableMetadataToCache($rawName); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |         return $this->tableMetadata[$rawName][$type]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 | 153 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 | 153 |  |      * This method returns the desired metadata type for the table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |     protected function loadTableTypeMetadata(string $type, string $name): Constraint|array|TableSchemaInterface|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |         return match ($type) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |             self::SCHEMA => $this->loadTableSchema($name), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |             self::PRIMARY_KEY => $this->loadTablePrimaryKey($name), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |             self::UNIQUES => $this->loadTableUniques($name), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |             self::FOREIGN_KEYS => $this->loadTableForeignKeys($name), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |             self::INDEXES => $this->loadTableIndexes($name), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |             self::DEFAULT_VALUES => $this->loadTableDefaultValues($name), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |             self::CHECKS => $this->loadTableChecks($name), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |             default => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |         }; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 | 20 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 | 20 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |      * This method returns the desired metadata type for table name (with refresh if needed) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |     protected function getTableTypeMetadata( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |         string $type, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |         string $name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |         bool $refresh = false | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |     ): Constraint|array|null|TableSchemaInterface { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |         return match ($type) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |             self::SCHEMA => $this->getTableSchema($name, $refresh), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |             self::PRIMARY_KEY => $this->getTablePrimaryKey($name, $refresh), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |             self::UNIQUES => $this->getTableUniques($name, $refresh), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |             self::FOREIGN_KEYS => $this->getTableForeignKeys($name, $refresh), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |             self::INDEXES => $this->getTableIndexes($name, $refresh), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 | 141 |  |             self::DEFAULT_VALUES => $this->getTableDefaultValues($name, $refresh), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |             self::CHECKS => $this->getTableChecks($name, $refresh), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 | 141 |  |             default => null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |         }; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |      * Resolves the table name and schema name (if any). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |      * @param string $name the table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |      * @throws NotSupportedException if this method is not supported by the DBMS. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |      * @return TableSchemaInterface with resolved table, schema, etc. names. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |      * {@see \Yiisoft\Db\Schema\TableSchemaInterface} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 | 156 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |     protected function resolveTableName(string $name): TableSchemaInterface | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 | 156 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |         throw new NotSupportedException(static::class . ' does not support resolving table names.'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |      * Sets the metadata of the given type for the given table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |      * @param string $name table name. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |      * @param string $type metadata type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |      * @param mixed $data metadata. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |      * @psalm-suppress MixedArrayAssignment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |     protected function setTableMetadata(string $name, string $type, mixed $data): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 | 63 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |         $this->tableMetadata[$this->getRawTableName($name)][$type] = $data; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 | 63 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |      * Tries to load and populate table metadata from cache. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 568 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 569 |  |  |     private function loadTableMetadataFromCache(string $rawName): void | 
            
                                                                        
                            
            
                                    
            
            
                | 570 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 571 |  |  |         if (!$this->schemaCache->isEnabled() || $this->schemaCache->isExcluded($rawName)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 572 |  |  |             $this->tableMetadata[$rawName] = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 573 |  |  |             return; | 
            
                                                                        
                            
            
                                    
            
            
                | 574 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 575 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 576 |  |  |         $metadata = $this->schemaCache->getOrSet( | 
            
                                                                        
                            
            
                                    
            
            
                | 577 |  |  |             $this->getCacheKey($rawName), | 
            
                                                                        
                            
            
                                    
            
            
                | 578 | 61 |  |             null, | 
            
                                                                        
                            
            
                                    
            
            
                | 579 |  |  |             $this->schemaCache->getDuration(), | 
            
                                                                        
                            
            
                                    
            
            
                | 580 | 61 |  |             new TagDependency($this->getCacheTag()), | 
            
                                                                        
                            
            
                                    
            
            
                | 581 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 582 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 583 |  |  |         if ( | 
            
                                                                        
                            
            
                                    
            
            
                | 584 |  |  |             !is_array($metadata) || | 
            
                                                                        
                            
            
                                    
            
            
                | 585 |  |  |             !isset($metadata[self::CACHE_VERSION]) || | 
            
                                                                        
                            
            
                                    
            
            
                | 586 |  |  |             $metadata[self::CACHE_VERSION] !== static::SCHEMA_CACHE_VERSION | 
            
                                                                        
                            
            
                                    
            
            
                | 587 |  |  |         ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 588 |  |  |             $this->tableMetadata[$rawName] = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 589 |  |  |             return; | 
            
                                                                        
                            
            
                                    
            
            
                | 590 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 591 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 592 |  |  |         unset($metadata[self::CACHE_VERSION]); | 
            
                                                                        
                            
            
                                    
            
            
                | 593 |  |  |         $this->tableMetadata[$rawName] = $metadata; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |      * Saves table metadata to cache. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |     private function saveTableMetadataToCache(string $rawName): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |         if ($this->schemaCache->isEnabled() === false || $this->schemaCache->isExcluded($rawName) === true) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |         /** @psalm-var array<string, array<TableSchemaInterface|int>> */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |         $metadata = $this->tableMetadata[$rawName]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |         /** @var int */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |         $metadata[self::CACHE_VERSION] = static::SCHEMA_CACHE_VERSION; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |         $this->schemaCache->set( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |             $this->getCacheKey($rawName), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |             $metadata, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |             $this->schemaCache->getDuration(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |             new TagDependency($this->getCacheTag()), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |     protected function findViewNames(string $schema = ''): array | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |         return []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |      * @throws Throwable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |     public function getViewNames(string $schema = '', bool $refresh = false): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |         if (!isset($this->viewNames[$schema]) || $refresh) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |             $this->viewNames[$schema] = $this->findViewNames($schema); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |         return (array) $this->viewNames[$schema]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 634 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 635 |  |  |  |