Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/utility/temp_handler.php
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Line(s) | |||||
*/ | */ | ||||
function GetMasterTempName() | function GetMasterTempName() | ||||
{ | { | ||||
return $this->GetTempName($this->MasterTable); | return $this->GetTempName($this->MasterTable); | ||||
} | } | ||||
function CreateTempTable($table) | function CreateTempTable($table) | ||||
{ | { | ||||
$sql = 'CREATE TABLE ' . $this->GetTempName($table) . ' | $sql = 'CREATE TABLE ' . $this->GetTempName($table) . ' ENGINE = ' . $this->getTableEngine($table) . ' | ||||
SELECT * | SELECT * | ||||
FROM ' . $table . ' | FROM ' . $table . ' | ||||
WHERE 0'; | WHERE 0'; | ||||
$this->Conn->Query($sql); | $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) | function BuildTables($prefix, $ids) | ||||
Lint: CodingStandard.NamingConventions.ValidFunctionName.NotCamelCaps: Method name "kTempTablesHandler::BuildTables" is not in camel caps format | |||||
Missing doc comment for function BuildTables() Lint: CodingStandard.Commenting.FunctionComment.Missing: Missing doc comment for function BuildTables() | |||||
Lint: Squiz.Scope.MethodScope.Missing: Visibility must be declared on method "BuildTables" | |||||
{ | { | ||||
$this->WindowID = $this->Application->GetVar('m_wid'); | $this->WindowID = $this->Application->GetVar('m_wid'); | ||||
$this->TableIdCounter = 0; | $this->TableIdCounter = 0; | ||||
$tables = Array( | $tables = Array( | ||||
'TableName' => $this->Application->getUnitOption($prefix, 'TableName'), | 'TableName' => $this->Application->getUnitOption($prefix, 'TableName'), | ||||
'IdField' => $this->Application->getUnitOption($prefix, 'IDField'), | 'IdField' => $this->Application->getUnitOption($prefix, 'IDField'), | ||||
'IDs' => $ids, | 'IDs' => $ids, | ||||
▲ Show 20 Lines • Show All 916 Lines • Show Last 20 Lines |
Method name "kTempTablesHandler::BuildTables" is not in camel caps format