5 include_once (
"./Services/Database/classes/class.ilDB.php");
32 if (trim($this->getdbPort()) !=
"")
34 $db_port_str =
":".$this->getdbPort();
37 $driver = $this->
isMySQLi() ?
"mysqli" :
"mysql";
40 "@".$this->getdbHost().$db_port_str.
"/".$this->
getDBName();
53 $driver = $this->
isMySQLi() ?
"mysqli" :
"mysql";
56 "@".$this->getdbHost();
75 "ACCESSIBLE",
"ADD",
"ALL",
"ALTER",
"ANALYZE",
"AND",
76 "AS",
"ASC",
"ASENSITIVE",
"BEFORE",
"BETWEEN",
"BIGINT",
77 "BINARY",
"BLOB",
"BOTH",
"BY",
"CALL",
"CASCADE",
78 "CASE",
"CHANGE",
"CHAR",
"CHARACTER",
"CHECK",
"COLLATE",
79 "COLUMN",
"CONDITION",
"CONSTRAINT",
"CONTINUE",
"CONVERT",
"CREATE",
80 "CROSS",
"CURRENT_DATE",
"CURRENT_TIME",
"CURRENT_TIMESTAMP",
"CURRENT_USER",
"CURSOR",
81 "DATABASE",
"DATABASES",
"DAY_HOUR",
"DAY_MICROSECOND",
"DAY_MINUTE",
"DAY_SECOND",
82 "DEC",
"DECIMAL",
"DECLARE",
"DEFAULT",
"DELAYED",
"DELETE",
83 "DESC",
"DESCRIBE",
"DETERMINISTIC",
"DISTINCT",
"DISTINCTROW",
"DIV",
84 "DOUBLE",
"DROP",
"DUAL",
"EACH",
"ELSE",
"ELSEIF",
85 "ENCLOSED",
"ESCAPED",
"EXISTS",
"EXIT",
"EXPLAIN",
"FALSE",
86 "FETCH",
"FLOAT",
"FLOAT4",
"FLOAT8",
"FOR",
"FORCE",
87 "FOREIGN",
"FROM",
"FULLTEXT",
"GRANT",
"GROUP",
"HAVING",
88 "HIGH_PRIORITY",
"HOUR_MICROSECOND",
"HOUR_MINUTE",
"HOUR_SECOND",
"IF",
"IGNORE",
89 "IN",
"INDEX",
"INFILE",
"INNER",
"INOUT",
"INSENSITIVE",
90 "INSERT",
"INT",
"INT1",
"INT2",
"INT3",
"INT4",
91 "INT8",
"INTEGER",
"INTERVAL",
"INTO",
"IS",
"ITERATE",
92 "JOIN",
"KEY",
"KEYS",
"KILL",
"LEADING",
"LEAVE",
93 "LEFT",
"LIKE",
"LIMIT",
"LINEAR",
"LINES",
"LOAD",
94 "LOCALTIME",
"LOCALTIMESTAMP",
"LOCK",
"LONG",
"LONGBLOB",
"LONGTEXT",
95 "LOOP",
"LOW_PRIORITY",
"MASTER_SSL_VERIFY_SERVER_CERT",
"MATCH",
"MEDIUMBLOB",
"MEDIUMINT",
96 "MEDIUMTEXT",
"MIDDLEINT",
"MINUTE_MICROSECOND",
"MINUTE_SECOND",
"MOD",
"MODIFIES",
97 "NATURAL",
"NOT",
"NO_WRITE_TO_BINLOG",
"NULL",
"NUMERIC",
"ON",
98 "OPTIMIZE",
"OPTION",
"OPTIONALLY",
"OR",
"ORDER",
"OUT",
99 "OUTER",
"OUTFILE",
"PRECISION",
"PRIMARY",
"PROCEDURE",
"PURGE",
100 "RANGE",
"READ",
"READS",
"READ_WRITE",
"REAL",
"REFERENCES",
101 "REGEXP",
"RELEASE",
"RENAME",
"REPEAT",
"REPLACE",
"REQUIRE",
102 "RESTRICT",
"RETURN",
"REVOKE",
"RIGHT",
"RLIKE",
"SCHEMA",
103 "SCHEMAS",
"SECOND_MICROSECOND",
"SELECT",
"SENSITIVE",
"SEPARATOR",
"SET",
104 "SHOW",
"SMALLINT",
"SPATIAL",
"SPECIFIC",
"SQL",
"SQLEXCEPTION",
105 "SQLSTATE",
"SQLWARNING",
"SQL_BIG_RESULT",
"SQL_CALC_FOUND_ROWS",
"SQL_SMALL_RESULT",
"SSL",
106 "STARTING",
"STRAIGHT_JOIN",
"TABLE",
"TERMINATED",
"THEN",
"TINYBLOB",
107 "TINYINT",
"TINYTEXT",
"TO",
"TRAILING",
"TRIGGER",
"TRUE",
108 "UNDO",
"UNION",
"UNIQUE",
"UNLOCK",
"UNSIGNED",
"UPDATE",
109 "USAGE",
"USE",
"USING",
"UTC_DATE",
"UTC_TIME",
"UTC_TIMESTAMP",
110 "VALUES",
"VARBINARY",
"VARCHAR",
"VARCHARACTER",
"VARYING",
"WHEN",
111 "WHERE",
"WHILE",
"WITH",
"WRITE",
"XOR",
"YEAR_MONTH",
128 $this->
query(
"SET NAMES utf8");
131 $this->
query(
"SET SESSION SQL_MODE = 'ONLY_FULL_GROUP_BY'");
134 $this->
query(
"SET SESSION STORAGE_ENGINE = 'MYISAM'");
151 $this->
query(
"OPTIMIZE TABLE ".$a_table);
161 $vers = @mysql_get_server_info();
165 $vers = @mysqli_get_server_info($this->db->connection);
167 if (trim($vers) ==
"")
181 if((
int) $version[0] < 4)
194 if ($version[0] ==
"4" && $version[1] ==
"1")
212 if ((
int)$version[0] >= 5 ||
213 ((
int)$version[0] == 4 && (
int)$version[1] >= 1))
228 if(strlen($a_query) >= $this->max_allowed_packet_size)
251 if (
substr($version,0,1) ==
"4")
253 ini_get(
"post_max_size");
254 $query =
"SET GLOBAL max_allowed_packet = ".(int) ini_get(
"post_max_size") * 1024 * 1024;
259 $query =
"SHOW VARIABLES LIKE 'max_allowed_packet'";
264 $this->max_allowed_packet_size =
$row->value;
284 $f_str = implode($a_fields,
",");
285 $q =
"ALTER TABLE $a_table ADD FULLTEXT $i_name ($f_str)";
295 $this->
query(
"ALTER TABLE $a_table DROP FULLTEXT $i_name");
303 $set = $this->
query(
"SHOW INDEX FROM ".$a_table);
306 if ($rec[
"Key_name"] == $a_name && $rec[
"Index_type"] ==
"FULLTEXT")
326 $lock =
'LOCK TABLES ';
329 foreach($a_tables as $table)
335 $lock .= ($table[
'name'].
' ');
339 $lock .= ($table[
'alias'].
' ');
342 switch($table[
'type'])
353 $ilLog->write(__METHOD__.
': '.$lock);
363 $this->
query(
'UNLOCK TABLES');
369 return array(
'type' =>
'MyISAM');
376 return mysql_errno();
380 return mysqli_errno($this->db->connection);
388 return mysql_error();
392 return mysqli_error($this->db->connection);