ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilDBWrapperFactory.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once("./Services/Database/exceptions/exception.ilDatabaseException.php");
4 require_once('./Services/Database/classes/class.ilDBConstants.php');
5 require_once("./Services/Database/interfaces/interface.ilDBInterface.php");
6 require_once('./Services/Database/interfaces/interface.ilDBManager.php');
7 require_once('./Services/Database/interfaces/interface.ilDBReverse.php');
8 
22 {
23 
30  public static function getWrapper($a_type, $a_inactive_mysqli = null)
31  {
32  global $ilClientIniFile;
37  if ($a_type == "" && is_object($ilClientIniFile)) {
38  $a_type = $ilClientIniFile->readVariable("db", "type");
39  }
40  if ($a_type == "") {
42  }
43 
44  // For legacy code
45  if (!defined('DB_FETCHMODE_ASSOC')) {
46  define("DB_FETCHMODE_ASSOC", ilDBConstants::FETCHMODE_ASSOC);
47  }
48  if (!defined('DB_FETCHMODE_OBJECT')) {
49  define("DB_FETCHMODE_OBJECT", ilDBConstants::FETCHMODE_OBJECT);
50  }
51 
52  switch ($a_type) {
55  require_once('./Services/Database/classes/PDO/class.ilDBPdoPostgreSQL.php');
56  $ilDB = new ilDBPdoPostgreSQL();
57  break;
59  include_once("./Services/Database/classes/MDB2/class.ilDBOracle.php");
60  $ilDB = new ilDBOracle();
61  break;
64  require_once('./Services/Database/classes/PDO/class.ilDBPdoMySQLInnoDB.php');
65  $ilDB = new ilDBPdoMySQLInnoDB();
66  break;
69  require_once('./Services/Database/classes/PDO/class.ilDBPdoMySQLMyISAM.php');
70  $ilDB = new ilDBPdoMySQLMyISAM();
71  break;
73  require_once('./Services/Database/classes/PDO/class.ilDBPdoMySQLGalera.php');
74  $ilDB = new ilDBPdoMySQLGalera();
75  break;
76  case 'postgres-legacy':
77  require_once('./Services/Database/classes/MDB2/class.ilDBPostgreSQL.php');
78  $ilDB = new ilDBPostgreSQL();
79  break;
80  case 'mysql-legacy':
81  require_once('./Services/Database/classes/MDB2/class.ilDBMySQL.php');
82  $ilDB = new ilDBMySQL();
83  break;
84  case 'innodb-legacy':
85  require_once('./Services/Database/classes/MDB2/class.ilDBInnoDB.php');
86  $ilDB = new ilDBInnoDB();
87  break;
88  default:
89  throw new ilDatabaseException("No viable database-type given: " . var_export($a_type, true));
90  }
91 
92  return $ilDB;
93  }
94 }
PostreSQL Database Wrapper.
Class ilDBPdoPostgreSQL.
MySQL InnoDB Database Wrapper.
Class ilDBPdoMySQLMyISAM.
Class ilDatabaseException.
$a_type
Definition: workflow.php:92
MySQL Database Wrapper.
global $ilDB
Class ilDBWrapperFactory.
Class ilDBPdoMySQLInnoDB.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
Class ilDBPdoMySQLInnoDB.
Oracle Database Wrapper.