1 | <?php |
||||
2 | /** |
||||
3 | * MDB2 Wrapper Made To Handle Like Our Other Classes Related Functionality |
||||
4 | * @author Joe Huss <[email protected]> |
||||
5 | * @copyright 2025 |
||||
6 | * @package MyAdmin |
||||
7 | * @category SQL |
||||
8 | */ |
||||
9 | |||||
10 | namespace MyDb\Mdb2; |
||||
11 | |||||
12 | use MyDb\Generic; |
||||
13 | use MyDb\Mysqli\Db as MysqliDb; |
||||
14 | use MyDb\Db_Interface; |
||||
15 | |||||
16 | /** |
||||
17 | * Db |
||||
18 | * |
||||
19 | * @access public |
||||
20 | */ |
||||
21 | class Db extends MysqliDb implements Db_Interface |
||||
22 | { |
||||
23 | public $host = 'localhost'; |
||||
24 | public $user = 'pdns'; |
||||
25 | public $password = ''; |
||||
26 | public $database = 'pdns'; |
||||
27 | public $type = 'mdb2'; |
||||
28 | public $error = false; |
||||
29 | public $message = ''; |
||||
30 | |||||
31 | /** |
||||
32 | * Db::quote() |
||||
33 | * @param string $text |
||||
34 | * @param string $type |
||||
35 | * @return string |
||||
36 | */ |
||||
37 | 1 | public function quote($text = '', $type = 'text') |
|||
38 | { |
||||
39 | switch ($type) { |
||||
40 | 1 | case 'text': |
|||
41 | 1 | return "'".$this->escape($text)."'"; |
|||
42 | break; |
||||
0 ignored issues
–
show
|
|||||
43 | 1 | case 'integer': |
|||
44 | 1 | return (int) $text; |
|||
45 | break; |
||||
46 | default: |
||||
47 | 1 | return $text; |
|||
48 | break; |
||||
49 | } |
||||
50 | } |
||||
51 | |||||
52 | /** |
||||
53 | * Db::queryOne() |
||||
54 | * |
||||
55 | * @param mixed $query |
||||
56 | * @param string $line |
||||
57 | * @param string $file |
||||
58 | * @return bool |
||||
59 | */ |
||||
60 | 1 | public function queryOne($query, $line = '', $file = '') |
|||
61 | { |
||||
62 | 1 | $this->query($query, $line, $file); |
|||
0 ignored issues
–
show
$line of type string is incompatible with the type integer expected by parameter $line of MyDb\Mysqli\Db::query() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
63 | 1 | if ($this->num_rows() > 0) { |
|||
64 | 1 | $this->next_record(); |
|||
65 | 1 | return $this->f(0); |
|||
66 | } else { |
||||
67 | 1 | return 0; |
|||
68 | } |
||||
69 | } |
||||
70 | |||||
71 | /** |
||||
72 | * Db::queryRow() |
||||
73 | * |
||||
74 | * @param mixed $query |
||||
75 | * @param string $line |
||||
76 | * @param string $file |
||||
77 | * @return array|bool |
||||
78 | */ |
||||
79 | 1 | public function queryRow($query, $line = '', $file = '') |
|||
80 | { |
||||
81 | 1 | $this->query($query, $line, $file); |
|||
0 ignored issues
–
show
$line of type string is incompatible with the type integer expected by parameter $line of MyDb\Mysqli\Db::query() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
82 | 1 | if ($this->num_rows() > 0) { |
|||
83 | 1 | $this->next_record(); |
|||
84 | 1 | return $this->Record; |
|||
85 | } else { |
||||
86 | 1 | return 0; |
|||
87 | } |
||||
88 | } |
||||
89 | |||||
90 | /** |
||||
91 | * Db::lastInsertId() |
||||
92 | * @param mixed $table |
||||
93 | * @param mixed $field |
||||
94 | * @return int |
||||
95 | */ |
||||
96 | 1 | public function lastInsertId($table, $field) |
|||
97 | { |
||||
98 | 1 | return $this->getLastInsertId($table, $field); |
|||
99 | } |
||||
100 | } |
||||
101 |
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.