@@ 175-192 (lines=18) @@ | ||
172 | * |
|
173 | * @return string |
|
174 | */ |
|
175 | protected static function buildClause($tableName, $data) |
|
176 | { |
|
177 | $counter = 0; |
|
178 | $updateQuery = ""; |
|
179 | $arraySize = sizeof($data); |
|
180 | ||
181 | foreach ( $data as $key => $value ) |
|
182 | { |
|
183 | $counter++; |
|
184 | $columnName = self::checkColumn($tableName, self::sanitize($key)); |
|
185 | $updateQuery .= $columnName ." = '".self::sanitize($value)."'"; |
|
186 | if ( $arraySize > $counter ) |
|
187 | { |
|
188 | $updateQuery .= ", "; |
|
189 | } |
|
190 | } |
|
191 | return $updateQuery; |
|
192 | } |
|
193 | ||
194 | /** |
|
195 | * selectAllQuery |
|
@@ 209-227 (lines=19) @@ | ||
206 | * |
|
207 | * @return string |
|
208 | */ |
|
209 | public static function whereAndClause($tableName, $data, $condition) |
|
210 | { |
|
211 | $where = ""; |
|
212 | $counter = 0; |
|
213 | $arraySize = sizeof($data); |
|
214 | ||
215 | foreach ( $data as $key => $value ) |
|
216 | { |
|
217 | $counter++; |
|
218 | $columnName = self::checkColumn($tableName, self::sanitize($key)); |
|
219 | $where .= $columnName ." = '".self::sanitize($value)."'"; |
|
220 | if ( $arraySize > $counter ) |
|
221 | { |
|
222 | $where .= " " . $condition . " "; |
|
223 | } |
|
224 | } |
|
225 | ||
226 | return $where; |
|
227 | } |
|
228 | ||
229 | /** |
|
230 | * selectQuery |