Skip to content

Commit

Permalink
#50 Backticks around table names to hide strangely named ones.
Browse files Browse the repository at this point in the history
  • Loading branch information
OllieJones committed Dec 28, 2023
1 parent 75381b6 commit 67367f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion code/getqueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public static function getFullTableIndexesQuery() {
CONCAT ( 'DROP ',
IF(tc.CONSTRAINT_TYPE LIKE 'PRIMARY KEY', tc.CONSTRAINT_TYPE, CONCAT ('KEY', ' ', s.INDEX_NAME))
) `drop`,
CONCAT ('ALTER TABLE ', s.TABLE_SCHEMA, '.', s.TABLE_NAME, ' ') `alter`,
CONCAT ('ALTER TABLE `', s.TABLE_SCHEMA, '`.`', s.TABLE_NAME, '` ') `alter`,
MAX(t.ENGINE) 'engine',
MAX(t.ROW_FORMAT) 'row_format'
FROM information_schema.STATISTICS s
Expand Down
8 changes: 4 additions & 4 deletions code/imsfdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ public function rekeyTable( $targetAction, $name, $version, $alreadyPrefixed = f
return '';
}

$q = 'ALTER TABLE ' . $prefixedName . ' ' . implode( ', ', $actions );
$stats = 'ANALYZE TABLE ' . $prefixedName;
$q = 'ALTER TABLE `' . $prefixedName . '` ' . implode( ', ', $actions );
$stats = 'ANALYZE TABLE `' . $prefixedName . '`';
if ( ! $dryrun ) {
$this->set_runtime_limit();
$this->query( $q, true );
Expand Down Expand Up @@ -736,7 +736,7 @@ public function lock( $tableList, $alreadyPrefixed ) {
sort( $tablesToLock );
$tables = [];
foreach ( $tablesToLock as $tbl ) {
$tables[] = $tbl . ' WRITE';
$tables[] = '`' . $tbl . '` WRITE';
}

$this->enterMaintenanceMode();
Expand Down Expand Up @@ -770,7 +770,7 @@ public function enterMaintenanceMode( $duration = 60 ) {
* @throws ImfsException
*/
public function upgradeTableStorageEngine( $table, $dryrun = false ) {
$sql = 'ALTER TABLE ' . $table . ' ENGINE=InnoDb, ROW_FORMAT=DYNAMIC;';
$sql = 'ALTER TABLE `' . $table . '` ENGINE=InnoDb, ROW_FORMAT=DYNAMIC;';
if ( $dryrun ) {
return $sql;
}
Expand Down

0 comments on commit 67367f8

Please sign in to comment.