MCPcopy Create free account
hub / github.com/EqualifyEverything/equalify / query

Method query

models/db.php:49–72  ·  view source on GitHub ↗

* Query helper. * * @param string $sql The query SQL. * @param array $params The query parameters to bind. * @param boolean $return If we're expecting a result. * @return mysqli_result|boolean */

($sql, $params, $return)

Source from the content-addressed store, hash-verified

47 * @return mysqli_result|boolean
48 */
49 private static function query($sql, $params, $return)
50 {
51 $connection = self::connect();
52 if (empty($params)) {
53 $results = $connection->query($sql);
54 } else {
55 $statement = $connection->prepare($sql);
56 if ($statement === false) {
57 throw new Exception(
58 'Unable to prepare SQL: '
59 .$connection->error
60 );
61 }
62 $statement->bind_param(str_repeat(
63 's', count($params)
64 ), ...$params);
65 $results = $statement->execute();
66 if ($return) {
67 $results = $statement->get_result();
68 }
69 }
70
71 return $results;
72 }
73
74 /**
75 * Filters helper.

Callers 15

get_db_rowsMethod · 0.95
add_db_columnMethod · 0.95
get_joined_dbMethod · 0.95
delete_db_columnMethod · 0.95
db_column_existsMethod · 0.95
update_db_rowsMethod · 0.95
add_db_entryMethod · 0.95
add_db_rowsMethod · 0.95
update_db_entryMethod · 0.95
delete_db_entriesMethod · 0.95
count_db_rowsMethod · 0.95
get_meta_valueMethod · 0.95

Calls 1

connectMethod · 0.95

Tested by

no test coverage detected