5 include_once (
"./Services/Database/classes/class.ilDB.php");
32 if (trim($this->getdbPort()) !=
"")
34 $db_port_str =
":".$this->getdbPort();
37 return "mysql://".$this->getDBUser().
":".$this->
getDBPassword().
38 "@".$this->getdbHost().$db_port_str.
"/".$this->
getDBName();
46 return "mysql://".$this->getDBUser().
":".$this->
getDBPassword().
47 "@".$this->getdbHost();
66 "ACCESSIBLE",
"ADD",
"ALL",
"ALTER",
"ANALYZE",
"AND",
67 "AS",
"ASC",
"ASENSITIVE",
"BEFORE",
"BETWEEN",
"BIGINT",
68 "BINARY",
"BLOB",
"BOTH",
"BY",
"CALL",
"CASCADE",
69 "CASE",
"CHANGE",
"CHAR",
"CHARACTER",
"CHECK",
"COLLATE",
70 "COLUMN",
"CONDITION",
"CONSTRAINT",
"CONTINUE",
"CONVERT",
"CREATE",
71 "CROSS",
"CURRENT_DATE",
"CURRENT_TIME",
"CURRENT_TIMESTAMP",
"CURRENT_USER",
"CURSOR",
72 "DATABASE",
"DATABASES",
"DAY_HOUR",
"DAY_MICROSECOND",
"DAY_MINUTE",
"DAY_SECOND",
73 "DEC",
"DECIMAL",
"DECLARE",
"DEFAULT",
"DELAYED",
"DELETE",
74 "DESC",
"DESCRIBE",
"DETERMINISTIC",
"DISTINCT",
"DISTINCTROW",
"DIV",
75 "DOUBLE",
"DROP",
"DUAL",
"EACH",
"ELSE",
"ELSEIF",
76 "ENCLOSED",
"ESCAPED",
"EXISTS",
"EXIT",
"EXPLAIN",
"FALSE",
77 "FETCH",
"FLOAT",
"FLOAT4",
"FLOAT8",
"FOR",
"FORCE",
78 "FOREIGN",
"FROM",
"FULLTEXT",
"GRANT",
"GROUP",
"HAVING",
79 "HIGH_PRIORITY",
"HOUR_MICROSECOND",
"HOUR_MINUTE",
"HOUR_SECOND",
"IF",
"IGNORE",
80 "IN",
"INDEX",
"INFILE",
"INNER",
"INOUT",
"INSENSITIVE",
81 "INSERT",
"INT",
"INT1",
"INT2",
"INT3",
"INT4",
82 "INT8",
"INTEGER",
"INTERVAL",
"INTO",
"IS",
"ITERATE",
83 "JOIN",
"KEY",
"KEYS",
"KILL",
"LEADING",
"LEAVE",
84 "LEFT",
"LIKE",
"LIMIT",
"LINEAR",
"LINES",
"LOAD",
85 "LOCALTIME",
"LOCALTIMESTAMP",
"LOCK",
"LONG",
"LONGBLOB",
"LONGTEXT",
86 "LOOP",
"LOW_PRIORITY",
"MASTER_SSL_VERIFY_SERVER_CERT",
"MATCH",
"MEDIUMBLOB",
"MEDIUMINT",
87 "MEDIUMTEXT",
"MIDDLEINT",
"MINUTE_MICROSECOND",
"MINUTE_SECOND",
"MOD",
"MODIFIES",
88 "NATURAL",
"NOT",
"NO_WRITE_TO_BINLOG",
"NULL",
"NUMERIC",
"ON",
89 "OPTIMIZE",
"OPTION",
"OPTIONALLY",
"OR",
"ORDER",
"OUT",
90 "OUTER",
"OUTFILE",
"PRECISION",
"PRIMARY",
"PROCEDURE",
"PURGE",
91 "RANGE",
"READ",
"READS",
"READ_WRITE",
"REAL",
"REFERENCES",
92 "REGEXP",
"RELEASE",
"RENAME",
"REPEAT",
"REPLACE",
"REQUIRE",
93 "RESTRICT",
"RETURN",
"REVOKE",
"RIGHT",
"RLIKE",
"SCHEMA",
94 "SCHEMAS",
"SECOND_MICROSECOND",
"SELECT",
"SENSITIVE",
"SEPARATOR",
"SET",
95 "SHOW",
"SMALLINT",
"SPATIAL",
"SPECIFIC",
"SQL",
"SQLEXCEPTION",
96 "SQLSTATE",
"SQLWARNING",
"SQL_BIG_RESULT",
"SQL_CALC_FOUND_ROWS",
"SQL_SMALL_RESULT",
"SSL",
97 "STARTING",
"STRAIGHT_JOIN",
"TABLE",
"TERMINATED",
"THEN",
"TINYBLOB",
98 "TINYINT",
"TINYTEXT",
"TO",
"TRAILING",
"TRIGGER",
"TRUE",
99 "UNDO",
"UNION",
"UNIQUE",
"UNLOCK",
"UNSIGNED",
"UPDATE",
100 "USAGE",
"USE",
"USING",
"UTC_DATE",
"UTC_TIME",
"UTC_TIMESTAMP",
101 "VALUES",
"VARBINARY",
"VARCHAR",
"VARCHARACTER",
"VARYING",
"WHEN",
102 "WHERE",
"WHILE",
"WITH",
"WRITE",
"XOR",
"YEAR_MONTH",
119 $this->
query(
"SET NAMES utf8");
122 $this->
query(
"SET SESSION SQL_MODE = 'ONLY_FULL_GROUP_BY'");
141 $this->
query(
"OPTIMIZE TABLE ".$a_table);
149 $vers = @mysql_get_server_info();
150 if (trim($vers) ==
"")
164 if((
int) $version[0] < 4)
177 if ($version[0] ==
"4" && $version[1] ==
"1")
195 if ((
int)$version[0] >= 5 ||
196 ((
int)$version[0] == 4 && (
int)$version[1] >= 1))
211 if(strlen($a_query) >= $this->max_allowed_packet_size)
229 $query =
"SHOW VARIABLES LIKE 'version'";
233 $version =
$row->Value;
240 if (substr($version,0,1) ==
"4")
242 ini_get(
"post_max_size");
243 $query =
"SET GLOBAL max_allowed_packet = ".(int) ini_get(
"post_max_size") * 1024 * 1024;
248 $query =
"SHOW VARIABLES LIKE 'max_allowed_packet'";
253 $this->max_allowed_packet_size =
$row->value;
273 $f_str = implode($a_fields,
",");
274 $q =
"ALTER TABLE $a_table ADD FULLTEXT $i_name ($f_str)";
284 $this->
query(
"ALTER TABLE $a_table DROP FULLTEXT $i_name");
292 $set = $this->
query(
"SHOW INDEX FROM ".$a_table);
295 if ($rec[
"Key_name"] == $a_name && $rec[
"Index_type"] ==
"FULLTEXT")
315 $lock =
'LOCK TABLES ';
318 foreach($a_tables as $table)
324 $lock .= ($table[
'name'].
' ');
328 $lock .= ($table[
'alias'].
' ');
331 switch($table[
'type'])
342 $ilLog->write(__METHOD__.
': '.$lock);
352 $this->
query(
'UNLOCK TABLES');