[][src]Struct hdbconnect::Connection

pub struct Connection { /* fields omitted */ }

Connection object.

The connection to the database.

Example

This example is not tested
use hdbconnect::{Connection, IntoConnectParams};
let params = "hdbsql://my_user:my_passwd@the_host:2222"
    .into_connect_params()
    .unwrap();
let mut connection = Connection::new(params).unwrap();

Methods

impl Connection
[src]

pub fn new(params: ConnectParams) -> HdbResult<Connection>
[src]

Factory method for authenticated connections.

pub fn set_auto_commit(&mut self, ac: bool) -> HdbResult<()>
[src]

Sets the connection's auto-commit behavior for future calls.

pub fn is_auto_commit(&self) -> HdbResult<bool>
[src]

Returns the connection's auto-commit behavior.

pub fn set_fetch_size(&mut self, fetch_size: u32) -> HdbResult<()>
[src]

Configures the connection's fetch size for future calls.

pub fn get_lob_read_length(&self) -> HdbResult<i32>
[src]

Configures the connection's lob read length for future calls.

pub fn set_lob_read_length(&mut self, l: i32) -> HdbResult<()>
[src]

Configures the connection's lob read length for future calls.

pub fn get_id(&self) -> HdbResult<u32>
[src]

Returns the ID of the connection.

The ID is set by the server. Can be handy for logging.

pub fn get_server_resource_consumption_info(
    &self
) -> HdbResult<ServerResourceConsumptionInfo>
[src]

pub fn get_call_count(&self) -> HdbResult<i32>
[src]

Returns the number of roundtrips to the database that have been done through this connection.

pub fn set_application_user<S: AsRef<str>>(&self, appl_user: S) -> HdbResult<()>
[src]

Sets client information into a session variable on the server.

Example:

This example is not tested
connection.set_application_user("K2209657")?;

pub fn set_application_version<S: AsRef<str>>(
    &mut self,
    version: S
) -> HdbResult<()>
[src]

Sets client information into a session variable on the server.

Example:

This example is not tested
connection.set_application_version("5.3.23")?;

pub fn set_application_source<S: AsRef<str>>(
    &mut self,
    source: S
) -> HdbResult<()>
[src]

Sets client information into a session variable on the server.

Example:

This example is not tested
connection.set_application_source("5.3.23","update_customer.rs")?;

pub fn statement<S: AsRef<str>>(&mut self, stmt: S) -> HdbResult<HdbResponse>
[src]

Executes a statement on the database.

This generic method can handle all kinds of calls, and thus has the most complex return type. In many cases it will be more appropriate to use one of the methods query(), dml(), exec(), which have the adequate simple result type you usually want.

pub fn query<S: AsRef<str>>(&mut self, stmt: S) -> HdbResult<ResultSet>
[src]

Executes a statement and expects a single ResultSet.

pub fn dml<S: AsRef<str>>(&mut self, stmt: S) -> HdbResult<usize>
[src]

Executes a statement and expects a single number of affected rows.

pub fn exec<S: AsRef<str>>(&mut self, stmt: S) -> HdbResult<()>
[src]

Executes a statement and expects a plain success.

pub fn prepare<S: AsRef<str>>(&self, stmt: S) -> HdbResult<PreparedStatement>
[src]

Prepares a statement and returns a handle to it.

Note that the handle keeps using the same connection.

pub fn commit(&mut self) -> HdbResult<()>
[src]

Commits the current transaction.

pub fn rollback(&mut self) -> HdbResult<()>
[src]

Rolls back the current transaction.

pub fn spawn(&self) -> HdbResult<Connection>
[src]

Creates a new connection object with the same settings and authentication.

pub fn multiple_statements_ignore_err<S: AsRef<str>>(&mut self, stmts: Vec<S>)
[src]

Utility method to fire a couple of statements, ignoring errors and return values

pub fn multiple_statements<S: AsRef<str>>(
    &mut self,
    stmts: Vec<S>
) -> HdbResult<()>
[src]

Utility method to fire a couple of statements, ignoring their return values; the method returns with the first error, or with ()

pub fn pop_warnings(&self) -> HdbResult<Option<Vec<ServerError>>>
[src]

Returns warnings that were returned from the server since the last call to this method.

pub fn get_resource_manager(&self) -> Box<dyn ResourceManager>
[src]

Returns an implementation of dist_tx::rm::ResourceManager that is based on this connection.

pub fn execute_with_debuginfo<S: AsRef<str>>(
    &mut self,
    stmt: S,
    module: S,
    line: i32
) -> HdbResult<HdbResponse>
[src]

Tools like debuggers can provide additional information while stepping through a source

Trait Implementations

impl Debug for Connection
[src]

Auto Trait Implementations

impl Send for Connection

impl Sync for Connection

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self