Rev 8 | Rev 10 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8 | Rev 9 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | // TODO: test everything |
3 | // TODO: test everything |
4 | // TODO: return values? |
4 | // TODO: return values? |
5 | // TODO: check if we matched all stuff mentioned here: https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html |
5 | // TODO: check if we matched all stuff mentioned here: https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html |
- | 6 | // TODO: translate descriptions to english |
|
- | 7 | ||
- | 8 | $xxx_vts_prepend_config = array(); |
|
- | 9 | if (file_exists($xxx_vts_prepend_config_file = __DIR__.'/config.local.php')) include $xxx_vts_prepend_config_file; |
|
- | 10 | unset($xxx_vts_prepend_config_file); |
|
- | 11 | $xxx_directories_need_mysql = $xxx_vts_prepend_config['directories_need_mysql']; |
|
- | 12 | unset($xxx_vts_prepend_config); |
|
- | 13 | ||
- | 14 | $xxx_go = false; |
|
- | 15 | foreach ($xxx_directories_need_mysql as $xxx_directory_need_mysql) { |
|
- | 16 | if ($xxx_negate = (substr($xxx_directory_need_mysql,0,1) === '!')) { |
|
- | 17 | $xxx_directory_need_mysql = substr($xxx_directory_need_mysql,1); |
|
- | 18 | } |
|
- | 19 | if (strpos($_SERVER['SCRIPT_FILENAME'], $xxx_directory_need_mysql) === 0) { |
|
- | 20 | $xxx_go = !$xxx_negate; |
|
- | 21 | } |
|
- | 22 | unset($xxx_negate); |
|
- | 23 | } |
|
- | 24 | unset($xxx_directories_need_mysql); |
|
- | 25 | unset($xxx_directory_need_mysql); |
|
- | 26 | ||
- | 27 | if ($xxx_go && !function_exists('mysql_connect')) { |
|
6 | 28 | ||
7 | $vts_mysqli = null; |
29 | $vts_mysqli = null; |
8 | $vts_mysqli_report_set_once = false; |
30 | $vts_mysqli_report_set_once = false; |
9 | 31 | ||
10 | // Liefert die Anzahl betroffener Datensätze einer vorhergehenden MySQL Operation |
32 | // Liefert die Anzahl betroffener Datensätze einer vorhergehenden MySQL Operation |
11 | function mysql_affected_rows($link_identifier=NULL) { |
33 | function mysql_affected_rows($link_identifier=NULL) { |
12 | global $vts_mysqli; |
34 | global $vts_mysqli; |
13 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
35 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
14 | if (is_null($li)) throw new Exception("Cannot execute mysql_affected_rows(). No valid connection to server."); |
36 | if (is_null($li)) throw new Exception("Cannot execute mysql_affected_rows(). No valid connection to server."); |
15 | - | ||
16 | return $li->affected_rows; |
37 | return $li->affected_rows; |
17 | } |
38 | } |
18 | 39 | ||
19 | // Liefert den Namen des Zeichensatzes |
40 | // Liefert den Namen des Zeichensatzes |
20 | function mysql_client_encoding($link_identifier=NULL) { |
41 | function mysql_client_encoding($link_identifier=NULL) { |
21 | global $vts_mysqli; |
42 | global $vts_mysqli; |
22 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
43 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
23 | if (is_null($li)) throw new Exception("Cannot execute mysql_client_encoding(). No valid connection to server."); |
44 | if (is_null($li)) throw new Exception("Cannot execute mysql_client_encoding(). No valid connection to server."); |
24 | - | ||
25 | return $li->character_set_name(); |
45 | return $li->character_set_name(); |
26 | } |
46 | } |
27 | 47 | ||
28 | // Schließt eine Verbindung zu MySQL |
48 | // Schließt eine Verbindung zu MySQL |
29 | function mysql_close($link_identifier=NULL) { |
49 | function mysql_close($link_identifier=NULL) { |
30 | global $vts_mysqli; |
50 | global $vts_mysqli; |
31 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
51 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
32 | if (is_null($li)) throw new Exception("Cannot execute mysql_close(). No valid connection to server."); |
52 | if (is_null($li)) throw new Exception("Cannot execute mysql_close(). No valid connection to server."); |
33 | - | ||
34 | return $li->close(); |
53 | return $li->close(); |
35 | } |
54 | } |
36 | 55 | ||
37 | // Öffnet eine Verbindung zu einem MySQL-Server |
56 | // Öffnet eine Verbindung zu einem MySQL-Server |
38 | function mysql_connect($server=null, $username=null, $password=null, $new_link=false, $client_flags=0) { |
57 | function mysql_connect($server=null, $username=null, $password=null, $new_link=false, $client_flags=0) { |
Line 56... | Line 75... | ||
56 | // Anlegen einer MySQL-Datenbank |
75 | // Anlegen einer MySQL-Datenbank |
57 | function mysql_create_db($database_name, $link_identifier=NULL) { |
76 | function mysql_create_db($database_name, $link_identifier=NULL) { |
58 | global $vts_mysqli; |
77 | global $vts_mysqli; |
59 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
78 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
60 | if (is_null($li)) throw new Exception("Cannot execute mysql_create_db(). No valid connection to server."); |
79 | if (is_null($li)) throw new Exception("Cannot execute mysql_create_db(). No valid connection to server."); |
61 | - | ||
62 | return mysql_query("CREATE DATABASE `$database_name`", $li) !== false; |
80 | return mysql_query("CREATE DATABASE `$database_name`", $li) !== false; |
63 | } |
81 | } |
64 | 82 | ||
65 | // Bewegt den internen Ergebnis-Zeiger |
83 | // Bewegt den internen Ergebnis-Zeiger |
66 | function mysql_data_seek($result, $row_number) { |
84 | function mysql_data_seek($result, $row_number) { |
Line 84... | Line 102... | ||
84 | // Selektiert ein Schema und führt in ihm Anfrage aus |
102 | // Selektiert ein Schema und führt in ihm Anfrage aus |
85 | function mysql_db_query($database, $query, $link_identifier=NULL) { |
103 | function mysql_db_query($database, $query, $link_identifier=NULL) { |
86 | global $vts_mysqli; |
104 | global $vts_mysqli; |
87 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
105 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
88 | if (is_null($li)) throw new Exception("Cannot execute mysql_db_query(). No valid connection to server."); |
106 | if (is_null($li)) throw new Exception("Cannot execute mysql_db_query(). No valid connection to server."); |
89 | - | ||
90 | mysql_select_db($database, $li); |
107 | mysql_select_db($database, $li); |
91 | return mysql_query($query, $li); |
108 | return mysql_query($query, $li); |
92 | // Note: The mysql_*() implementation defines, that we will not jump back to our original DB |
109 | // Note: The mysql_*() implementation defines, that we will not jump back to our original DB |
93 | } |
110 | } |
94 | 111 | ||
95 | // Löschen eines Schemas |
112 | // Löschen eines Schemas |
96 | function mysql_drop_db($database_name, $link_identifier=NULL) { |
113 | function mysql_drop_db($database_name, $link_identifier=NULL) { |
97 | global $vts_mysqli; |
114 | global $vts_mysqli; |
98 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
115 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
99 | if (is_null($li)) throw new Exception("Cannot execute mysql_drop_db(). No valid connection to server."); |
116 | if (is_null($li)) throw new Exception("Cannot execute mysql_drop_db(). No valid connection to server."); |
100 | - | ||
101 | return mysql_query("DROP DATABASE `$database_name`", $li) !== false; |
117 | return mysql_query("DROP DATABASE `$database_name`", $li) !== false; |
102 | } |
118 | } |
103 | 119 | ||
104 | // Liefert die Nummer einer Fehlermeldung einer zuvor ausgeführten MySQL Operation |
120 | // Liefert die Nummer einer Fehlermeldung einer zuvor ausgeführten MySQL Operation |
105 | function mysql_errno($link_identifier=NULL) { |
121 | function mysql_errno($link_identifier=NULL) { |
106 | global $vts_mysqli; |
122 | global $vts_mysqli; |
107 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
123 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
108 | if (is_null($li)) throw new Exception("Cannot execute mysql_errno(). No valid connection to server."); |
124 | if (is_null($li)) throw new Exception("Cannot execute mysql_errno(). No valid connection to server."); |
109 | - | ||
110 | return !empty($li->connect_errno) ? $li->connect_errno : $li->errno; |
125 | return !empty($li->connect_errno) ? $li->connect_errno : $li->errno; |
111 | } |
126 | } |
112 | 127 | ||
113 | // Liefert den Fehlertext der zuvor ausgeführten MySQL Operation |
128 | // Liefert den Fehlertext der zuvor ausgeführten MySQL Operation |
114 | function mysql_error($link_identifier=NULL) { |
129 | function mysql_error($link_identifier=NULL) { |
115 | global $vts_mysqli; |
130 | global $vts_mysqli; |
116 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
131 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
117 | if (is_null($li)) throw new Exception("Cannot execute mysql_error(). No valid connection to server."); |
132 | if (is_null($li)) throw new Exception("Cannot execute mysql_error(). No valid connection to server."); |
118 | - | ||
119 | return !empty($li->connect_error) ? $li->connect_error : $li->error; |
133 | return !empty($li->connect_error) ? $li->connect_error : $li->error; |
120 | } |
134 | } |
121 | 135 | ||
122 | // Maskiert einen String zur Benutzung in einer MySQL Abfrage |
136 | // Maskiert einen String zur Benutzung in einer MySQL Abfrage |
123 | function mysql_escape_string($unescaped_string) { |
137 | function mysql_escape_string($unescaped_string) { |
Line 258... | Line 272... | ||
258 | // Liefert MySQL Host Informationen |
272 | // Liefert MySQL Host Informationen |
259 | function mysql_get_host_info($link_identifier=NULL) { |
273 | function mysql_get_host_info($link_identifier=NULL) { |
260 | global $vts_mysqli; |
274 | global $vts_mysqli; |
261 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
275 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
262 | if (is_null($li)) throw new Exception("Cannot execute mysql_get_host_info(). No valid connection to server."); |
276 | if (is_null($li)) throw new Exception("Cannot execute mysql_get_host_info(). No valid connection to server."); |
263 | - | ||
264 | return $li->host_info; |
277 | return $li->host_info; |
265 | } |
278 | } |
266 | 279 | ||
267 | // Liefert MySQL Protokollinformationen |
280 | // Liefert MySQL Protokollinformationen |
268 | function mysql_get_proto_info($link_identifier=NULL) { |
281 | function mysql_get_proto_info($link_identifier=NULL) { |
269 | global $vts_mysqli; |
282 | global $vts_mysqli; |
270 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
283 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
271 | if (is_null($li)) throw new Exception("Cannot execute mysql_get_proto_info(). No valid connection to server."); |
284 | if (is_null($li)) throw new Exception("Cannot execute mysql_get_proto_info(). No valid connection to server."); |
272 | - | ||
273 | return $li->protocol_version; |
285 | return $li->protocol_version; |
274 | } |
286 | } |
275 | 287 | ||
276 | // Liefert MySQL Server Informationen |
288 | // Liefert MySQL Server Informationen |
277 | function mysql_get_server_info($link_identifier=NULL) { |
289 | function mysql_get_server_info($link_identifier=NULL) { |
278 | global $vts_mysqli; |
290 | global $vts_mysqli; |
279 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
291 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
280 | if (is_null($li)) throw new Exception("Cannot execute mysql_get_server_info(). No valid connection to server."); |
292 | if (is_null($li)) throw new Exception("Cannot execute mysql_get_server_info(). No valid connection to server."); |
281 | - | ||
282 | return $li->server_info; |
293 | return $li->server_info; |
283 | } |
294 | } |
284 | 295 | ||
285 | // Liefert Informationen über die zuletzt ausgeführte Anfrage zurück |
296 | // Liefert Informationen über die zuletzt ausgeführte Anfrage zurück |
286 | function mysql_info($link_identifier=NULL) { |
297 | function mysql_info($link_identifier=NULL) { |
287 | global $vts_mysqli; |
298 | global $vts_mysqli; |
288 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
299 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
289 | if (is_null($li)) throw new Exception("Cannot execute mysql_info(). No valid connection to server."); |
300 | if (is_null($li)) throw new Exception("Cannot execute mysql_info(). No valid connection to server."); |
290 | - | ||
291 | return $li->info; |
301 | return $li->info; |
292 | } |
302 | } |
293 | 303 | ||
294 | // Liefert die ID, die in der vorherigen Abfrage erzeugt wurde |
304 | // Liefert die ID, die in der vorherigen Abfrage erzeugt wurde |
295 | function mysql_insert_id($link_identifier=NULL) { |
305 | function mysql_insert_id($link_identifier=NULL) { |
296 | global $vts_mysqli; |
306 | global $vts_mysqli; |
297 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
307 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
298 | if (is_null($li)) throw new Exception("Cannot execute mysql_insert_id(). No valid connection to server."); |
308 | if (is_null($li)) throw new Exception("Cannot execute mysql_insert_id(). No valid connection to server."); |
299 | - | ||
300 | return $li->insert_id; |
309 | return $li->insert_id; |
301 | } |
310 | } |
302 | 311 | ||
303 | // Auflistung der verfügbaren Datenbanken (Schemata) auf einem MySQL Server |
312 | // Auflistung der verfügbaren Datenbanken (Schemata) auf einem MySQL Server |
304 | function mysql_list_dbs($link_identifier=NULL) { |
313 | function mysql_list_dbs($link_identifier=NULL) { |
305 | global $vts_mysqli; |
314 | global $vts_mysqli; |
306 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
315 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
307 | if (is_null($li)) throw new Exception("Cannot execute mysql_list_dbs(). No valid connection to server."); |
316 | if (is_null($li)) throw new Exception("Cannot execute mysql_list_dbs(). No valid connection to server."); |
308 | - | ||
309 | return mysql_query('SHOW DATABASES', $li); |
317 | return mysql_query('SHOW DATABASES', $li); |
310 | } |
318 | } |
311 | 319 | ||
312 | // Listet MySQL Tabellenfelder auf |
320 | // Listet MySQL Tabellenfelder auf |
313 | function mysql_list_fields($database_name, $table_name, $link_identifier=NULL) { |
321 | function mysql_list_fields($database_name, $table_name, $link_identifier=NULL) { |
314 | global $vts_mysqli; |
322 | global $vts_mysqli; |
315 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
323 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
316 | if (is_null($li)) throw new Exception("Cannot execute mysql_list_fields(). No valid connection to server."); |
324 | if (is_null($li)) throw new Exception("Cannot execute mysql_list_fields(). No valid connection to server."); |
317 | - | ||
318 | return mysql_query("SHOW COLUMNS FROM `$database_name`.`$table_name`", $li); |
325 | return mysql_query("SHOW COLUMNS FROM `$database_name`.`$table_name`", $li); |
319 | } |
326 | } |
320 | 327 | ||
321 | // Zeigt die MySQL Prozesse an |
328 | // Zeigt die MySQL Prozesse an |
322 | function mysql_list_processes($link_identifier=NULL) { |
329 | function mysql_list_processes($link_identifier=NULL) { |
323 | global $vts_mysqli; |
330 | global $vts_mysqli; |
324 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
331 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
325 | if (is_null($li)) throw new Exception("Cannot execute mysql_list_processes(). No valid connection to server."); |
332 | if (is_null($li)) throw new Exception("Cannot execute mysql_list_processes(). No valid connection to server."); |
326 | - | ||
327 | return $li->thread_id; |
333 | return $li->thread_id; |
328 | } |
334 | } |
329 | 335 | ||
330 | // Listet Tabellen in einer MySQL Datenbank auf |
336 | // Listet Tabellen in einer MySQL Datenbank auf |
331 | function mysql_list_tables($database, $link_identifier=NULL) { |
337 | function mysql_list_tables($database, $link_identifier=NULL) { |
332 | global $vts_mysqli; |
338 | global $vts_mysqli; |
333 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
339 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
334 | if (is_null($li)) throw new Exception("Cannot execute mysql_list_tables(). No valid connection to server."); |
340 | if (is_null($li)) throw new Exception("Cannot execute mysql_list_tables(). No valid connection to server."); |
335 | - | ||
336 | return mysql_query("SHOW TABLES FROM `$database`", $li); |
341 | return mysql_query("SHOW TABLES FROM `$database`", $li); |
337 | } |
342 | } |
338 | 343 | ||
339 | // Liefert die Anzahl der Felder in einem Ergebnis |
344 | // Liefert die Anzahl der Felder in einem Ergebnis |
340 | function mysql_num_fields($result) { |
345 | function mysql_num_fields($result) { |
Line 372... | Line 377... | ||
372 | // Ping a server connection or reconnect if there is no connection |
377 | // Ping a server connection or reconnect if there is no connection |
373 | function mysql_ping($link_identifier=NULL) { |
378 | function mysql_ping($link_identifier=NULL) { |
374 | global $vts_mysqli; |
379 | global $vts_mysqli; |
375 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
380 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
376 | if (is_null($li)) throw new Exception("Cannot execute mysql_ping(). No valid connection to server."); |
381 | if (is_null($li)) throw new Exception("Cannot execute mysql_ping(). No valid connection to server."); |
377 | - | ||
378 | return $li->ping(); |
382 | return $li->ping(); |
379 | } |
383 | } |
380 | 384 | ||
381 | // Sendet eine Anfrage an MySQL |
385 | // Sendet eine Anfrage an MySQL |
382 | function mysql_query($query, $link_identifier=NULL) { |
386 | function mysql_query($query, $link_identifier=NULL) { |
383 | global $vts_mysqli; |
387 | global $vts_mysqli; |
384 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
388 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
385 | if (is_null($li)) throw new Exception("Cannot execute mysql_query(). No valid connection to server."); |
389 | if (is_null($li)) throw new Exception("Cannot execute mysql_query(). No valid connection to server."); |
386 | - | ||
387 | return $li->query($query, $resultmode=MYSQLI_STORE_RESULT); |
390 | return $li->query($query, $resultmode=MYSQLI_STORE_RESULT); |
388 | } |
391 | } |
389 | 392 | ||
390 | // Maskiert spezielle Zeichen innerhalb eines Strings für die Verwendung in einer SQL-Anweisung |
393 | // Maskiert spezielle Zeichen innerhalb eines Strings für die Verwendung in einer SQL-Anweisung |
391 | function mysql_real_escape_string($unescaped_string, $link_identifier=NULL) { |
394 | function mysql_real_escape_string($unescaped_string, $link_identifier=NULL) { |
392 | global $vts_mysqli; |
395 | global $vts_mysqli; |
393 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
396 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
394 | if (is_null($li)) throw new Exception("Cannot execute mysql_real_escape_string(). No valid connection to server."); |
397 | if (is_null($li)) throw new Exception("Cannot execute mysql_real_escape_string(). No valid connection to server."); |
395 | - | ||
396 | return $li->escape_string($unescaped_string); |
398 | return $li->escape_string($unescaped_string); |
397 | } |
399 | } |
398 | 400 | ||
399 | // Liefert Ergebnis |
401 | // Liefert Ergebnis |
400 | function mysql_result($result, $row, $field=0) { |
402 | function mysql_result($result, $row, $field=0) { |
Line 409... | Line 411... | ||
409 | // Auswahl einer MySQL Datenbank |
411 | // Auswahl einer MySQL Datenbank |
410 | function mysql_select_db($database_name, $link_identifier=NULL) { |
412 | function mysql_select_db($database_name, $link_identifier=NULL) { |
411 | global $vts_mysqli; |
413 | global $vts_mysqli; |
412 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
414 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
413 | if (is_null($li)) throw new Exception("Cannot execute mysql_select_db(). No valid connection to server."); |
415 | if (is_null($li)) throw new Exception("Cannot execute mysql_select_db(). No valid connection to server."); |
414 | - | ||
415 | return $li->select_db($database_name); |
416 | return $li->select_db($database_name); |
416 | } |
417 | } |
417 | 418 | ||
418 | // Setzt den Verbindungszeichensatz |
419 | // Setzt den Verbindungszeichensatz |
419 | function mysql_set_charset($charset, $link_identifier=NULL) { |
420 | function mysql_set_charset($charset, $link_identifier=NULL) { |
420 | global $vts_mysqli; |
421 | global $vts_mysqli; |
421 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
422 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
422 | if (is_null($li)) throw new Exception("Cannot execute mysql_set_charset(). No valid connection to server."); |
423 | if (is_null($li)) throw new Exception("Cannot execute mysql_set_charset(). No valid connection to server."); |
423 | - | ||
424 | return $li->set_charset($charset); |
424 | return $li->set_charset($charset); |
425 | } |
425 | } |
426 | 426 | ||
427 | // Zeigt den momentanen Serverstatus an |
427 | // Zeigt den momentanen Serverstatus an |
428 | function mysql_stat($link_identifier=NULL) { |
428 | function mysql_stat($link_identifier=NULL) { |
429 | global $vts_mysqli; |
429 | global $vts_mysqli; |
430 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
430 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
431 | if (is_null($li)) throw new Exception("Cannot execute mysql_stat(). No valid connection to server."); |
431 | if (is_null($li)) throw new Exception("Cannot execute mysql_stat(). No valid connection to server."); |
432 | - | ||
433 | return $li->stat(); |
432 | return $li->stat(); |
434 | } |
433 | } |
435 | 434 | ||
436 | // Liefert den Namen einer Tabelle |
435 | // Liefert den Namen einer Tabelle |
437 | function mysql_tablename($result, $i) { |
436 | function mysql_tablename($result, $i) { |
Line 446... | Line 445... | ||
446 | // Zeigt die aktuelle Thread ID an |
445 | // Zeigt die aktuelle Thread ID an |
447 | function mysql_thread_id($link_identifier=NULL) { |
446 | function mysql_thread_id($link_identifier=NULL) { |
448 | global $vts_mysqli; |
447 | global $vts_mysqli; |
449 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
448 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
450 | if (is_null($li)) throw new Exception("Cannot execute mysql_thread_id(). No valid connection to server."); |
449 | if (is_null($li)) throw new Exception("Cannot execute mysql_thread_id(). No valid connection to server."); |
451 | - | ||
452 | return $li->thread_id; |
450 | return $li->thread_id; |
453 | } |
451 | } |
454 | 452 | ||
455 | // Sendet eine SQL Anfrage an MySQL, ohne Ergebniszeilen abzuholen und zu puffern |
453 | // Sendet eine SQL Anfrage an MySQL, ohne Ergebniszeilen abzuholen und zu puffern |
456 | function mysql_unbuffered_query($query, $link_identifier=NULL) { |
454 | function mysql_unbuffered_query($query, $link_identifier=NULL) { |
457 | global $vts_mysqli; |
455 | global $vts_mysqli; |
458 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
456 | $li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
459 | if (is_null($li)) throw new Exception("Cannot execute mysql_unbuffered_query(). No valid connection to server."); |
457 | if (is_null($li)) throw new Exception("Cannot execute mysql_unbuffered_query(). No valid connection to server."); |
460 | - | ||
461 | // http://php.net/manual/de/mysqlinfo.concepts.buffering.php |
458 | // http://php.net/manual/de/mysqlinfo.concepts.buffering.php |
462 | // https://stackoverflow.com/questions/1982016/unbuffered-query-with-mysqli?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa |
459 | // https://stackoverflow.com/questions/1982016/unbuffered-query-with-mysqli?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa |
463 | $li->real_query($query); |
460 | $li->real_query($query); |
464 | $li->use_result(); |
461 | $li->use_result(); |
465 | } |
462 | } |
466 | 463 | ||
- | 464 | } |
|
- | 465 | unset($xxx_directories_need_mysql); |
|
- | 466 | unset($xxx_directory_need_mysql); |