WpdbReads final class
Minn\Runtime\WpdbReads · public/minn/src/Minn/Runtime/WpdbReads.php · 221 lines
What the database object plugins hold as $wpdb does when it runs and reads (probe db-mail-rewrite-doubts): a query is heard by the query filter while the last one's state is still there, and is not run at all while the object is not ready; the readers ask check_safe_collation before running one, give null for an empty value, and give nothing when asked to read without a query (get_row, get_results) or in an output they do not know; prepare's notices; and print_error, which keeps every error in $EZSQL_ERROR and logs it with its caller. Members the object keeps protected are reached in its own scope.
Constants and properties
| private | LOG_LINE = 'WordPress database error %1$s for query %2$s' |
Public
| static | query(object $db, mixed $query): int|bool# | Runs a query through the object, as wpdb::query: the number of rows read or written, true, or false. | |||
| static | value(object $db, mixed $query, mixed $x, mixed $y): mixed# | One value of the last result (or of a query run first): null for an empty one. | |||
| static | row(object $db, mixed $query, mixed $output, mixed $y): mixed# | One row of a query, as an object or an array; null with no query, or in an output it does not know. | |||
| static | column(object $db, mixed $query, mixed $x): array# | One column of the last result (or of a query run first), each value read through the object's own get_var. @return list<mixed> | |||
| static | rows(object $db, mixed $query, mixed $output): ?array# | The rows of a query in an output shape; null with no query, or in an output it does not know. | |||
| static | prepare(object $db, mixed $query, array $args): ?string# | A query with its placeholders filled (Placeholders), every literal % as the placeholder escape query() takes back out (wpdb::prepare). One argument that is a list stands for the arguments. Reported through doing_it_wrong: an argument it cannot use, a query with no % at all, a count that does not match (too few arguments empty the query), and a list of other than one value for a query with one placeholder (null).
| |||
| static | printError(object $db, mixed $str): string# | Reports a database error: kept in $EZSQL_ERROR, then (unless errors are suppressed) logged with the calls that led to it. The markup to print while errors are shown, else ''. |
Internals 4
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | ask(object $db, mixed $query): void# | Runs a reader's query, skipping the text check when check_safe_collation finds it safe. |
| private | run(object $db, string $query): array# | Sends a query, unless it holds text its table cannot store. @return array{0: mixed, 1: string, 2: bool} the result, the error, whether it reached the server |
| private | keep(object $db, mysqli_result $result): int# | A read's rows kept on the object: the count of them. |
| private | isObjectOutput(mixed $output): bool# | OBJECT in any case; the other outputs are matched exactly. |
Nothing matches.