@@ 380-391 (lines=12) @@ | ||
377 | * |
|
378 | * @return object |
|
379 | */ |
|
380 | public function query($query, $con = NULL) |
|
381 | { |
|
382 | $connection = self::checkConnection($con); |
|
383 | ||
384 | $query = $connection->prepare($query); |
|
385 | $query->execute(); |
|
386 | if ($query->rowCount()) |
|
387 | { |
|
388 | return new GetData($query->fetchAll($connection::FETCH_ASSOC)); |
|
389 | } |
|
390 | throw new DataNotFoundException(); |
|
391 | } |
|
392 | } |
@@ 30-41 (lines=12) @@ | ||
27 | * |
|
28 | * @return object |
|
29 | */ |
|
30 | public function getAll($dbConnection = NULL) |
|
31 | { |
|
32 | $connection = DatabaseQuery::checkConnection($dbConnection); |
|
33 | ||
34 | $sqlQuery = self::whereClause(); |
|
35 | $query = $connection->prepare($sqlQuery); |
|
36 | $query->execute(); |
|
37 | if ($query->rowCount()) { |
|
38 | return new GetData($query->fetchAll($connection::FETCH_ASSOC)); |
|
39 | } |
|
40 | throw new EmptyDatabaseException(); |
|
41 | } |
|
42 | ||
43 | /** |
|
44 | * where($data, $condition) |