Location: PHPKode > scripts > Database Queries > database-queries/DatabaseQueriesFactory.php
<?php
include("DatabaseQueries.php");
include("DBTypes.php");


/**
* class DatabaseQueriesFactory
*
* { Description :- 
*	This class is a factory returning an object of specified Database to execute queries/procs.
* }
*/

class DatabaseQueriesFactory
{
	function getInstanceOf($query, $conHandle, $params, $DBType="")
	{
		switch($DBType)
		{
			case MYSQL:
			{
				return new MySqlDatabaseQueries($query, $conHandle);
				break;
			}
			case MSSQL:
			{
				if(empty($params))
				{
					return new MSSqlDatabaseQueries($query, $conHandle);
				}
				else
				{
					return new MSSqlDatabaseQueryProc($query, $conHandle, $params);
				}
				break;
			}
			default:
				return new MySqlDatabaseQueries($query, $conHandle);
		}
	}
}	


?>
Return current item: Database Queries