From ddee7f397cb22b055684904ce079b6992edc2117 Mon Sep 17 00:00:00 2001 From: dblock Date: Mon, 12 Aug 2024 09:54:47 -0400 Subject: [PATCH] Add proxies for the remainder of the changed methods. Signed-off-by: dblock --- util/EndpointProxies/sql/closeCursorProxy.php | 4 +-- util/EndpointProxies/sql/explainProxy.php | 28 ++++++++++++++++ util/EndpointProxies/sql/queryProxy.php | 32 +++++++++++++++++++ 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 util/EndpointProxies/sql/explainProxy.php create mode 100644 util/EndpointProxies/sql/queryProxy.php diff --git a/util/EndpointProxies/sql/closeCursorProxy.php b/util/EndpointProxies/sql/closeCursorProxy.php index fa770c5c..7d3fcf67 100644 --- a/util/EndpointProxies/sql/closeCursorProxy.php +++ b/util/EndpointProxies/sql/closeCursorProxy.php @@ -2,10 +2,8 @@ return <<<'EOD' /** - * Proxy function to closeCursor() to prevent BC break. * This API will be removed in a future version. Use 'close' API instead. - * Note that the SQL close API takes the cursor in the body. - * + * * $params['cursor'] = (string) The cursor given by the server * * @param array{'cursor': string} $params Associative array of parameters diff --git a/util/EndpointProxies/sql/explainProxy.php b/util/EndpointProxies/sql/explainProxy.php new file mode 100644 index 00000000..91f1d6f5 --- /dev/null +++ b/util/EndpointProxies/sql/explainProxy.php @@ -0,0 +1,28 @@ +endpoints; + + $body = $this->extractArgument($params, 'body'); + $query = $this->extractArgument($params, 'query'); + + /** @var AbstractEndpoint $endpoint */ + $endpoint = $endpointBuilder('Sql\Explain'); + $endpoint->setBody(array_merge($body, [ + 'query' => $query, + ])); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } +EOD; diff --git a/util/EndpointProxies/sql/queryProxy.php b/util/EndpointProxies/sql/queryProxy.php new file mode 100644 index 00000000..5a3d2d64 --- /dev/null +++ b/util/EndpointProxies/sql/queryProxy.php @@ -0,0 +1,32 @@ +endpoints; + + /** @var AbstractEndpoint $endpoint */ + $endpoint = $endpointBuilder('Sql\Query'); + $body = $this->extractArgument($params, 'body'); + $endpoint->setBody(array_merge($body, array_filter([ + 'query' => $this->extractArgument($params, 'query'), + 'cursor' => $this->extractArgument($params, 'cursor'), + 'fetch_size' => $this->extractArgument($params, 'fetch_size'), + ]))); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } +EOD;