Page MenuHomeIn-Portal Phabricator

D432.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 1:52 AM

D432.diff

Index: branches/5.2.x/core/kernel/utility/temp_handler.php
===================================================================
--- branches/5.2.x/core/kernel/utility/temp_handler.php
+++ branches/5.2.x/core/kernel/utility/temp_handler.php
@@ -152,7 +152,7 @@
function CreateTempTable($table)
{
- $sql = 'CREATE TABLE ' . $this->GetTempName($table) . '
+ $sql = 'CREATE TABLE ' . $this->GetTempName($table) . ' ENGINE = ' . $this->getTableEngine($table) . '
SELECT *
FROM ' . $table . '
WHERE 0';
@@ -160,6 +160,31 @@
$this->Conn->Query($sql);
}
+ /**
+ * Returns an engine of a given table.
+ *
+ * @param string $table Table.
+ *
+ * @return string
+ */
+ protected function getTableEngine($table)
+ {
+ static $cache;
+
+ if ( $cache === null ) {
+ $sql = 'SHOW TABLE STATUS WHERE `Name` LIKE ' . $this->Conn->qstr(TABLE_PREFIX . '%');
+ $table_statuses = $this->Conn->GetIterator($sql, 'Name');
+
+ $cache = array();
+
+ foreach ( $table_statuses as $table_status_name => $table_status_data ) {
+ $cache[$table_status_name] = $table_status_data['Engine'];
+ }
+ }
+
+ return isset($cache[$table]) ? $cache[$table] : null;
+ }
+
function BuildTables($prefix, $ids)
{
$this->WindowID = $this->Application->GetVar('m_wid');

Event Timeline