@@ -23,6 +23,10 @@ discard block |
||
23 | 23 | const INDEX_PRIMARY = ''; |
24 | 24 | |
25 | 25 | |
26 | + /** |
|
27 | + * @param string $host |
|
28 | + * @param string $database |
|
29 | + */ |
|
26 | 30 | public function __construct($host, $database, Array $options = NULL) |
27 | 31 | { |
28 | 32 | if (!extension_loaded('handlersocketi') && (!class_exists('\\HSPHP\\ReadSocket'))) |
@@ -64,6 +68,9 @@ discard block |
||
64 | 68 | } |
65 | 69 | |
66 | 70 | |
71 | + /** |
|
72 | + * @param string $table |
|
73 | + */ |
|
67 | 74 | public function fetchArray($table, Array $fields, Array $index_condition, $operator = HSAL::OPERATOR_EQUAL) |
68 | 75 | { |
69 | 76 | list($index, $condition) = self::parse_index_condition($index_condition); |
@@ -71,6 +78,9 @@ discard block |
||
71 | 78 | return $this->hs->fetchArray($table, $fields, $index, $condition, $operator); |
72 | 79 | } |
73 | 80 | |
81 | + /** |
|
82 | + * @param string $table |
|
83 | + */ |
|
74 | 84 | public function fetchAssoc($table, Array $fields, Array $index_condition, $operator = HSAL::OPERATOR_EQUAL) |
75 | 85 | { |
76 | 86 | list($index, $condition) = self::parse_index_condition($index_condition); |
@@ -78,6 +88,10 @@ discard block |
||
78 | 88 | return $this->hs->fetchAssoc($table, $fields, $index, $condition, $operator); |
79 | 89 | } |
80 | 90 | |
91 | + /** |
|
92 | + * @param string $table |
|
93 | + * @param string $field |
|
94 | + */ |
|
81 | 95 | public function fetchColumn($table, $field, Array $index_condition, $operator = HSAL::OPERATOR_EQUAL) |
82 | 96 | { |
83 | 97 | list($index, $condition) = self::parse_index_condition($index_condition); |
@@ -85,6 +99,9 @@ discard block |
||
85 | 99 | return $this->hs->fetchColumn($table, $field, $index, $condition, $operator); |
86 | 100 | } |
87 | 101 | |
102 | + /** |
|
103 | + * @param string $table |
|
104 | + */ |
|
88 | 105 | public function fetchAll($table, Array $fields, Array $index_condition, $operator = HSAL::OPERATOR_EQUAL, $limit = 1000, $offset = 0) |
89 | 106 | { |
90 | 107 | list($index, $condition) = self::parse_index_condition($index_condition); |
@@ -92,6 +109,9 @@ discard block |
||
92 | 109 | return $this->hs->fetchAll($table, $fields, $index, $condition, $operator, $limit, $offset); |
93 | 110 | } |
94 | 111 | |
112 | + /** |
|
113 | + * @param string $table |
|
114 | + */ |
|
95 | 115 | public function delete($table, Array $index_condition, $operator = HSAL::OPERATOR_EQUAL) |
96 | 116 | { |
97 | 117 | list($index, $condition) = self::parse_index_condition($index_condition); |
@@ -99,11 +119,17 @@ discard block |
||
99 | 119 | return $this->hs->delete($table, $index, $condition, $operator); |
100 | 120 | } |
101 | 121 | |
122 | + /** |
|
123 | + * @param string $table |
|
124 | + */ |
|
102 | 125 | public function insert($table, Array $values) |
103 | 126 | { |
104 | 127 | return $this->hs->insert($table, $values); |
105 | 128 | } |
106 | 129 | |
130 | + /** |
|
131 | + * @param string $table |
|
132 | + */ |
|
107 | 133 | public function update($table, Array $values, Array $index_condition, $operator = HSAL::OPERATOR_EQUAL) |
108 | 134 | { |
109 | 135 | list($index, $condition) = self::parse_index_condition($index_condition); |
@@ -111,6 +137,10 @@ discard block |
||
111 | 137 | return $this->hs->update($table, $values, $index, $condition, $operator); |
112 | 138 | } |
113 | 139 | |
140 | + /** |
|
141 | + * @param string $table |
|
142 | + * @param string $field |
|
143 | + */ |
|
114 | 144 | public function increment($table, $field, Array $index_condition, $operator = HSAL::OPERATOR_EQUAL, $increment = 1) |
115 | 145 | { |
116 | 146 | list($index, $condition) = self::parse_index_condition($index_condition); |
@@ -118,6 +148,10 @@ discard block |
||
118 | 148 | return $this->hs->increment($table, $field, $index, $condition, $operator, $increment); |
119 | 149 | } |
120 | 150 | |
151 | + /** |
|
152 | + * @param string $table |
|
153 | + * @param string $field |
|
154 | + */ |
|
121 | 155 | public function decrement($table, $field, Array $index_condition, $operator = HSAL::OPERATOR_EQUAL, $decrement = 1) |
122 | 156 | { |
123 | 157 | list($index, $condition) = self::parse_index_condition($index_condition); |
@@ -34,8 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | if (!empty($options)) |
36 | 36 | { |
37 | - if (isset($options['driver'])) |
|
38 | - $driver = $options['driver']; |
|
37 | + if (isset($options['driver'])) { |
|
38 | + $driver = $options['driver']; |
|
39 | + } |
|
39 | 40 | } |
40 | 41 | |
41 | 42 | if ($driver == self::DRIVER_AUTO) |
@@ -43,8 +44,7 @@ discard block |
||
43 | 44 | if (extension_loaded('handlersocketi')) |
44 | 45 | { |
45 | 46 | $driver = self::DRIVER_HANDLERSOCKETI; |
46 | - } |
|
47 | - else if (class_exists('\\HSPHP\\ReadSocket')) |
|
47 | + } else if (class_exists('\\HSPHP\\ReadSocket')) |
|
48 | 48 | { |
49 | 49 | $driver = self::DRIVER_HSPHP; |
50 | 50 | } |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | if ($driver == self::DRIVER_HANDLERSOCKETI) |
54 | 54 | { |
55 | 55 | $this->hs = new \HSAL\Driver\Handlersocketi($host, $database, $options); |
56 | - } |
|
57 | - else if ($driver == self::DRIVER_HSPHP) |
|
56 | + } else if ($driver == self::DRIVER_HSPHP) |
|
58 | 57 | { |
59 | 58 | $this->hs = new \HSAL\Driver\HSPHP($host, $database, $options); |
60 | 59 | } |