Permalink
Browse files

Вычищаем из кода использование функцию БД: num_fields(), field_type()…

…, field_name()
  • Loading branch information...
vponomarev committed Mar 5, 2017
1 parent 8b21a1b commit 3cce100ed95e9b27e0dd64c46267af28a4dc44e0
Showing with 5 additions and 19 deletions.
  1. +5 −19 engine/includes/inc/extrainst.inc.php
@@ -38,6 +38,7 @@ function generate_config_page($module, $params, $values = array()) {
global $tpl, $lang;
function mkParamLine($param) {
global $lang;
global $tpl;
if ($param['type'] == 'flat') {
@@ -191,28 +192,13 @@ function mysql_table_exists($table) {
// check field params
function get_mysql_field_type($table, $field) {
global $mysql;
$result = $mysql->query("SELECT * FROM $table limit 0");
$fields = $mysql->num_fields($result);
for ($i = 0; $i < $fields; $i++) {
if ($mysql->field_name($result, $i) == $field) {
$ft = $mysql->field_type($result, $i);
$fl = $mysql->field_len($result, $i);
if ($ft == 'string') {
$ft = 'char';
}
if ($ft == 'blob') {
$ft = 'text';
$fl = '';
}
$res = $ft . ($fl ? ' (' . $fl . ')' : '');
return $res;
}
foreach ($mysql->select("describe ".$table) as $l) {
if ($l['Field'] == $field)
return $l['Type'];
}
return '';
return false;
}
// Database update during install

0 comments on commit 3cce100

Please sign in to comment.