Exemple #1
0
	/**
	 * This will use a generic database descriptor like $this->dbKey
	 * to instantiate a PHPlib database.
	 *
	 * You shouldn't need to call this directly - it's typically called by
	 * {@link dbInit} to initialize $this->db.
	 *
	 * @param array $dbKey the database descriptor
	 * @return object ADOdb database instance or false on error
	 */
	function _doDbInit($dbKey=NULL)
	{
		if (!$dbKey)
			$dbKey = $this->dbKey;
		return LPC_DB::getConnection($dbKey);
	}
Exemple #2
0
if ($argc<2) {
	echo <<<EOHELP
Usage:
php mysql_switch_engine.php <dbKey>
Where
* dbKey is the name of a database key registered with LPC_DB.

EOHELP;
	exit;
}

$dbKey=$argv[1];
$newEngine="InnoDB";

// Init DB connection
$db=LPC_DB::getConnection($dbKey);

// Get tables
$rs=$db->query("SHOW TABLES");
while(!$rs->EOF) {
	$table=$rs->fields[0];
	$rs->MoveNext();
	echo $table."... ";
	$rs2=$db->query("
		SELECT ENGINE
		FROM information_schema.TABLES
		WHERE
			TABLE_SCHEMA='".LPC_DB::getDatabaseName($dbKey)."' AND
			TABLE_NAME='".$table."'
	");
	if ($rs2->fields[0]==$newEngine) {
Exemple #3
0
	private function initConnection()
	{
		$this->db=LPC_DB::getConnection($this->dbKey);
	}