-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathframework-adapter-pdo.patch
25 lines (24 loc) · 1.41 KB
/
framework-adapter-pdo.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Index: vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php b/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
--- a/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
+++ b/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php (date 1661519230948)
@@ -2229,10 +2229,14 @@
*/
public function createTemporaryTableLike($temporaryTableName, $originTableName, $ifNotExists = false)
{
- $ifNotExistsSql = ($ifNotExists ? 'IF NOT EXISTS' : '');
+ $ifNotExistsSql = ($ifNotExists ? ' IF NOT EXISTS' : '');
$temporaryTable = $this->quoteIdentifier($this->_getTableName($temporaryTableName));
$originTable = $this->quoteIdentifier($this->_getTableName($originTableName));
- $sql = sprintf('CREATE TEMPORARY TABLE %s %s LIKE %s', $ifNotExistsSql, $temporaryTable, $originTable);
+ $originCreate = $this->fetchPairs("SHOW CREATE TABLE {$originTable}");
+ $sql = reset($originCreate);
+ $sql = preg_replace('/\/\*!50100 TABLESPACE [^\s]+ \*\//', '', $sql);
+ $sql = str_replace('CREATE TABLE', 'CREATE TEMPORARY TABLE' . $ifNotExistsSql, $sql);
+ $sql = str_replace($originTable, $temporaryTable, $sql);
return $this->query($sql);
}