PageRenderTime 23ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/core/db/DbFactory.php

http://zoop.googlecode.com/
PHP | 18 lines | 14 code | 3 blank | 1 comment | 1 complexity | bf5361162d187ba70996fd82f1b43889 MD5 | raw file
 1<?php
 2//	this all needs to be thought out better and redone
 3class DbFactory
 4{
 5	private static $classMap = array('php_pgsql' => 'DbPgsql', 'php_mysql' => 'DbMysql', 
 6										'pdo' => 'DbPdo', 'php_mssql' => 'DbMssql');
 7	
 8	static function getConnection($params, $name)
 9	{
10		if(!isset(self::$classMap[$params['driver']]))
11			trigger_error("unknown driver type: " . $params['driver']);
12		else
13			$className = self::$classMap[$params['driver']];
14		
15		return new $className($params, $name);
16	}
17
18}