Struct odbc::DataSource
[−]
[src]
pub struct DataSource<'a, S: DataSourceState> { /* fields omitted */ }
Represents a connection to an ODBC data source
A DataSource
is in one of two states Connected
or Disconnected
. These are known at
compile time. Every new DataSource
starts out as Disconnected
. To do execute a query it
needs to be connected. You can achieve this by calling e.g. connect
and captuer the result in
a new binding which will be of type DataSource::<Connected>
.
Methods
impl<'a> DataSource<'a, Disconnected>
[src]
fn with_parent(
env: &'a Environment<Version3>
) -> Result<DataSource<'a, Disconnected>>
env: &'a Environment<Version3>
) -> Result<DataSource<'a, Disconnected>>
fn connect(
self,
dsn: &str,
usr: &str,
pwd: &str
) -> Result<DataSource<'a, Connected>>
self,
dsn: &str,
usr: &str,
pwd: &str
) -> Result<DataSource<'a, Connected>>
Connects to an ODBC data source
Arguments
dsn
- Data source name configured in theodbc.ini
fileusr
- User identifierpwd
- Authentication (usually password)
fn connect_with_connection_string(
self,
connection_str: &str
) -> Result<DataSource<'a, Connected>>
self,
connection_str: &str
) -> Result<DataSource<'a, Connected>>
impl<'a> DataSource<'a, Connected>
[src]
fn read_only(&self) -> Result<bool>
true
if the data source is set to READ ONLY mode, false
otherwise.
This characteristic pertains only to the data source itself; it is not characteristic of the driver that enables access to the data source. A driver that is read/write can be used with a data source that is read-only. If a driver is read-only, all of its data sources must be read-only.
fn disconnect(self) -> Result<DataSource<'a, Disconnected>>
Closes the connection to the DataSource. If not called explicitly this the disconnect will
be invoked by drop()