do not initialize mdb2_scheme if we don't use it, saves a lot of time

This commit is contained in:
Robin Appelman 2010-09-11 21:09:53 +02:00
parent af8b66c2c3
commit 1d1bb352d9
1 changed files with 8 additions and 2 deletions

View File

@ -403,6 +403,12 @@ class OC_DB {
die(self::$DBConnection->getMessage()); die(self::$DBConnection->getMessage());
} }
self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC); self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC);
}
}
public static function connectScheme(){
self::connect();
if(!self::$schema){
self::$schema=&MDB2_Schema::factory(self::$DBConnection); self::$schema=&MDB2_Schema::factory(self::$DBConnection);
} }
} }
@ -570,7 +576,7 @@ class OC_DB {
} }
static function getDbStructure($file){ static function getDbStructure($file){
OC_DB::connect(); OC_DB::connectScheme();
$definition = self::$schema->getDefinitionFromDatabase(); $definition = self::$schema->getDefinitionFromDatabase();
$dump_options = array( $dump_options = array(
'output_mode' => 'file', 'output_mode' => 'file',
@ -581,7 +587,7 @@ class OC_DB {
} }
static function createDbFromStructure($file){ static function createDbFromStructure($file){
OC_DB::connect(); OC_DB::connectScheme();
global $CONFIG_DBNAME; global $CONFIG_DBNAME;
global $CONFIG_DBTABLEPREFIX; global $CONFIG_DBTABLEPREFIX;
$content=file_get_contents($file); $content=file_get_contents($file);