public static function getDB( $dbname ) {
		if ( $dbname === 'meta' ) {
			return self::getMetaDB();
		}

		$wikiInfo = self::getDbInfo( $dbname );
		if ( !$wikiInfo['slice'] ) {
			throw new Exception( "Incomplete database information for '$dbname'" );
		}

		return self::getConnection( $wikiInfo['slice'], $dbname );
	}
public static function getDB( $dbname ) {
		if ( $dbname === 'meta' ) {
			return self::getMetaDB();
		}

		$wikiInfo = self::getDbInfo( $dbname );
		if ( !$wikiInfo['slice'] ) {
			throw new Exception( "Incomplete database information for '$dbname'" );
		}

		return self::getConnection( $wikiInfo['slice'], $dbname );
	}
public static function getDB ( $ dbname ) { if ( $ dbname === 'meta' ) { return self :: getMetaDB ( ) ; } $ wikiInfo = self :: getDbInfo ( $ dbname ) ; if ( ! $ wikiInfo [ 'slice' ] ) { throw new Exception ( "Incomplete database information for '$dbname'" ) ; } return self :: getConnection ( $ wikiInfo [ 'slice' ] , $ dbname ) ; }
Get a database connection by dbname.

Usage:

$conn = LabsDB::getDB( 'aawiki' );
$rows = LabsDB::query( $conn, 'SELECT * WHERE name = "str"' );

$conn = LabsDB::getDB( 'aawiki' );
$rows = LabsDB::query( $conn, 'SELECT * WHERE name = :name',
array( ':name' => "string" )
);

$conn = LabsDB::getDB( 'aawiki' );
$m = $conn->prepare( 'SELECT * WHERE total = :total' );
$m->bindParam( ':total', $total, PDO::PARAM_INT );
$m->execute();
$rows = $m->fetchAll( PDO::FETCH_ASSOC );

@return PDO
@throws If dbname could not be found
Get a database connection by dbname .