Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions rust/cubesql/cubesql/src/sql/postgres/extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ use async_stream::stream;

#[derive(Debug)]
pub struct Cursor {
pub query: ast::Statement,
pub query: Box<ast::Statement>,
// WITH HOLD specifies that the cursor can continue to be used after the transaction that created it successfully commits.
// WITHOUT HOLD specifies that the cursor cannot be used outside of the transaction that created it.
// WITHOUT HOLD specifies that the cursor cannot be used outside the transaction that created it.
pub hold: bool,
// What format will be used for Cursor
pub format: protocol::Format,
}

#[derive(Debug)]
pub enum PreparedStatement {
// Postgres allows to define prepared statement on empty query: "",
// Postgres allows defining a prepared statement on an empty query: "",
// then it requires special handling in the protocol
Empty {
/// Prepared statement can be declared from SQL or protocol (Parser)
Expand All @@ -49,10 +49,10 @@ pub enum PreparedStatement {
/// Prepared statement can be declared from SQL or protocol (Parser)
from_sql: bool,
created: DateTime<Utc>,
query: ast::Statement,
query: Box<ast::Statement>,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parameters: protocol::ParameterDescription,
/// Fields which will be returned to the client, It can be None if server doesnt return any field
/// for example BEGIN
/// Fields which will be returned to the client; It can be None if the server doesn't return any field,
/// for example, BEGIN
description: Option<protocol::RowDescription>,
span_id: Option<Arc<SpanId>>,
},
Expand Down Expand Up @@ -107,7 +107,7 @@ impl PreparedStatement {
.into()),
PreparedStatement::Query { query, .. } => {
let binder = PostgresStatementParamsBinder::new(values);
let mut statement = query.clone();
let mut statement = query.as_ref().clone();
binder.bind(&mut statement)?;

Ok(statement)
Expand Down
6 changes: 3 additions & 3 deletions rust/cubesql/cubesql/src/sql/postgres/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ impl AsyncPostgresShim {
PreparedStatement::Query {
from_sql,
created: chrono::offset::Utc::now(),
query,
query: Box::new(query),
parameters: protocol::ParameterDescription::new(parameters),
description,
span_id,
Expand Down Expand Up @@ -1479,7 +1479,7 @@ impl AsyncPostgresShim {
})?;

let plan = convert_statement_to_cube_query(
cursor.query.clone(),
cursor.query.as_ref().clone(),
meta,
self.session.clone(),
qtrace,
Expand Down Expand Up @@ -1556,7 +1556,7 @@ impl AsyncPostgresShim {
.await?;

let cursor = Cursor {
query: select_stmt,
query: Box::new(select_stmt),
hold: hold.unwrap_or(false),
format: if binary { Format::Binary } else { Format::Text },
};
Expand Down
Loading