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:
Ursprung
dd0e8aede7
Commit
5b995d339d
23 geänderte Dateien mit 210 neuen und 214 gelöschten Zeilen
|
|
@ -114,14 +114,14 @@ function DBDetailInfo($index)
|
|||
MSD_mysql_connect();
|
||||
if (isset($databases['Name'][$index]))
|
||||
{
|
||||
mysql_select_db($databases['Name'][$index]);
|
||||
((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$index]));
|
||||
$databases['Detailinfo']['Name']=$databases['Name'][$index];
|
||||
$res=@mysql_query('SHOW TABLE STATUS FROM `'.$databases['Name'][$index].'`');
|
||||
if ($res) $databases['Detailinfo']['tables']=mysql_num_rows($res);
|
||||
$res=@mysqli_query($GLOBALS["___mysqli_ston"], 'SHOW TABLE STATUS FROM `'.$databases['Name'][$index].'`');
|
||||
if ($res) $databases['Detailinfo']['tables']=mysqli_num_rows($res);
|
||||
if ($databases['Detailinfo']['tables']>0)
|
||||
{
|
||||
$s1=$s2=0;
|
||||
while ($row= mysql_fetch_array($res, MYSQL_ASSOC))
|
||||
while ($row= mysqli_fetch_array($res, MYSQLI_ASSOC))
|
||||
{
|
||||
$s1+=$row['Rows'];
|
||||
$s2+=$row['Data_length']+$row['Index_length'];
|
||||
|
|
@ -423,9 +423,9 @@ function EmptyDB($dbn)
|
|||
{
|
||||
global $config;
|
||||
$t_sql=array();
|
||||
@mysql_query('SET FOREIGN_KEY_CHECKS=0');
|
||||
$res=mysql_query('SHOW TABLE STATUS FROM `'.$dbn.'`',$config['dbconnection']) or die('EmptyDB: '.mysql_error());
|
||||
WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC))
|
||||
@mysqli_query($GLOBALS["___mysqli_ston"], 'SET FOREIGN_KEY_CHECKS=0');
|
||||
$res=mysqli_query($config['dbconnection'], 'SHOW TABLE STATUS FROM `'.$dbn.'`') or die('EmptyDB: '.((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
|
||||
WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
|
||||
{
|
||||
if (substr(strtoupper($row['Comment']),0,4)=='VIEW')
|
||||
{
|
||||
|
|
@ -440,10 +440,10 @@ function EmptyDB($dbn)
|
|||
{
|
||||
for ($i=0; $i<count($t_sql); $i++)
|
||||
{
|
||||
$res=mysql_query($t_sql[$i]) or die('EmptyDB-Error: '.mysql_error());
|
||||
$res=mysqli_query($GLOBALS["___mysqli_ston"], $t_sql[$i]) or die('EmptyDB-Error: '.((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
|
||||
}
|
||||
}
|
||||
@mysql_query('SET FOREIGN_KEY_CHECKS=1');
|
||||
@mysqli_query($GLOBALS["___mysqli_ston"], 'SET FOREIGN_KEY_CHECKS=1');
|
||||
}
|
||||
|
||||
function AutoDelete()
|
||||
|
|
@ -1183,10 +1183,10 @@ function get_sql_encodings()
|
|||
// MySQL < 4.1
|
||||
$config['mysql_can_change_encoding']=false;
|
||||
$sqlt='SHOW VARIABLES LIKE \'character_set%\'';
|
||||
$res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error()));
|
||||
$res=MSD_query($sqlt) or die(SQLError($sqlt,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))));
|
||||
if ($res)
|
||||
{
|
||||
WHILE ($row=mysql_fetch_row($res))
|
||||
WHILE ($row=mysqli_fetch_row($res))
|
||||
{
|
||||
if ($row[0]=='character_set')
|
||||
{
|
||||
|
|
@ -1207,11 +1207,11 @@ function get_sql_encodings()
|
|||
// MySQL-Version >= 4.1
|
||||
$config['mysql_can_change_encoding']=true;
|
||||
$sqlt='SHOW CHARACTER SET';
|
||||
$res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error()));
|
||||
$res=MSD_query($sqlt) or die(SQLError($sqlt,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))));
|
||||
|
||||
if ($res)
|
||||
{
|
||||
WHILE ($row=mysql_fetch_row($res))
|
||||
WHILE ($row=mysqli_fetch_row($res))
|
||||
{
|
||||
$config['mysql_possible_character_sets'][]=$row[0].' - '.$row[1];
|
||||
}
|
||||
|
|
@ -1219,11 +1219,11 @@ function get_sql_encodings()
|
|||
}
|
||||
|
||||
$sqlt='SHOW VARIABLES LIKE \'character_set_connection\'';
|
||||
$res=MSD_query($sqlt) or die(SQLError($sqlt,mysql_error()));
|
||||
$res=MSD_query($sqlt) or die(SQLError($sqlt,((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))));
|
||||
|
||||
if ($res)
|
||||
{
|
||||
WHILE ($row=mysql_fetch_row($res))
|
||||
WHILE ($row=mysqli_fetch_row($res))
|
||||
{
|
||||
$config['mysql_standard_character_set']=$row[1];
|
||||
}
|
||||
|
|
|
|||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren