function __construct()
{
-
+ // this might get run before we have imported the database
+ // and hence not have any db.
$this->loadIniFiles(); //?? shared???
+
$dbo = DB_DataObject::factory('core_enum');
+
+
+
if (is_a($dbo, 'PDO_DataObject')) {
$this->views = $dbo->generator()->introspection()->getListOf('views');
// update the engine first - get's around 1000 character limit on indexes..cd
// however - Innodb does not support fulltext indexes, so this may fail...
$this->updateEngine();
-
+
$this->updateCharacterSet();
-
-
+
}
function loadIniFiles()
$ce = DB_DataObject::factory('core_enum');
// not sure why, but convert to does not actually change the 'charset=' bit..
- $ce->query("ALTER TABLE $tbl CHARSET=utf8");
- $ce->query("ALTER TABLE {$tbl} CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci");
+ $ce->query("ALTER TABLE `$tbl` CHARSET=utf8");
+ $ce->query("ALTER TABLE `{$tbl}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci");
echo "utf8: FIXED {$tbl}\n";
}
{
$db = DB_DataObject::factory('core_enum');
$db->query("show variables like 'innodb_file_per_table'");
+
$db->fetch();
$pg = HTML_FlexyFramework::get()->page;
$views = $this->views;
-
+ echo "a3\n";
foreach (array_keys($this->schema) as $tbl){
if(strpos($tbl, '__keys') !== false ){
continue;
}
+
if(in_array($tbl , $views)) {
continue;
}
if (!$ce->fetch()) {
continue;
}
+ //AWS is returning captials?
+ $engine = isset($ce->engine) ? $ce->engine : $ce->ENGINE;
- if($ce->engine == 'InnoDB' ){
+ if($engine == 'InnoDB' ){
echo "InnoDB: SKIP $tbl\n";
continue;
}
- if($ce->engine == 'NDB' ){
- echo "InnoDB: SKIP $tbl\n";
+ if($engine == 'ndbcluster' ){
+ echo "ndbcluster: SKIP $tbl\n";
continue;
}
+ // should really determine if we are running in cluster ready ...
+
// this used to be utf8_unicode_ci
//as the default collation for stored procedure parameters is utf8_general_ci and you can't mix collations.
$ce = DB_DataObject::factory('core_enum');
- $ce->query("ALTER TABLE $tbl ENGINE=InnoDB");
+ $ce->query("ALTER TABLE `$tbl` ENGINE=InnoDB");
echo "InnoDB: FIXED {$tbl}\n";
}