Code Duplication    Length = 13-14 lines in 3 locations

htdocs/lib/clicompatbase.inc.php 3 locations

@@ 129-141 (lines=13) @@
126
 * @param string $sql
127
 * @param mixed $default
128
 */
129
function sqlValue($sql, $default)
130
{
131
    $rs = sql($sql);
132
    if ($r = sql_fetch_row($rs)) {
133
        if ($r[0] == null) {
134
            return $default;
135
        }
136
137
        return $r[0];
138
    }
139
140
    return $default;
141
}
142
143
/**
144
 * @deprecated use DBAL Conenction instead. See adminreports.php for an example implementation
@@ 149-161 (lines=13) @@
146
 * @param $default
147
 * @return mixed
148
 */
149
function sql_value_slave($sql, $default)
150
{
151
    $rs = sql_slave($sql);
152
    if ($r = sql_fetch_row($rs)) {
153
        if ($r[0] == null) {
154
            return $default;
155
        }
156
157
        return $r[0];
158
    }
159
160
    return $default;
161
}
162
163
/**
164
 * @deprecated use DBAL Conenction instead. See adminreports.php for an example implementation
@@ 541-554 (lines=14) @@
538
 * @param resource $rs
539
 * @return array|null
540
 */
541
function sql_fetch_column($rs)
542
{
543
    $col = [];
544
    while ($r = sql_fetch_row($rs)) {
545
        if (count($r) != 1) {
546
            return null;
547
        }
548
        $col[] = $r[0];
549
    }
550
    sql_free_result($rs);
551
552
    return $col;
553
}
554
555
/**
556
 * @deprecated use DBAL Conenction instead. See adminreports.php for an example implementation
557
 * @param $rs