Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F726853
D432.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 1:52 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 1:52 AM (2 d, 12 h ago)
Engine
blob
Format
Raw Data
Handle
536943
Attached To
D432: INP-1828 - Preserve engine type, when creating a temporary tables
D432.diff
View Options
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
Log In to Comment