1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
//! Native rust database driver for SAP HANA(TM).
//!
//! `hdbconnect` uses [`serde_db`](https://docs.rs/serde_db)
//! to simplify the data exchange between application code
//! and the driver, both for input parameters to prepared statements
//! and for results that are returned from the database.
//! There is no need to iterate over a resultset by rows and columns, just
//! assign query results directly to rust structures that fit the data
//! semantics. This approach allows, in contrast to many ORM mapping variants,
//! using the full flexibility of SQL (projection lists, all kinds of joins,
//! unions, etc, etc). Whatever query you need, you just use it, and whatever
//! result structure you need, you just use a corresponding rust structure into
//! which you deserialize the data.
//!
//! See
//! [code examples](code_examples/index.html)
//! for an overview.
//!

// #![feature(bufreader_buffer)]
#![warn(missing_docs)]
#![deny(missing_debug_implementations)]

#[macro_use]
extern crate log;

pub use r2d2;
pub use serde_db;

mod authentication;
mod conn_core;
mod connection;
mod connection_manager;
mod hdb_error;
mod hdb_response;
mod hdb_return_value;
mod impl_serde_db;
mod prepared_statement;
mod protocol;
mod xa_impl;

pub mod code_examples;

pub use crate::conn_core::connect_params::{ConnectParams, IntoConnectParams};
pub use crate::conn_core::connect_params_builder::ConnectParamsBuilder;

#[cfg(feature = "tls")]
pub use crate::conn_core::connect_params::ServerCerts;

pub use crate::connection::Connection;
pub use crate::connection_manager::ConnectionManager;
pub use crate::hdb_error::{HdbError, HdbResult};
pub use crate::hdb_response::HdbResponse;
pub use crate::hdb_return_value::HdbReturnValue;
pub use crate::prepared_statement::PreparedStatement;
pub use crate::protocol::parts::output_parameters::OutputParameters;
pub use crate::protocol::parts::resultset::ResultSet;
pub use crate::protocol::parts::row::Row;
pub use crate::protocol::parts::server_error::{ServerError, Severity};

pub use crate::protocol::parts::execution_result::ExecutionResult;
pub use crate::protocol::parts::parameter_descriptor::{
    ParameterBinding, ParameterDescriptor, ParameterDirection,
};
pub use crate::protocol::parts::resultset_metadata::ResultSetMetadata;
pub use crate::protocol::parts::type_id::TypeId;

mod types_impl;

/// Non-standard types that are used within the
/// [`HdbValue`](enum.HdbValue.html)s in a [`ResultSet`](struct.ResultSet.html).
///
/// A `ResultSet` contains a sequence of Rows, each row is a sequence of
/// `HdbValue`s. Some of the `HdbValue`s are implemented using `LongDate`,
/// BLOB, etc.
pub mod types {
    pub use crate::types_impl::lob::{BLob, CLob, CharLobSlice, NCLob};

    pub use crate::types_impl::daydate::DayDate;
    pub use crate::types_impl::longdate::LongDate;
    pub use crate::types_impl::seconddate::SecondDate;
    pub use crate::types_impl::secondtime::SecondTime;
}
pub use crate::protocol::parts::hdb_value::HdbValue;

/// Default value for the number of resultset lines that are fetched
/// with a single FETCH roundtrip; the constant's value is 100,000.
///
/// The value used at runtime can be changed with
/// [Connection::set_fetch_size()](struct.Connection.html#method.set_fetch_size).
pub const DEFAULT_FETCH_SIZE: u32 = 100_000;

/// Number of bytes (for BLOBS and CLOBS) or 1-2-3-byte sequences (for NCLOBS)
/// that are fetched in a single LOB READ roundtrip; the constant's value is 16,000,000.
///
/// The value used at runtime can be changed with
/// [Connection::set_lob_read_length()](struct.Connection.html#method.set_lob_read_length).
pub const DEFAULT_LOB_READ_LENGTH: u32 = 16_000_000;

/// Number of bytes that are written in a single LOB WRITE roundtrip;
/// the constant's value is 16,000,000.
///
/// The value used at runtime can be changed with
/// [Connection::set_lob_write_length()](struct.Connection.html#method.set_lob_write_length).
pub const DEFAULT_LOB_WRITE_LENGTH: usize = 16_000_000;