No obsolete mysql_* anymore

This commit is contained in:
Michael 2017-11-21 21:00:11 +00:00
parent 33ad6b6d7e
commit 723b40eea4
2 changed files with 1 additions and 49 deletions

View File

@ -93,18 +93,6 @@ class dba {
} }
} }
if (!self::$connected && function_exists('mysql_connect')) {
self::$driver = 'mysql';
self::$db = mysql_connect($serveraddr, $user, $pass);
if (self::$db && mysql_select_db($db, self::$db)) {
self::$connected = true;
if (isset($a->config["system"]["db_charset"])) {
mysql_set_charset($a->config["system"]["db_charset"], self::$db);
}
}
}
// No suitable SQL driver was found. // No suitable SQL driver was found.
if (!self::$connected) { if (!self::$connected) {
self::$db = null; self::$db = null;
@ -134,9 +122,6 @@ class dba {
case 'mysqli': case 'mysqli':
self::$_server_info = self::$db->server_info; self::$_server_info = self::$db->server_info;
break; break;
case 'mysql':
self::$_server_info = mysql_get_server_info(self::$db);
break;
} }
} }
return self::$_server_info; return self::$_server_info;
@ -216,8 +201,6 @@ class dba {
return substr(@self::$db->quote($str, PDO::PARAM_STR), 1, -1); return substr(@self::$db->quote($str, PDO::PARAM_STR), 1, -1);
case 'mysqli': case 'mysqli':
return @self::$db->real_escape_string($str); return @self::$db->real_escape_string($str);
case 'mysql':
return @mysql_real_escape_string($str,self::$db);
} }
} }
@ -235,9 +218,6 @@ class dba {
case 'mysqli': case 'mysqli':
$connected = self::$db->ping(); $connected = self::$db->ping();
break; break;
case 'mysql':
$connected = mysql_ping(self::$db);
break;
} }
return $connected; return $connected;
} }
@ -485,22 +465,6 @@ class dba {
self::$affected_rows = $retval->affected_rows; self::$affected_rows = $retval->affected_rows;
} }
break; break;
case 'mysql':
// For the old "mysql" functions we cannot use prepared statements
$retval = mysql_query(self::replace_parameters($sql, $args), self::$db);
if (mysql_errno(self::$db)) {
self::$error = mysql_error(self::$db);
self::$errorno = mysql_errno(self::$db);
} else {
self::$affected_rows = mysql_affected_rows($retval);
// Due to missing mysql_* support this here wasn't tested at all
// See here: http://php.net/manual/en/function.mysql-num-rows.php
if (self::$affected_rows <= 0) {
self::$affected_rows = mysql_num_rows($retval);
}
}
break;
} }
// We are having an own error logging in the function "e" // We are having an own error logging in the function "e"
@ -668,8 +632,6 @@ class dba {
return $stmt->columnCount(); return $stmt->columnCount();
case 'mysqli': case 'mysqli':
return $stmt->field_count; return $stmt->field_count;
case 'mysql':
return mysql_affected_rows($stmt);
} }
return 0; return 0;
} }
@ -688,8 +650,6 @@ class dba {
return $stmt->rowCount(); return $stmt->rowCount();
case 'mysqli': case 'mysqli':
return $stmt->num_rows; return $stmt->num_rows;
case 'mysql':
return mysql_num_rows($stmt);
} }
return 0; return 0;
} }
@ -740,8 +700,6 @@ class dba {
$columns[$fields[$param]->name] = $col; $columns[$fields[$param]->name] = $col;
} }
return $columns; return $columns;
case 'mysql':
return mysql_fetch_array($stmt, MYSQL_ASSOC);
} }
} }
@ -781,9 +739,6 @@ class dba {
case 'mysqli': case 'mysqli':
$id = self::$db->insert_id; $id = self::$db->insert_id;
break; break;
case 'mysql':
$id = mysql_insert_id(self::$db);
break;
} }
return $id; return $id;
} }
@ -1250,10 +1205,8 @@ class dba {
case 'pdo': case 'pdo':
return $stmt->closeCursor(); return $stmt->closeCursor();
case 'mysqli': case 'mysqli':
return $stmt->free_result(); $stmt->free_result();
return $stmt->close(); return $stmt->close();
case 'mysql':
return mysql_free_result($stmt);
} }
} }
} }

View File

@ -147,7 +147,6 @@ function import_account(App $a, $file) {
// import user // import user
$r = db_import_assoc('user', $account['user']); $r = db_import_assoc('user', $account['user']);
if ($r === false) { if ($r === false) {
//echo "<pre>"; var_dump($r, $query, mysql_error()); killme();
logger("uimport:insert user : ERROR : " . dba::errorMessage(), LOGGER_NORMAL); logger("uimport:insert user : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
notice(t("User creation error")); notice(t("User creation error"));
return; return;