Skip to content

Commit 439c8ee

Browse files
committed
Add LOCK=SHARED
1 parent b6541a9 commit 439c8ee

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/Database/Adapter/MariaDB.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,4 +2214,9 @@ public function getSupportForOptionalSpatialAttributeWithExistingRows(): bool
22142214
{
22152215
return true;
22162216
}
2217+
2218+
public function getLockType(): string
2219+
{
2220+
return ',LOCK=SHARED';
2221+
}
22172222
}

src/Database/Adapter/SQL.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function createAttribute(string $collection, string $id, string $type, in
248248
{
249249
$id = $this->quote($this->filter($id));
250250
$type = $this->getSQLType($type, $size, $signed, $array, $required);
251-
$sql = "ALTER TABLE {$this->getSQLTable($collection)} ADD COLUMN {$id} {$type};";
251+
$sql = "ALTER TABLE {$this->getSQLTable($collection)} ADD COLUMN {$id} {$type} {$this->getLockType()};";
252252
$sql = $this->trigger(Database::EVENT_ATTRIBUTE_CREATE, $sql);
253253

254254
try {
@@ -260,6 +260,11 @@ public function createAttribute(string $collection, string $id, string $type, in
260260
}
261261
}
262262

263+
public function getLockType(): string
264+
{
265+
return '';
266+
}
267+
263268
/**
264269
* Create Attributes
265270
*
@@ -285,7 +290,7 @@ public function createAttributes(string $collection, array $attributes): bool
285290

286291
$columns = \implode(', ADD COLUMN ', $parts);
287292

288-
$sql = "ALTER TABLE {$this->getSQLTable($collection)} ADD COLUMN {$columns};";
293+
$sql = "ALTER TABLE {$this->getSQLTable($collection)} ADD COLUMN {$columns} {$this->getLockType()};";
289294
$sql = $this->trigger(Database::EVENT_ATTRIBUTE_CREATE, $sql);
290295

291296
try {

0 commit comments

Comments
 (0)