|
22 | 22 | class PdoTagAwareAdapter extends AbstractTagAwareAdapter implements PruneableInterface
|
23 | 23 | {
|
24 | 24 | use PdoTrait {
|
25 |
| - doSave as public doSaveItem; |
26 |
| - prune as public pruneItems; |
| 25 | + doSave as private doSaveItem; |
| 26 | + prune as private pruneItems; |
27 | 27 | }
|
28 | 28 |
|
29 | 29 | /**
|
30 | 30 | * No need for a prefix here, should improve lookup time.
|
31 | 31 | */
|
32 | 32 | protected const TAGS_PREFIX = '';
|
33 | 33 |
|
| 34 | + private string $tagsTable = 'cache_tags'; |
| 35 | + private string $tagCol = 'item_tag'; |
| 36 | + private string $tagIdxName = 'idx_cache_tags_item_tag'; |
| 37 | + |
| 38 | + |
34 | 39 | /**
|
35 | 40 | * You can either pass an existing database connection as PDO instance or
|
36 | 41 | * a DSN string that will be used to lazy-connect to the database when the
|
@@ -71,10 +76,10 @@ private function createTagsTable(): void
|
71 | 76 | // - trailing space removal
|
72 | 77 | // - case-insensitivity
|
73 | 78 | // - language processing like é == e
|
74 |
| - 'mysql' => "CREATE TABLE $this->tagsTable ($this->idCol VARBINARY(255) NOT NULL, $this->tagCol VARBINARY(255) NOT NULL, PRIMARY KEY($this->idCol, $this->tagCol), INDEX idx_id_col ($this->idCol), INDEX idx_tag_col ($this->tagCol)) COLLATE utf8mb4_bin, ENGINE = InnoDB", |
75 |
| - 'sqlite' => "CREATE TABLE $this->tagsTable ($this->idCol TEXT NOT NULL, $this->tagCol TEXT NOT NULL, PRIMARY KEY ($this->idCol, $this->tagCol));CREATE INDEX idx_id_col ON $this->tagsTable($this->idCol);CREATE INDEX idx_tag_col ON $this->tagsTable($this->tagCol)", |
76 |
| - 'pgsql', 'sqlsrv' => "CREATE TABLE $this->tagsTable ($this->idCol VARCHAR(255) NOT NULL, $this->tagCol VARCHAR(255) NOT NULL, PRIMARY KEY($this->idCol, $this->tagCol);CREATE INDEX idx_id_col ON $this->tagsTable($this->idCol);CREATE INDEX idx_tag_col ON $this->tagsTable($this->tagCol)", |
77 |
| - 'oci' => "CREATE TABLE $this->tagsTable ($this->idCol VARCHAR2(255) NOT NULL, $this->tagCol VARCHAR2(255) NOT NULL, PRIMARY KEY($this->idCol, $this->tagCol);CREATE INDEX idx_id_col ON $this->tagsTable($this->idCol);CREATE INDEX idx_tag_col ON $this->tagsTable($this->tagCol)", |
| 79 | + 'mysql' => "CREATE TABLE $this->tagsTable ($this->idCol VARBINARY(255) NOT NULL, $this->tagCol VARBINARY(255) NOT NULL, PRIMARY KEY($this->idCol, $this->tagCol), INDEX $this->tagIdxName($this->tagCol)) COLLATE utf8mb4_bin, ENGINE = InnoDB", |
| 80 | + 'sqlite' => "CREATE TABLE $this->tagsTable ($this->idCol TEXT NOT NULL, $this->tagCol TEXT NOT NULL, PRIMARY KEY ($this->idCol, $this->tagCol));CREATE INDEX $this->tagIdxName ON $this->tagsTable($this->tagCol)", |
| 81 | + 'pgsql', 'sqlsrv' => "CREATE TABLE $this->tagsTable ($this->idCol VARCHAR(255) NOT NULL, $this->tagCol VARCHAR(255) NOT NULL, PRIMARY KEY($this->idCol, $this->tagCol);CREATE INDEX $this->tagIdxName ON $this->tagsTable($this->tagCol)", |
| 82 | + 'oci' => "CREATE TABLE $this->tagsTable ($this->idCol VARCHAR2(255) NOT NULL, $this->tagCol VARCHAR2(255) NOT NULL, PRIMARY KEY($this->idCol, $this->tagCol);CREATE INDEX $this->tagIdxName ON $this->tagsTable($this->tagCol)", |
78 | 83 | default => throw new \DomainException(\sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $driver)),
|
79 | 84 | };
|
80 | 85 |
|
|
0 commit comments