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
|
|
@ -4,10 +4,10 @@ if (!defined('MSD_VERSION')) die('No direct access.');
|
|||
$sql='SHOW TABLES FROM `'.$db.'`';
|
||||
$tables=ARRAY();
|
||||
$link=MSD_mysql_connect();
|
||||
$res=mysql_query($sql,$link);
|
||||
$res=mysqli_query($link, $sql);
|
||||
if (!$res===false)
|
||||
{
|
||||
WHILE ($row=mysql_fetch_array($res,MYSQL_NUM))
|
||||
WHILE ($row=mysqli_fetch_array($res, MYSQLI_NUM))
|
||||
{
|
||||
$tables[]=$row[0];
|
||||
}
|
||||
|
|
@ -70,12 +70,12 @@ function mysql_search($db, $tabelle, $suchbegriffe, $suchart, $offset=0, $anzahl
|
|||
|
||||
// Felder ermitteln
|
||||
$sql='SHOW COLUMNS FROM `'.$db.'`.`'.$tables[$tabelle].'`';
|
||||
$res=mysql_query($sql,$link);
|
||||
$res=mysqli_query($link, $sql);
|
||||
unset($felder);
|
||||
if (!$res===false)
|
||||
{
|
||||
// Felder der Tabelle ermitteln
|
||||
WHILE ($row=mysql_fetch_object($res))
|
||||
WHILE ($row=mysqli_fetch_object($res))
|
||||
{
|
||||
$felder[]=$row->Field;
|
||||
}
|
||||
|
|
@ -130,10 +130,10 @@ function mysql_search($db, $tabelle, $suchbegriffe, $suchart, $offset=0, $anzahl
|
|||
else
|
||||
$sql='SELECT * FROM `'.$db.'`.`'.$tables[$tabelle].'` LIMIT '.$offset.','.$anzahl_ergebnisse;
|
||||
|
||||
$res=@mysql_query($sql,$link);
|
||||
$res=@mysqli_query($link, $sql);
|
||||
if ($res)
|
||||
{
|
||||
WHILE ($row=mysql_fetch_array($res,MYSQL_ASSOC))
|
||||
WHILE ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
|
||||
{
|
||||
//Treffer markieren
|
||||
foreach ($row as $key=>$val)
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ else
|
|||
$res=@MSD_query($sql_temp,false);
|
||||
if ($res)
|
||||
{
|
||||
if ($row=mysql_fetch_object($res))
|
||||
if ($row=mysqli_fetch_object($res))
|
||||
{
|
||||
$numrowsabs=$row->anzahl;
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ else
|
|||
|
||||
$sqltmp=$sql['sql_statement'] . $sql['order_statement'] . ( strpos(strtolower($sql['sql_statement'] . $sql['order_statement']),' limit ') ? '' : $limit );
|
||||
if (!$skip_mysql_execution) $res=MSD_query($sqltmp);
|
||||
$numrows=@mysql_num_rows($res);
|
||||
$numrows=@mysqli_num_rows($res);
|
||||
if ($numrowsabs == -1) $numrowsabs=$numrows;
|
||||
if ($limitende > $numrowsabs) $limitende=$numrowsabs;
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1)
|
|||
{
|
||||
//Infos und Header holen
|
||||
//1.Datensatz fuer Feldinfos
|
||||
$row=mysql_fetch_row($res);
|
||||
$row=mysqli_fetch_row($res);
|
||||
//Kompaktmodus-Switcher
|
||||
$t='<td colspan="' . ( count($row) + 1 ) . '" align="left"><a href="sql.php?db=' . $db . '&tablename=' . $tablename . '&dbid=' . $dbid . '&order=' . urlencode($order) . '&orderdir=' . $orderdir . '&limitstart=' . $limitstart . '&sql_statement=' . urlencode($sql['sql_statement']) . '&tdc=' . ( ( $tdcompact == 0 ) ? '1' : '0' ) . '">' . ( ( $tdcompact == 1 ) ? $lang['L_SQL_VIEW_STANDARD'] : $lang['L_SQL_VIEW_COMPACT'] ) . '</a>';
|
||||
$t.=' ' . $lang['L_SQL_QUERYENTRY'] . ' ' . count($row) . ' ' . $lang['L_SQL_COLUMNS'];
|
||||
|
|
@ -159,7 +159,7 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1)
|
|||
|
||||
for ($x=0; $x < count($row); $x++)
|
||||
{
|
||||
$temp[$x]['data']=mysql_fetch_field($res,$x);
|
||||
$temp[$x]['data']=(((($___mysqli_tmp = mysqli_fetch_field_direct($res, 0)) && is_object($___mysqli_tmp)) ? ( (!is_null($___mysqli_tmp->primary_key = ($___mysqli_tmp->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->multiple_key = ($___mysqli_tmp->flags & MYSQLI_MULTIPLE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->unique_key = ($___mysqli_tmp->flags & MYSQLI_UNIQUE_KEY_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->numeric = (int)(($___mysqli_tmp->type <= MYSQLI_TYPE_INT24) || ($___mysqli_tmp->type == MYSQLI_TYPE_YEAR) || ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? ($___mysqli_tmp->type == MYSQLI_TYPE_NEWDECIMAL) : 0)))) && (!is_null($___mysqli_tmp->blob = (int)in_array($___mysqli_tmp->type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) && (!is_null($___mysqli_tmp->unsigned = ($___mysqli_tmp->flags & MYSQLI_UNSIGNED_FLAG) ? 1 : 0)) && (!is_null($___mysqli_tmp->zerofill = ($___mysqli_tmp->flags & MYSQLI_ZEROFILL_FLAG) ? 1 : 0)) && (!is_null($___mysqli_type = $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = (($___mysqli_type == MYSQLI_TYPE_STRING) || ($___mysqli_type == MYSQLI_TYPE_VAR_STRING)) ? "type" : "")) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24))) ? "int" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && in_array($___mysqli_type, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, ((defined("MYSQLI_TYPE_NEWDECIMAL")) ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)))) ? "real" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIMESTAMP) ? "timestamp" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_YEAR) ? "year" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (($___mysqli_type == MYSQLI_TYPE_DATE) || ($___mysqli_type == MYSQLI_TYPE_NEWDATE))) ? "date " : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_TIME) ? "time" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_SET) ? "set" : $___mysqli_tmp->type)) &&(!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_ENUM) ? "enum" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_GEOMETRY) ? "geometry" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_DATETIME) ? "datetime" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && (in_array($___mysqli_type, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)))) ? "blob" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type && $___mysqli_type == MYSQLI_TYPE_NULL) ? "null" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->type = ("" == $___mysqli_tmp->type) ? "unknown" : $___mysqli_tmp->type)) && (!is_null($___mysqli_tmp->not_null = ($___mysqli_tmp->flags & MYSQLI_NOT_NULL_FLAG) ? 1 : 0)) ) : false ) ? $___mysqli_tmp : false);
|
||||
$temp[$x]['sort']=add_sortkey($temp[$x]['data']->name);
|
||||
}
|
||||
|
||||
|
|
@ -214,14 +214,14 @@ if ($numrowsabs > 0 && $Anzahl_SQLs <= 1)
|
|||
|
||||
$temp=array();
|
||||
//und jetzt Daten holen
|
||||
mysql_data_seek($res,0);
|
||||
mysqli_data_seek($res, 0);
|
||||
|
||||
$s=$keysort;
|
||||
$s=array_flip($keysort);
|
||||
ksort($s);
|
||||
for ($i=0; $i < $numrows; $i++)
|
||||
{
|
||||
$data[0]=mysql_fetch_array($res,MYSQL_ASSOC);
|
||||
$data[0]=mysqli_fetch_array($res, MYSQLI_ASSOC);
|
||||
if ($showtables == 1 && $tabellenansicht == 1)
|
||||
{
|
||||
// Spalten sortieren, wenn wir uns in einer Tabellenuebersicht befinden
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ $tpl->set_filenames(array(
|
|||
|
||||
$sqledit="SHOW FIELDS FROM `$tablename`";
|
||||
$res=MSD_query($sqledit);
|
||||
$num=mysql_numrows($res);
|
||||
$num=mysqli_num_rows($res);
|
||||
|
||||
$feldnamen="";
|
||||
for ($x=0; $x<$num; $x++)
|
||||
{
|
||||
$row=mysql_fetch_object($res);
|
||||
$row=mysqli_fetch_object($res);
|
||||
$feldnamen.=$row->Field.'|';
|
||||
$tpl->assign_block_vars('ROW',array(
|
||||
'CLASS' => ($x%2) ? 1 : 2,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ $fields=getExtendedFieldInfo($db,$tablename);
|
|||
|
||||
$sqledit="SELECT * FROM `$tablename` WHERE ".$recordkey;
|
||||
$res=MSD_query($sqledit);
|
||||
$record=mysql_fetch_array($res,MYSQL_ASSOC); // get the record
|
||||
$record=mysqli_fetch_array($res, MYSQLI_ASSOC); // get the record
|
||||
$num=sizeof($record); // get the nr of fields of the record
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -278,10 +278,10 @@ if (isset($_POST['newfield_posted']))
|
|||
$fields_infos=getFieldinfos($databases['Name'][$dbid],$table_edit_name);
|
||||
}
|
||||
}
|
||||
mysql_select_db($databases['Name'][$dbid]);
|
||||
((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE " . $databases['Name'][$dbid]));
|
||||
$sqlt="SHOW TABLE STATUS FROM `".$databases['Name'][$dbid]."` ;";
|
||||
$res=MSD_query($sqlt);
|
||||
$anz_tabellen=mysql_numrows($res);
|
||||
$anz_tabellen=mysqli_num_rows($res);
|
||||
$p="sql.php?db=".$databases['Name'][$dbid]."&dbid=$dbid&tablename=$table_edit_name&context=2";
|
||||
|
||||
echo '<form action="sql.php?db='.$databases['Name'][$dbid].'&dbid='.$dbid.'&tablename='.$table_edit_name.'&context=2" method="post">';
|
||||
|
|
@ -299,7 +299,7 @@ else
|
|||
echo '<td colspan="2"><select name="tableselect" onchange="this.form.submit()"><option value="1" SELECTED></option>';
|
||||
for ($i=0; $i<$anz_tabellen; $i++)
|
||||
{
|
||||
$row=mysql_fetch_array($res);
|
||||
$row=mysqli_fetch_array($res);
|
||||
echo '<option value="'.$row['Name'].'">'.$row['Name'].'</option>';
|
||||
}
|
||||
echo '</select> </td>';
|
||||
|
|
@ -310,7 +310,7 @@ if ($table_edit_name!="")
|
|||
{
|
||||
$sqlf="SHOW FULL FIELDS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name` ;";
|
||||
$res=MSD_query($sqlf);
|
||||
$anz_fields=mysql_num_rows($res);
|
||||
$anz_fields=mysqli_num_rows($res);
|
||||
$fields_infos=getFieldinfos($databases['Name'][$dbid],$table_edit_name);
|
||||
|
||||
if (MSD_NEW_VERSION) $t_engine=(isset($fields_infos['_tableinfo_']['ENGINE'])) ? $fields_infos['_tableinfo_']['ENGINE'] : "MyISAM";
|
||||
|
|
@ -462,7 +462,7 @@ if ($table_edit_name!="")
|
|||
</tr>';
|
||||
$sqlk="SHOW KEYS FROM `".$databases['Name'][$dbid]."`.`$table_edit_name`;";
|
||||
$res=MSD_query($sqlk);
|
||||
$num=mysql_numrows($res);
|
||||
$num=mysqli_num_rows($res);
|
||||
if ($num==0)
|
||||
{
|
||||
echo '<tr><td colspan="6">'.$lang['L_SQL_TABLENOINDEXES'].'</td></tr>';
|
||||
|
|
@ -471,7 +471,7 @@ if ($table_edit_name!="")
|
|||
{
|
||||
for ($i=0; $i<$num; $i++)
|
||||
{
|
||||
$row=mysql_fetch_array($res,MYSQL_ASSOC);
|
||||
$row=mysqli_fetch_array($res, MYSQLI_ASSOC);
|
||||
if (!isset($row['Comment'])) {
|
||||
$row['Comment'] = '';
|
||||
}
|
||||
|
|
@ -535,7 +535,7 @@ if ($table_edit_name!="")
|
|||
//body
|
||||
$sqlFelder="DESCRIBE `".$databases['Name'][$dbid]."`.`".$_GET['tablename']."`;";
|
||||
$res=MSD_query($sqlFelder);
|
||||
$num=mysql_numrows($res);
|
||||
$num=mysqli_num_rows($res);
|
||||
if ($num==0)
|
||||
{
|
||||
echo '<tr><td>'.$lang['L_SQL_TABLENOINDEXES'].'</td></tr>';
|
||||
|
|
@ -554,7 +554,7 @@ if ($table_edit_name!="")
|
|||
echo '<table class="bdr">';
|
||||
echo '<tr class="thead"><th>#</th><th>'.$lang['L_PRIMARYKEY_FIELD'].'</th><th>'.$lang['L_INFO_SIZE'].'</th>';
|
||||
|
||||
while ($row=mysql_fetch_array($res, MYSQL_ASSOC))
|
||||
while ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
|
||||
{
|
||||
$feldArray[$row['Field']]=$row['Type'];
|
||||
}
|
||||
|
|
|
|||
Laden …
Tabelle hinzufügen
Einen Link hinzufügen
In neuem Issue referenzieren