Total Complexity | 8 |
Total Lines | 71 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
21 | class Db extends MysqliDb implements Db_Interface { |
||
22 | public $host = 'localhost'; |
||
23 | public $user = 'pdns'; |
||
24 | public $password = ''; |
||
25 | public $database = 'pdns'; |
||
26 | public $type = 'mdb2'; |
||
27 | public $error = false; |
||
28 | public $message = ''; |
||
29 | |||
30 | /** |
||
31 | * Db::quote() |
||
32 | * @param string $text |
||
33 | * @param string $type |
||
34 | * @return string |
||
35 | */ |
||
36 | public function quote($text = '', $type = 'text') { |
||
37 | switch ($type) { |
||
38 | case 'text': |
||
39 | return "'".mysqli_real_escape_string($this->linkId, $text)."'"; |
||
|
|||
40 | break; |
||
41 | case 'integer': |
||
42 | return (int) $text; |
||
43 | break; |
||
44 | default: |
||
45 | return $text; |
||
46 | break; |
||
47 | } |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Db::queryOne() |
||
52 | * |
||
53 | * @param mixed $query |
||
54 | * @param string $line |
||
55 | * @param string $file |
||
56 | * @return bool |
||
57 | */ |
||
58 | public function queryOne($query, $line = '', $file = '') { |
||
59 | $this->query($query, $line, $file); |
||
60 | if ($this->num_rows() > 0) { |
||
61 | $this->next_record(); |
||
62 | return $this->f(0); |
||
63 | } else |
||
64 | return 0; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Db::queryRow() |
||
69 | * |
||
70 | * @param mixed $query |
||
71 | * @param string $line |
||
72 | * @param string $file |
||
73 | * @return array|bool |
||
74 | */ |
||
75 | public function queryRow($query, $line = '', $file = '') { |
||
76 | $this->query($query, $line, $file); |
||
77 | if ($this->num_rows() > 0) { |
||
78 | $this->next_record(); |
||
79 | return $this->Record; |
||
80 | } else |
||
81 | return 0; |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Db::lastInsertId() |
||
86 | * @param mixed $table |
||
87 | * @param mixed $field |
||
88 | * @return int |
||
89 | */ |
||
90 | public function lastInsertId($table, $field) { |
||
92 | } |
||
93 | } |
||
94 |