2 require_once(
'./Services/Database/classes/class.ilDBWrapperFactory.php');
3 require_once(
'./Services/Database/classes/class.ilDBConstants.php');
55 if (empty(self::$instances[$client->
getId()])) {
59 return self::$instances[$client->
getId()];
74 require_once(
'./setup/classes/class.ilClient.php');
75 require_once(
'./Services/Init/classes/class.ilIniFile.php');
76 require_once(
'./setup/classes/class.ilDBConnections.php');
80 $ilClient->setDbHost($host);
81 $ilClient->setDbName($dbname);
82 $ilClient->setDbUser($username);
84 $ilClient->setDbType(
$type);
85 $ilClient->writeIni();
87 return self::getInstanceForClient($ilClient);
105 $clientIniFile = $this->client->ini;
125 if ($DIC->offsetExists(
'ilDB')) {
126 $DIC->offsetUnset(
'ilDB');
138 $this->client->db = null;
152 if ($tmp == $delim) {
172 $line = trim($this->
getline($fp,
"\n"));
174 if ($line !=
"" && substr($line, 0, 1) !=
"#" && substr($line, 0, 1) !=
"-") {
175 if (substr($line, -1) ==
";") {
177 $q .=
" " . substr($line, 0, -1);
204 $lines = explode(
';', $sql);
205 foreach ($lines as $line) {
206 if (strlen($line) > 0) {
253 include_once(
"./setup/sql/ilDBTemplate.php");
254 setupILIASDatabase();
290 }
catch (PDOException $e) {
291 $connect = ($e->getCode() == 1049);
298 if ($keep_connection && $connect) {
303 $this->client->setError(
'Database can\'t be reached. Please check the credentials and if database exists');
332 $target =
array(
'usr_data',
'object_data',
'object_reference' );
346 return ($connectable && !$installed);
prepareManip($a_query, $a_types=null)
initFromIniFile($tmpClientIniFile=null)
static getInstanceForNewClient($client_name, $dbname, $host='localhost', $username='root', $password='', $type=ilDBConstants::TYPE_PDO_MYSQL_INNODB)
setIlDBInterface($ilDBInterface)
Administrates DB connections in setup.
static getInstanceForClient(\ilClient $client)
execute($stmt, $data=array())
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
connect($return_false_on_error=false)
__construct(\ilClient $client)
ilDbSetup constructor.
readDump()
legacy version of readdump
Class ilDatabaseException.
isConnectable($keep_connection=false)
const TYPE_PDO_MYSQL_INNODB
const TYPE_PDO_MYSQL_MYISAM
setSqlDumpFile($sql_dump_file)
createDatabase($a_name, $a_charset="utf8", $a_collation="")
Create styles array
The data for the language used.
getDbType()
get type of database
createDatabase($a_collation)
query($query)
Run a (read-only) Query on the database.
if(empty($password)) $table
readDumpSmall()
legacy version of readdump
manipulate($query)
Run a (write) Query on the database.