pub trait Session: Send + Sync {
type ValuesStream: ValuesStream;
type PreparedStatement: Send + Clone + 'static;
type Portal: Send + Clone + Display + 'static;
Show 13 methods
// Required methods
fn run_one_query(
self: Arc<Self>,
stmt: Statement,
format: Format,
) -> impl Future<Output = Result<PgResponse<Self::ValuesStream>, BoxedError>> + Send;
fn parse(
self: Arc<Self>,
sql: Option<Statement>,
params_types: Vec<Option<DataType>>,
) -> impl Future<Output = Result<Self::PreparedStatement, BoxedError>> + Send;
fn take_notices(self: Arc<Self>) -> Vec<String>;
fn bind(
self: Arc<Self>,
prepare_statement: Self::PreparedStatement,
params: Vec<Option<Bytes>>,
param_formats: Vec<Format>,
result_formats: Vec<Format>,
) -> Result<Self::Portal, BoxedError>;
fn execute(
self: Arc<Self>,
portal: Self::Portal,
) -> impl Future<Output = Result<PgResponse<Self::ValuesStream>, BoxedError>> + Send;
fn describe_statement(
self: Arc<Self>,
prepare_statement: Self::PreparedStatement,
) -> Result<(Vec<DataType>, Vec<PgFieldDescriptor>), BoxedError>;
fn describe_portal(
self: Arc<Self>,
portal: Self::Portal,
) -> Result<Vec<PgFieldDescriptor>, BoxedError>;
fn user_authenticator(&self) -> &UserAuthenticator;
fn id(&self) -> SessionId;
fn set_config(&self, key: &str, value: String) -> Result<String, BoxedError>;
fn transaction_status(&self) -> TransactionStatus;
fn init_exec_context(&self, sql: Arc<str>) -> ExecContextGuard;
fn check_idle_in_transaction_timeout(&self) -> PsqlResult<()>;
}
Expand description
A psql connection. Each connection binds with a database. Switching database will need to recreate another connection.
Required Associated Types§
type ValuesStream: ValuesStream
type PreparedStatement: Send + Clone + 'static
type Portal: Send + Clone + Display + 'static
Required Methods§
sourcefn run_one_query(
self: Arc<Self>,
stmt: Statement,
format: Format,
) -> impl Future<Output = Result<PgResponse<Self::ValuesStream>, BoxedError>> + Send
fn run_one_query( self: Arc<Self>, stmt: Statement, format: Format, ) -> impl Future<Output = Result<PgResponse<Self::ValuesStream>, BoxedError>> + Send
The str sql can not use the unparse from AST: There is some problem when dealing with create view, see https://github.com/risingwavelabs/risingwave/issues/6801.
fn parse( self: Arc<Self>, sql: Option<Statement>, params_types: Vec<Option<DataType>>, ) -> impl Future<Output = Result<Self::PreparedStatement, BoxedError>> + Send
sourcefn take_notices(self: Arc<Self>) -> Vec<String>
fn take_notices(self: Arc<Self>) -> Vec<String>
try to take the current notices from the session
fn bind( self: Arc<Self>, prepare_statement: Self::PreparedStatement, params: Vec<Option<Bytes>>, param_formats: Vec<Format>, result_formats: Vec<Format>, ) -> Result<Self::Portal, BoxedError>
fn execute( self: Arc<Self>, portal: Self::Portal, ) -> impl Future<Output = Result<PgResponse<Self::ValuesStream>, BoxedError>> + Send
fn describe_statement( self: Arc<Self>, prepare_statement: Self::PreparedStatement, ) -> Result<(Vec<DataType>, Vec<PgFieldDescriptor>), BoxedError>
fn describe_portal( self: Arc<Self>, portal: Self::Portal, ) -> Result<Vec<PgFieldDescriptor>, BoxedError>
fn user_authenticator(&self) -> &UserAuthenticator
fn id(&self) -> SessionId
fn set_config(&self, key: &str, value: String) -> Result<String, BoxedError>
fn transaction_status(&self) -> TransactionStatus
fn init_exec_context(&self, sql: Arc<str>) -> ExecContextGuard
fn check_idle_in_transaction_timeout(&self) -> PsqlResult<()>
Object Safety§
This trait is not object safe.