Struct hdbconnect::Connection
[−]
[src]
pub struct Connection { /* fields omitted */ }
Connection object.
The connection to the database. You get started with something like this:
use hdbconnect::Connection; let mut connection = Connection::new("mymachine", "30415")?; connection.authenticate_user_password("Annidda", "BF1äÖkn&nG")?;
The most important attributes of a connection, including the TcpStream, are "outsourced" into a ConnectionCore object, which is kept alive through ref-counted references, from this connection object and / or from other objects that are created by this connection object and have their independent lifetime.
Methods
impl Connection
[src]
fn new(host: &str, port: &str) -> HdbResult<Connection>
Creates a new connection object that is already connected to the specified host/port
fn authenticate_user_password(
&mut self,
username: &str,
password: &str
) -> HdbResult<()>
&mut self,
username: &str,
password: &str
) -> HdbResult<()>
Authenticates with username and password
fn get_major_and_minor_product_version(&self) -> (i8, i16)
Returns the HANA's product version info.
fn set_auto_commit(&mut self, ac: bool)
Sets the connection's auto-commit behavior for future calls.
fn set_fetch_size(&mut self, fetch_size: u32)
Configures the connection's fetch size for future calls.
fn set_lob_read_length(&mut self, lob_read_length: i32)
Configures the connection's lob read length for future calls.
fn get_call_count(&self) -> i32
Returns the number of roundtrips to the database that have been done through this connection.
fn any_statement(&mut self, stmt: &str) -> HdbResult<HdbResponse>
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_statement(), dml_statement(), exec_statement(), which have the adequate simple result type you usually want.
fn query_statement(&mut self, stmt: &str) -> HdbResult<ResultSet>
Executes a statement and expects a single ResultSet.
fn dml_statement(&mut self, stmt: &str) -> HdbResult<usize>
Executes a statement and expects a single number of affected rows.
fn exec_statement(&mut self, stmt: &str) -> HdbResult<()>
Executes a statement and expects a plain success.
fn prepare(&self, stmt: &str) -> HdbResult<PreparedStatement>
Prepares a statement and returns a handle to it. Note that the handle keeps using the same connection.
fn commit(&mut self) -> HdbResult<()>
Commits the current transaction.
fn rollback(&mut self) -> HdbResult<()>
Rolls back the current transaction.
fn spawn(&self) -> HdbResult<Connection>
Creates a new connection object with the same settings and authentication.
fn multiple_statements_ignore_err(&mut self, stmts: Vec<&str>)
Utility method to fire a couple of statements, ignoring errors and return values
fn multiple_statements(&mut self, prep: Vec<&str>) -> HdbResult<()>
Utility method to fire a couple of statements, ignoring their return values; the method returns with the first error, or with ()