1
0
Fork 0

Convert to mysqli

This commit converts all mysql_* function to the appropriate counterparts
in mysqli.
I used this tool for most of it:
https://github.com/philip/MySQLConverterTool
This makes it possible to continue using MysqlDumper with PHP 7.0
Dieser Commit ist enthalten in:
Hannes Rosenögger 2016-02-01 20:02:15 +01:00
Ursprung dd0e8aede7
Commit 5b995d339d
23 geänderte Dateien mit 210 neuen und 214 gelöschten Zeilen

Datei anzeigen

@ -276,23 +276,23 @@ function submit_create_action($sql)
}
}
$res=@mysql_query($sql);
$res=@mysqli_query($GLOBALS["___mysqli_ston"], $sql);
if ($res===false)
{
// erster Versuch fehlgeschlagen -> zweiter Versuch - vielleicht versteht der Server die Inline-Kommentare nicht?
$sql=del_inline_comments($sql);
$res=@mysql_query(downgrade($sql));
$res=@mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql));
if ($res===false)
{
// wieder nichts. Ok, haben wir hier einen alten MySQL-Server 3.x oder 4.0.x?
// versuchen wir es mal mit der alten Syntax
$res=@mysql_query(downgrade($sql));
$res=@mysqli_query($GLOBALS["___mysqli_ston"], downgrade($sql));
}
}
if ($res===false)
{
// wenn wir hier angekommen sind hat nichts geklappt -> Fehler ausgeben und abbrechen
SQLError($sql,mysql_error());
SQLError($sql,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
die("<br>Fatal error: Couldn't create table or view `".$tablename."´");
}
return $tablename;
@ -302,11 +302,11 @@ function get_insert_syntax($table)
{
$insert='';
$sql='SHOW COLUMNS FROM `'.$table.'`';
$res=mysql_query($sql);
$res=mysqli_query($GLOBALS["___mysqli_ston"], $sql);
if ($res)
{
$insert='INSERT INTO `'.$table.'` (';
while ($row=mysql_fetch_object($res))
while ($row=mysqli_fetch_object($res))
{
$insert.='`'.$row->Field.'`,';
}
@ -316,7 +316,7 @@ function get_insert_syntax($table)
{
global $restore;
v($restore);
SQLError($sql,mysql_error());
SQLError($sql,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
}
return $insert;
}