get_DBO(); } /** * @param mixed ...$args */ public function prepare(string $query, ...$args): string { if (count($args) === 1 && is_array($args[0])) { $args = $args[0]; } return $this->wpdb()->prepare($this->prefix($query), $args); } /** * @return int|false */ public function query(string $query) { return $this->wpdb()->query($this->prefix($query)); } /** * @param string $output * @return mixed[] */ public function getResults(string $query, string $output = OBJECT): array { return (array) $this->wpdb()->get_results($this->prefix($query), $output); } /** * @param string $output * @return mixed */ public function getRow(string $query, string $output = OBJECT) { return $this->wpdb()->get_row($this->prefix($query), $output); } /** * @return mixed */ public function getVar(string $query) { return $this->wpdb()->get_var($this->prefix($query)); } /** * @return mixed[] */ public function getCol(string $query): array { return (array) $this->wpdb()->get_col($this->prefix($query)); } /** * @param mixed[] $data * @param string[]|null $format * @return int|false */ public function insert(string $table, array $data, ?array $format = null) { return $this->wpdb()->insert($this->table($table), $data, $format); } /** * @param mixed[] $data * @param mixed[] $where * @param string[]|null $format * @param string[]|null $where_format * @return int|false */ public function update(string $table, array $data, array $where, ?array $format = null, ?array $where_format = null) { return $this->wpdb()->update($this->table($table), $data, $where, $format, $where_format); } /** * @param mixed[] $where * @param string[]|null $where_format * @return int|false */ public function delete(string $table, array $where, ?array $where_format = null) { return $this->wpdb()->delete($this->table($table), $where, $where_format); } public function insertId(): int { return (int) $this->wpdb()->insert_id; } public function table(string $table, bool $base = false): string { $table = trim($table, '` '); if (strpos($table, '#__') === 0) { return $this->prefix($table); } return ($base ? $this->wpdb()->base_prefix : $this->wpdb()->prefix) . $table; } public function charsetCollate(): string { return $this->wpdb()->get_charset_collate(); } public function escLike(string $text): string { return $this->wpdb()->esc_like($text); } /** * @param string[] $values */ public function quoteList(array $values): string { return implode(',', array_map(function (string $value): string { return "'" . esc_sql($value) . "'"; }, $values)); } }