diff --git a/README.md b/README.md index d5c5a04..bb5ac3b 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,17 @@ By default, `/usr/lib`, `/usr/local/lib64`, and `/usr/local/lib` are added to th A semicolon separated list of additional directories to add to the linker search path may be specified through the `CASSANDRA_SYS_LIB_PATH` environment variable. +## Autogeneration + +The file `cassandra.rs` is autogenerated as follows: + + +``` +$ bindgen --no-layout-tests --blacklist-type=max_align_t --output=src/cassandra.rs cassandra.h +``` + +The autogenerated code is formatted with `rustfmt`. + ## History diff --git a/build.rs b/build.rs index 0869fe3..0fbb76a 100644 --- a/build.rs +++ b/build.rs @@ -1,19 +1,3 @@ -//#![feature(plugin)] -//#![plugin(bindgen_plugin)] - - - -//#[allow(dead_code, uppercase_variables, non_camel_case_types)] -//#[plugin(bindgen_plugin)] -//mod mysql_bindings { -// bindgen!("/usr/include/mysql/mysql.h", match="mysql.h", link="mysql"); -//} - -//use std::env; -//use std::fs; -//use std::path::Path; -//use std::process::Command; - fn main() { if let Some(datastax_dir) = option_env!("CASSANDRA_SYS_LIB_PATH") { for p in datastax_dir.split(";") { @@ -21,6 +5,7 @@ fn main() { } } + println!("cargo:rustc-flags=-l dylib=cassandra"); println!("cargo:rustc-flags=-l dylib=crypto"); println!("cargo:rustc-flags=-l dylib=ssl"); println!("cargo:rustc-flags=-l dylib=stdc++"); @@ -31,5 +16,4 @@ fn main() { println!("cargo:rustc-link-search={}", "/usr/local/lib"); println!("cargo:rustc-link-search={}", "/usr/lib64/"); println!("cargo:rustc-link-search={}", "/usr/lib/"); -// println!("cargo:rustc-link-lib=static=cassandra_static"); } diff --git a/src/cassandra.rs b/src/cassandra.rs index a496379..89ab6be 100644 --- a/src/cassandra.rs +++ b/src/cassandra.rs @@ -1,19 +1,25 @@ /* automatically generated by rust-bindgen */ -#![allow(dead_code, - non_camel_case_types, - non_upper_case_globals, - non_snake_case)] -pub type ptrdiff_t = isize; -pub type size_t = usize; +pub const CASS_VERSION_MAJOR: ::std::os::raw::c_uint = 2; +pub const CASS_VERSION_MINOR: ::std::os::raw::c_uint = 4; +pub const CASS_VERSION_PATCH: ::std::os::raw::c_uint = 3; +pub const CASS_VERSION_SUFFIX: &'static [u8; 1usize] = b"\0"; +pub const CASS_UINT64_MAX: ::std::os::raw::c_int = -1; +pub const CASS_INET_V4_LENGTH: ::std::os::raw::c_uint = 4; +pub const CASS_INET_V6_LENGTH: ::std::os::raw::c_uint = 16; +pub const CASS_INET_STRING_LENGTH: ::std::os::raw::c_uint = 46; +pub const CASS_UUID_STRING_LENGTH: ::std::os::raw::c_uint = 37; +pub const CASS_LOG_MAX_MESSAGE_SIZE: ::std::os::raw::c_uint = 1024; pub type wchar_t = ::std::os::raw::c_int; -#[derive(Copy, Clone)] #[repr(u32)] -#[derive(Debug)] -pub enum cass_bool_t { cass_false = 0, cass_true = 1, } +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum cass_bool_t { + cass_false = 0, + cass_true = 1, +} pub type cass_float_t = f32; pub type cass_double_t = f64; -pub type cass_int8_t = ::std::os::raw::c_char; +pub type cass_int8_t = ::std::os::raw::c_schar; pub type cass_uint8_t = ::std::os::raw::c_uchar; pub type cass_int16_t = ::std::os::raw::c_short; pub type cass_uint16_t = ::std::os::raw::c_ushort; @@ -23,156 +29,443 @@ pub type cass_int64_t = ::std::os::raw::c_long; pub type cass_uint64_t = ::std::os::raw::c_ulong; pub type cass_byte_t = cass_uint8_t; pub type cass_duration_t = cass_uint64_t; +/// IP address for either IPv4 or IPv6. +/// +/// @struct CassInet #[repr(C)] -#[derive(Copy, Clone)] -#[derive(Debug)] +#[derive(Debug, Copy)] pub struct CassInet_ { + /// Big-endian, binary representation of a IPv4 or IPv6 address pub address: [cass_uint8_t; 16usize], + /// Number of address bytes. 4 bytes for IPv4 and 16 bytes for IPv6. pub address_length: cass_uint8_t, } -impl ::std::default::Default for CassInet_ { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } +impl Clone for CassInet_ { + fn clone(&self) -> Self { + *self + } } pub type CassInet = CassInet_; +/// Version 1 (time-based) or version 4 (random) UUID. +/// +/// @struct CassUuid #[repr(C)] -#[derive(Copy, Clone)] -#[derive(Debug)] +#[derive(Debug, Copy)] pub struct CassUuid_ { + /// Represents the time and version part of a UUID. The most significant + /// 4 bits represent the version and the bottom 60 bits representing the + /// time part. For version 1 the time part represents the number of + /// 100 nanosecond periods since 00:00:00 UTC, January 1, 1970 (the Epoch). + /// For version 4 the time part is randomly generated. pub time_and_version: cass_uint64_t, + /// Represents the clock sequence and the node part of a UUID. The most + /// significant 16 bits represent the clock sequence (except for the most + /// significant bit which is always set) and the bottom 48 bits represent + /// the node part. For version 1 (time-based) the clock sequence part is randomly + /// generated and the node part can be explicitly set, otherwise, it's generated + /// from node unique information. For version 4 both the clock sequence and the node + /// parts are randomly generated. pub clock_seq_and_node: cass_uint64_t, } -impl ::std::default::Default for CassUuid_ { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } +impl Clone for CassUuid_ { + fn clone(&self) -> Self { + *self + } } pub type CassUuid = CassUuid_; -pub enum CassCluster_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassCluster_ { + _unused: [u8; 0], +} +/// A cluster object describes the configuration of the Cassandra cluster and is used +/// to construct a session instance. Unlike other DataStax drivers the cluster object +/// does not maintain the control connection. +/// +/// @struct CassCluster pub type CassCluster = CassCluster_; -pub enum CassSession_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassSession_ { + _unused: [u8; 0], +} +/// A session object is used to execute queries and maintains cluster state through +/// the control connection. The control connection is used to auto-discover nodes and +/// monitor cluster changes (topology and schema). Each session also maintains multiple +/// pools of connections to cluster nodes which are used to query the cluster. +/// +/// Instances of the session object are thread-safe to execute queries. +/// +/// @struct CassSession pub type CassSession = CassSession_; -pub enum CassStatement_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassStatement_ { + _unused: [u8; 0], +} +/// A statement object is an executable query. It represents either a regular +/// (adhoc) statement or a prepared statement. It maintains the queries' parameter +/// values along with query options (consistency level, paging state, etc.) +/// +/// Note: Parameters for regular queries are not supported by the binary protocol +/// version 1. +/// +/// @struct CassStatement pub type CassStatement = CassStatement_; -pub enum CassBatch_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassBatch_ { + _unused: [u8; 0], +} +/// A group of statements that are executed as a single batch. +/// +/// Note: Batches are not supported by the binary protocol version 1. +/// +/// @cassandra{2.0+} +/// +/// @struct CassBatch pub type CassBatch = CassBatch_; -pub enum CassFuture_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassFuture_ { + _unused: [u8; 0], +} +/// The future result of an operation. +/// +/// It can represent a result if the operation completed successfully or an +/// error if the operation failed. It can be waited on, polled or a callback +/// can be attached. +/// +/// @struct CassFuture pub type CassFuture = CassFuture_; -pub enum CassPrepared_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassPrepared_ { + _unused: [u8; 0], +} +/// A statement that has been prepared cluster-side (It has been pre-parsed +/// and cached). +/// +/// A prepared statement is read-only and it is thread-safe to concurrently +/// bind new statements. +/// +/// @struct CassPrepared pub type CassPrepared = CassPrepared_; -pub enum CassResult_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassResult_ { + _unused: [u8; 0], +} +/// The result of a query. +/// +/// A result object is read-only and is thread-safe to read or iterate over +/// concurrently. +/// +/// @struct CassResult pub type CassResult = CassResult_; -pub enum CassErrorResult_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassErrorResult_ { + _unused: [u8; 0], +} +/// A error result of a request +/// +/// @struct CassErrorResult pub type CassErrorResult = CassErrorResult_; -pub enum CassIterator_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassIterator_ { + _unused: [u8; 0], +} +/// An object used to iterate over a group of rows, columns or collection values. +/// +/// @struct CassIterator pub type CassIterator = CassIterator_; -pub enum CassRow_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassRow_ { + _unused: [u8; 0], +} +/// A collection of column values. +/// +/// @struct CassRow pub type CassRow = CassRow_; -pub enum CassValue_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassValue_ { + _unused: [u8; 0], +} +/// A single primitive value or a collection of values. +/// +/// @struct CassValue pub type CassValue = CassValue_; -pub enum CassDataType_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassDataType_ { + _unused: [u8; 0], +} +/// A data type used to describe a value, collection or +/// user defined type. +/// +/// @struct CassDataType pub type CassDataType = CassDataType_; -pub enum CassFunctionMeta_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassFunctionMeta_ { + _unused: [u8; 0], +} +/// @struct CassFunctionMeta +/// +/// @cassandra{2.2+} pub type CassFunctionMeta = CassFunctionMeta_; -pub enum CassAggregateMeta_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassAggregateMeta_ { + _unused: [u8; 0], +} +/// @struct CassAggregateMeta +/// +/// @cassandra{2.2+} pub type CassAggregateMeta = CassAggregateMeta_; -pub enum CassCollection_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassCollection_ { + _unused: [u8; 0], +} +/// A collection of values. +/// +/// @struct CassCollection pub type CassCollection = CassCollection_; -pub enum CassTuple_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassTuple_ { + _unused: [u8; 0], +} +/// A tuple of values. +/// +/// @struct CassTuple +/// +/// @cassandra{2.1+} pub type CassTuple = CassTuple_; -pub enum CassUserType_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassUserType_ { + _unused: [u8; 0], +} +/// A user defined type. +/// +/// @struct CassUserType +/// +/// @cassandra{2.1+} pub type CassUserType = CassUserType_; -pub enum CassSsl_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassSsl_ { + _unused: [u8; 0], +} +/// Describes the SSL configuration of a cluster. +/// +/// @struct CassSsl pub type CassSsl = CassSsl_; +/// Describes the version of the connected Cassandra cluster. +/// +/// @struct CassVersion #[repr(C)] -#[derive(Copy, Clone)] -#[derive(Debug)] +#[derive(Debug, Copy)] pub struct CassVersion_ { pub major_version: ::std::os::raw::c_int, pub minor_version: ::std::os::raw::c_int, pub patch_version: ::std::os::raw::c_int, } -impl ::std::default::Default for CassVersion_ { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } +impl Clone for CassVersion_ { + fn clone(&self) -> Self { + *self + } } pub type CassVersion = CassVersion_; -pub enum CassSchemaMeta_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassSchemaMeta_ { + _unused: [u8; 0], +} +/// A snapshot of the schema's metadata. +/// +/// @struct CassSchemaMeta pub type CassSchemaMeta = CassSchemaMeta_; -pub enum CassKeyspaceMeta_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassKeyspaceMeta_ { + _unused: [u8; 0], +} +/// Keyspace metadata +/// +/// @struct CassKeyspaceMeta pub type CassKeyspaceMeta = CassKeyspaceMeta_; -pub enum CassTableMeta_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassTableMeta_ { + _unused: [u8; 0], +} +/// Table metadata +/// +/// @struct CassTableMeta pub type CassTableMeta = CassTableMeta_; -pub enum CassMaterializedViewMeta_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassMaterializedViewMeta_ { + _unused: [u8; 0], +} +/// MaterializedView metadata +/// +/// @struct CassMaterializedViewMeta +/// +/// @cassandra{3.0+} pub type CassMaterializedViewMeta = CassMaterializedViewMeta_; -pub enum CassColumnMeta_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassColumnMeta_ { + _unused: [u8; 0], +} +/// Column metadata +/// +/// @struct CassColumnMeta pub type CassColumnMeta = CassColumnMeta_; -pub enum CassIndexMeta_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassIndexMeta_ { + _unused: [u8; 0], +} +/// Index metadata +/// +/// @struct CassIndexMeta pub type CassIndexMeta = CassIndexMeta_; -pub enum CassUuidGen_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassUuidGen_ { + _unused: [u8; 0], +} +/// A UUID generator object. +/// +/// Instances of the UUID generator object are thread-safe to generate UUIDs. +/// +/// @struct CassUuidGen pub type CassUuidGen = CassUuidGen_; -pub enum CassTimestampGen_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassTimestampGen_ { + _unused: [u8; 0], +} +/// Policies that defined the behavior of a request when a server-side +/// read/write timeout or unavailable error occurs. +/// +/// Generators of client-side, microsecond-precision timestamps. +/// +/// @struct CassTimestampGen +/// +/// @cassandra{2.1+} pub type CassTimestampGen = CassTimestampGen_; -pub enum CassRetryPolicy_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassRetryPolicy_ { + _unused: [u8; 0], +} +/// @struct CassRetryPolicy pub type CassRetryPolicy = CassRetryPolicy_; -pub enum CassCustomPayload_ { } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassCustomPayload_ { + _unused: [u8; 0], +} +/// @struct CassCustomPayload +/// +/// @cassandra{2.2+} pub type CassCustomPayload = CassCustomPayload_; +/// A snapshot of the session's performance/diagnostic metrics. +/// +/// @struct CassMetrics #[repr(C)] -#[derive(Copy, Clone)] -#[derive(Debug)] +#[derive(Debug, Copy)] pub struct CassMetrics_ { - pub requests: Struct_Unnamed1, - pub stats: Struct_Unnamed2, - pub errors: Struct_Unnamed3, -} -impl ::std::default::Default for CassMetrics_ { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } + pub requests: CassMetrics___bindgen_ty_1, + pub stats: CassMetrics___bindgen_ty_2, + pub errors: CassMetrics___bindgen_ty_3, } #[repr(C)] -#[derive(Copy, Clone)] -#[derive(Debug)] -pub struct Struct_Unnamed1 { +#[derive(Debug, Copy)] +pub struct CassMetrics___bindgen_ty_1 { + /// < Minimum in microseconds pub min: cass_uint64_t, + /// < Maximum in microseconds pub max: cass_uint64_t, + /// < Mean in microseconds pub mean: cass_uint64_t, + /// < Standard deviation in microseconds pub stddev: cass_uint64_t, + /// < Median in microseconds pub median: cass_uint64_t, + /// < 75th percentile in microseconds pub percentile_75th: cass_uint64_t, + /// < 95th percentile in microseconds pub percentile_95th: cass_uint64_t, + /// < 98th percentile in microseconds pub percentile_98th: cass_uint64_t, + /// < 99the percentile in microseconds pub percentile_99th: cass_uint64_t, + /// < 99.9th percentile in microseconds pub percentile_999th: cass_uint64_t, + /// < Mean rate in requests per second pub mean_rate: cass_double_t, + /// < 1 minute rate in requests per second pub one_minute_rate: cass_double_t, + /// < 5 minute rate in requests per second pub five_minute_rate: cass_double_t, + /// < 15 minute rate in requests per second pub fifteen_minute_rate: cass_double_t, } -impl ::std::default::Default for Struct_Unnamed1 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } +impl Clone for CassMetrics___bindgen_ty_1 { + fn clone(&self) -> Self { + *self + } } #[repr(C)] -#[derive(Copy, Clone)] -#[derive(Debug)] -pub struct Struct_Unnamed2 { +#[derive(Debug, Copy)] +pub struct CassMetrics___bindgen_ty_2 { + /// < The total number of connections pub total_connections: cass_uint64_t, + /// < The number of connections available to take requests pub available_connections: cass_uint64_t, + /// < Occurrences when requests exceeded a pool's water mark pub exceeded_pending_requests_water_mark: cass_uint64_t, + /// < Occurrences when number of bytes exceeded a connection's water mark pub exceeded_write_bytes_water_mark: cass_uint64_t, } -impl ::std::default::Default for Struct_Unnamed2 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } +impl Clone for CassMetrics___bindgen_ty_2 { + fn clone(&self) -> Self { + *self + } } #[repr(C)] -#[derive(Copy, Clone)] -#[derive(Debug)] -pub struct Struct_Unnamed3 { +#[derive(Debug, Copy)] +pub struct CassMetrics___bindgen_ty_3 { + /// < Occurrences of a connection timeout pub connection_timeouts: cass_uint64_t, pub pending_request_timeouts: cass_uint64_t, + /// Occurrences of requests that timed out waiting for a connection pub request_timeouts: cass_uint64_t, } -impl ::std::default::Default for Struct_Unnamed3 { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } +impl Clone for CassMetrics___bindgen_ty_3 { + fn clone(&self) -> Self { + *self + } +} +impl Clone for CassMetrics_ { + fn clone(&self) -> Self { + *self + } } pub type CassMetrics = CassMetrics_; -#[derive(Copy, Clone)] #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassConsistency_ { CASS_CONSISTENCY_UNKNOWN = 65535, CASS_CONSISTENCY_ANY = 0, @@ -187,10 +480,9 @@ pub enum CassConsistency_ { CASS_CONSISTENCY_LOCAL_SERIAL = 9, CASS_CONSISTENCY_LOCAL_ONE = 10, } -pub type CassConsistency = CassConsistency_; -#[derive(Copy, Clone)] +pub use self::CassConsistency_ as CassConsistency; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassWriteType_ { CASS_WRITE_TYPE_UKNOWN = 0, CASS_WRITE_TYPE_SIMPLE = 1, @@ -200,10 +492,9 @@ pub enum CassWriteType_ { CASS_WRITE_TYPE_BATCH_LOG = 5, CASS_WRITE_TYPE_CAS = 6, } -pub type CassWriteType = CassWriteType_; -#[derive(Copy, Clone)] +pub use self::CassWriteType_ as CassWriteType; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassColumnType_ { CASS_COLUMN_TYPE_REGULAR = 0, CASS_COLUMN_TYPE_PARTITION_KEY = 1, @@ -211,20 +502,18 @@ pub enum CassColumnType_ { CASS_COLUMN_TYPE_STATIC = 3, CASS_COLUMN_TYPE_COMPACT_VALUE = 4, } -pub type CassColumnType = CassColumnType_; -#[derive(Copy, Clone)] +pub use self::CassColumnType_ as CassColumnType; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassIndexType_ { CASS_INDEX_TYPE_UNKNOWN = 0, CASS_INDEX_TYPE_KEYS = 1, CASS_INDEX_TYPE_CUSTOM = 2, CASS_INDEX_TYPE_COMPOSITES = 3, } -pub type CassIndexType = CassIndexType_; -#[derive(Copy, Clone)] +pub use self::CassIndexType_ as CassIndexType; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassValueType_ { CASS_VALUE_TYPE_UNKNOWN = 65535, CASS_VALUE_TYPE_CUSTOM = 0, @@ -255,37 +544,33 @@ pub enum CassValueType_ { CASS_VALUE_TYPE_TUPLE = 49, CASS_VALUE_TYPE_LAST_ENTRY = 50, } -pub type CassValueType = CassValueType_; -#[derive(Copy, Clone)] +pub use self::CassValueType_ as CassValueType; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassClusteringOrder_ { CASS_CLUSTERING_ORDER_NONE = 0, CASS_CLUSTERING_ORDER_ASC = 1, CASS_CLUSTERING_ORDER_DESC = 2, } -pub type CassClusteringOrder = CassClusteringOrder_; -#[derive(Copy, Clone)] +pub use self::CassClusteringOrder_ as CassClusteringOrder; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassCollectionType_ { CASS_COLLECTION_TYPE_LIST = 32, CASS_COLLECTION_TYPE_MAP = 33, CASS_COLLECTION_TYPE_SET = 34, } -pub type CassCollectionType = CassCollectionType_; -#[derive(Copy, Clone)] +pub use self::CassCollectionType_ as CassCollectionType; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassBatchType_ { CASS_BATCH_TYPE_LOGGED = 0, CASS_BATCH_TYPE_UNLOGGED = 1, CASS_BATCH_TYPE_COUNTER = 2, } -pub type CassBatchType = CassBatchType_; -#[derive(Copy, Clone)] +pub use self::CassBatchType_ as CassBatchType; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassIteratorType_ { CASS_ITERATOR_TYPE_RESULT = 0, CASS_ITERATOR_TYPE_ROW = 1, @@ -303,10 +588,9 @@ pub enum CassIteratorType_ { CASS_ITERATOR_TYPE_INDEX_META = 13, CASS_ITERATOR_TYPE_MATERIALIZED_VIEW_META = 14, } -pub type CassIteratorType = CassIteratorType_; -#[derive(Copy, Clone)] +pub use self::CassIteratorType_ as CassIteratorType; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassLogLevel_ { CASS_LOG_DISABLED = 0, CASS_LOG_CRITICAL = 1, @@ -317,19 +601,17 @@ pub enum CassLogLevel_ { CASS_LOG_TRACE = 6, CASS_LOG_LAST_ENTRY = 7, } -pub type CassLogLevel = CassLogLevel_; -#[derive(Copy, Clone)] +pub use self::CassLogLevel_ as CassLogLevel; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassSslVerifyFlags { CASS_SSL_VERIFY_NONE = 0, CASS_SSL_VERIFY_PEER_CERT = 1, CASS_SSL_VERIFY_PEER_IDENTITY = 2, CASS_SSL_VERIFY_PEER_IDENTITY_DNS = 4, } -#[derive(Copy, Clone)] #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassErrorSource_ { CASS_ERROR_SOURCE_NONE = 0, CASS_ERROR_SOURCE_LIB = 1, @@ -337,10 +619,9 @@ pub enum CassErrorSource_ { CASS_ERROR_SOURCE_SSL = 3, CASS_ERROR_SOURCE_COMPRESSION = 4, } -pub type CassErrorSource = CassErrorSource_; -#[derive(Copy, Clone)] +pub use self::CassErrorSource_ as CassErrorSource; #[repr(u32)] -#[derive(Debug)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum CassError_ { CASS_OK = 0, CASS_ERROR_LIB_BAD_PARAMS = 16777217, @@ -402,1923 +683,7911 @@ pub enum CassError_ { CASS_ERROR_SSL_PROTOCOL_ERROR = 50331654, CASS_ERROR_LAST_ENTRY = 50331655, } -pub type CassError = CassError_; -pub type CassFutureCallback = - ::std::option::Option; +pub use self::CassError_ as CassError; +/// A callback that's notified when the future is set. +/// +/// @param[in] message +/// @param[in] data user defined data provided when the callback +/// was registered. +/// +/// @see cass_future_set_callback() +pub type CassFutureCallback = ::std::option::Option; +/// A log message. #[repr(C)] #[derive(Copy)] pub struct CassLogMessage_ { + /// The millisecond timestamp (since the Epoch) when the message was logged pub time_ms: cass_uint64_t, + /// < The severity of the log message pub severity: CassLogLevel, + /// < The file where the message was logged pub file: *const ::std::os::raw::c_char, + /// < The line in the file where the message was logged pub line: ::std::os::raw::c_int, + /// < The function where the message was logged pub function: *const ::std::os::raw::c_char, + /// < The message pub message: [::std::os::raw::c_char; 1024usize], } -impl ::std::clone::Clone for CassLogMessage_ { - fn clone(&self) -> Self { *self } -} -impl ::std::default::Default for CassLogMessage_ { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } +impl Clone for CassLogMessage_ { + fn clone(&self) -> Self { + *self + } } pub type CassLogMessage = CassLogMessage_; -pub type CassLogCallback = - ::std::option::Option; -pub enum CassAuthenticator_ { } +/// A callback that's used to handle logging. +/// +/// @param[in] message +/// @param[in] data user defined data provided when the callback +/// was registered. +/// +/// @see cass_log_set_callback(); +pub type CassLogCallback = ::std::option::Option; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CassAuthenticator_ { + _unused: [u8; 0], +} +/// An authenticator. +/// +/// @struct CassAuthenticator pub type CassAuthenticator = CassAuthenticator_; +/// A callback used to initiate an authentication exchange. +/// +/// Use cass_authenticator_set_response() to set the response token. +/// +/// Use cass_authenticator_set_error() if an error occured during initialization. +/// +/// @param[in] auth +/// @param[in] data pub type CassAuthenticatorInitialCallback = - ::std::option::Option; + ::std::option::Option; +/// A callback used when an authentication challenge initiated +/// by the server. +/// +/// Use cass_authenticator_set_response() to set the response token. +/// +/// Use cass_authenticator_set_error() if an error occured during the challenge. +/// +/// @param[in] auth +/// @param[in] data +/// @param[in] token +/// @param[in] token_size pub type CassAuthenticatorChallengeCallback = - ::std::option::Option; + ::std::option::Option; +/// A callback used to indicate the success of the authentication +/// exchange. +/// +/// Use cass_authenticator_set_error() if an error occured while evaluating +/// the success token. +/// +/// @param[in] auth +/// @param[in] data +/// @param[in] token +/// @param[in] token_size pub type CassAuthenticatorSuccessCallback = - ::std::option::Option; + ::std::option::Option; +/// A callback used to cleanup resources that were acquired during +/// the process of the authentication exchange. This is called after +/// the termination of the exchange regardless of the outcome. +/// +/// @param[in] auth +/// @param[in] data pub type CassAuthenticatorCleanupCallback = - ::std::option::Option; + ::std::option::Option; +/// A callback used to cleanup resources. +/// +/// @param[in] data pub type CassAuthenticatorDataCleanupCallback = - ::std::option::Option; + ::std::option::Option; +/// Authenticator callbacks #[repr(C)] -#[derive(Copy, Clone)] -#[derive(Debug)] +#[derive(Debug, Copy)] pub struct CassAuthenticatorCallbacks_ { pub initial_callback: CassAuthenticatorInitialCallback, pub challenge_callback: CassAuthenticatorChallengeCallback, pub success_callback: CassAuthenticatorSuccessCallback, pub cleanup_callback: CassAuthenticatorCleanupCallback, } -impl ::std::default::Default for CassAuthenticatorCallbacks_ { - fn default() -> Self { unsafe { ::std::mem::zeroed() } } +impl Clone for CassAuthenticatorCallbacks_ { + fn clone(&self) -> Self { + *self + } } pub type CassAuthenticatorCallbacks = CassAuthenticatorCallbacks_; +extern "C" { + + /// Creates a new cluster. + /// + /// @public @memberof CassCluster + /// + /// @return Returns a cluster that must be freed. + /// + /// @see cass_cluster_free() + pub fn cass_cluster_new() -> *mut CassCluster; +} +extern "C" { -/// Per DataStax issue CPP-473, this symbol does not exist in the driver; expose it for -/// back-compatibility only. -pub fn cass_cluster_set_queue_size_log(_cluster: *mut CassCluster, - _queue_size: ::std::os::raw::c_uint) - -> CassError { - CassError_::CASS_OK + /// Frees a cluster instance. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + pub fn cass_cluster_free(cluster: *mut CassCluster); } +extern "C" { -#[link(name = "cassandra", kind = "dylib")] + /// Sets/Appends contact points. This *MUST* be set. The first call sets + /// the contact points and any subsequent calls appends additional contact + /// points. Passing an empty string will clear the contact points. White space + /// is striped from the contact points. + /// + /// Examples: "127.0.0.1" "127.0.0.1,127.0.0.2", "server1.domain.com" + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] contact_points A comma delimited list of addresses or + /// names. An empty string will clear the contact points. + /// The string is copied into the cluster configuration; the memory pointed + /// to by this parameter can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_contact_points(cluster: *mut CassCluster, contact_points: *const ::std::os::raw::c_char) + -> CassError; +} extern "C" { - pub fn cass_cluster_new() -> *mut CassCluster; - pub fn cass_cluster_free(cluster: *mut CassCluster); - pub fn cass_cluster_set_contact_points(cluster: *mut CassCluster, - contact_points: - *const ::std::os::raw::c_char) - -> CassError; + + /// Same as cass_cluster_set_contact_points(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] contact_points + /// @param[in] contact_points_length + /// @return same as cass_cluster_set_contact_points() + /// + /// @see cass_cluster_set_contact_points() pub fn cass_cluster_set_contact_points_n(cluster: *mut CassCluster, - contact_points: - *const ::std::os::raw::c_char, - contact_points_length: size_t) - -> CassError; - pub fn cass_cluster_set_port(cluster: *mut CassCluster, - port: ::std::os::raw::c_int) -> CassError; + contact_points: *const ::std::os::raw::c_char, + contact_points_length: usize) + -> CassError; +} +extern "C" { + + /// Sets the port. + /// + /// Default: 9042 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] port + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_port(cluster: *mut CassCluster, port: ::std::os::raw::c_int) -> CassError; +} +extern "C" { + + /// Sets the SSL context and enables SSL. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] ssl + /// + /// @see cass_ssl_new() pub fn cass_cluster_set_ssl(cluster: *mut CassCluster, ssl: *mut CassSsl); +} +extern "C" { + + /// Sets custom authenticator + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] exchange_callbacks + /// @param[in] cleanup_callback + /// @param[in] data + /// @return CASS_OK if successful, otherwise an error occurred. pub fn cass_cluster_set_authenticator_callbacks(cluster: *mut CassCluster, - exchange_callbacks: - *const CassAuthenticatorCallbacks, - cleanup_callback: - CassAuthenticatorDataCleanupCallback, - data: - *mut ::std::os::raw::c_void) - -> CassError; - pub fn cass_cluster_set_protocol_version(cluster: *mut CassCluster, - protocol_version: - ::std::os::raw::c_int) - -> CassError; - pub fn cass_cluster_set_num_threads_io(cluster: *mut CassCluster, - num_threads: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_queue_size_io(cluster: *mut CassCluster, - queue_size: ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_queue_size_event(cluster: *mut CassCluster, - queue_size: - ::std::os::raw::c_uint) - -> CassError; -// CPP-473 this symbol does not exist - exposed above. -// pub fn cass_cluster_set_queue_size_log(cluster: *mut CassCluster, -// queue_size: ::std::os::raw::c_uint) -// -> CassError; - pub fn cass_cluster_set_core_connections_per_host(cluster: - *mut CassCluster, - num_connections: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_max_connections_per_host(cluster: - *mut CassCluster, - num_connections: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_reconnect_wait_time(cluster: *mut CassCluster, - wait_time: - ::std::os::raw::c_uint); + exchange_callbacks: *const CassAuthenticatorCallbacks, + cleanup_callback: CassAuthenticatorDataCleanupCallback, + data: *mut ::std::os::raw::c_void) + -> CassError; +} +extern "C" { + + /// Sets the protocol version. This will automatically downgrade to the lowest + /// supported protocol version. + /// + /// Default: 4 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] protocol_version + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_protocol_version(cluster: *mut CassCluster, protocol_version: ::std::os::raw::c_int) + -> CassError; +} +extern "C" { + + /// Sets the number of IO threads. This is the number of threads + /// that will handle query requests. + /// + /// Default: 1 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_threads + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_num_threads_io(cluster: *mut CassCluster, num_threads: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the size of the fixed size queue that stores + /// pending requests. + /// + /// Default: 8192 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] queue_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_queue_size_io(cluster: *mut CassCluster, queue_size: ::std::os::raw::c_uint) -> CassError; +} +extern "C" { + + /// Sets the size of the fixed size queue that stores + /// events. + /// + /// Default: 8192 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] queue_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_queue_size_event(cluster: *mut CassCluster, queue_size: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the number of connections made to each server in each + /// IO thread. + /// + /// Default: 1 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_connections + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_core_connections_per_host(cluster: *mut CassCluster, + num_connections: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the maximum number of connections made to each server in each + /// IO thread. + /// + /// Default: 2 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_connections + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_max_connections_per_host(cluster: *mut CassCluster, + num_connections: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the amount of time to wait before attempting to reconnect. + /// + /// Default: 2000 milliseconds + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] wait_time + pub fn cass_cluster_set_reconnect_wait_time(cluster: *mut CassCluster, wait_time: ::std::os::raw::c_uint); +} +extern "C" { + + /// Sets the maximum number of connections that will be created concurrently. + /// Connections are created when the current connections are unable to keep up with + /// request throughput. + /// + /// Default: 1 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_connections + /// @return CASS_OK if successful, otherwise an error occurred. pub fn cass_cluster_set_max_concurrent_creation(cluster: *mut CassCluster, - num_connections: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_max_concurrent_requests_threshold(cluster: - *mut CassCluster, - num_requests: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_max_requests_per_flush(cluster: *mut CassCluster, - num_requests: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_write_bytes_high_water_mark(cluster: - *mut CassCluster, - num_bytes: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_write_bytes_low_water_mark(cluster: - *mut CassCluster, - num_bytes: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_pending_requests_high_water_mark(cluster: - *mut CassCluster, - num_requests: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_pending_requests_low_water_mark(cluster: - *mut CassCluster, - num_requests: - ::std::os::raw::c_uint) - -> CassError; - pub fn cass_cluster_set_connect_timeout(cluster: *mut CassCluster, - timeout_ms: - ::std::os::raw::c_uint); - pub fn cass_cluster_set_request_timeout(cluster: *mut CassCluster, - timeout_ms: - ::std::os::raw::c_uint); - pub fn cass_cluster_set_resolve_timeout(cluster: *mut CassCluster, - timeout_ms: - ::std::os::raw::c_uint); - pub fn cass_cluster_set_credentials(cluster: *mut CassCluster, - username: - *const ::std::os::raw::c_char, - password: - *const ::std::os::raw::c_char); - pub fn cass_cluster_set_credentials_n(cluster: *mut CassCluster, - username: - *const ::std::os::raw::c_char, - username_length: size_t, - password: - *const ::std::os::raw::c_char, - password_length: size_t); - pub fn cass_cluster_set_load_balance_round_robin(cluster: - *mut CassCluster); + num_connections: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the threshold for the maximum number of concurrent requests in-flight + /// on a connection before creating a new connection. The number of new connections + /// created will not exceed max_connections_per_host. + /// + /// Default: 100 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_requests + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_max_concurrent_requests_threshold(cluster: *mut CassCluster, + num_requests: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the maximum number of requests processed by an IO worker + /// per flush. + /// + /// Default: 128 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_requests + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_max_requests_per_flush(cluster: *mut CassCluster, num_requests: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the high water mark for the number of bytes outstanding + /// on a connection. Disables writes to a connection if the number + /// of bytes queued exceed this value. + /// + /// Default: 64 KB + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_bytes + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_write_bytes_high_water_mark(cluster: *mut CassCluster, num_bytes: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the low water mark for number of bytes outstanding on a + /// connection. After exceeding high water mark bytes, writes will + /// only resume once the number of bytes fall below this value. + /// + /// Default: 32 KB + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_bytes + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_write_bytes_low_water_mark(cluster: *mut CassCluster, num_bytes: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the high water mark for the number of requests queued waiting + /// for a connection in a connection pool. Disables writes to a + /// host on an IO worker if the number of requests queued exceed this + /// value. + /// + /// Default: 256 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_requests + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_pending_requests_high_water_mark(cluster: *mut CassCluster, + num_requests: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the low water mark for the number of requests queued waiting + /// for a connection in a connection pool. After exceeding high water mark + /// requests, writes to a host will only resume once the number of requests + /// fall below this value. + /// + /// Default: 128 + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] num_requests + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_cluster_set_pending_requests_low_water_mark(cluster: *mut CassCluster, + num_requests: ::std::os::raw::c_uint) + -> CassError; +} +extern "C" { + + /// Sets the timeout for connecting to a node. + /// + /// Default: 5000 milliseconds + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] timeout_ms Connect timeout in milliseconds + pub fn cass_cluster_set_connect_timeout(cluster: *mut CassCluster, timeout_ms: ::std::os::raw::c_uint); +} +extern "C" { + + /// Sets the timeout for waiting for a response from a node. + /// + /// Default: 12000 milliseconds + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] timeout_ms Request timeout in milliseconds. Use 0 for no timeout. + pub fn cass_cluster_set_request_timeout(cluster: *mut CassCluster, timeout_ms: ::std::os::raw::c_uint); +} +extern "C" { + + /// Sets the timeout for waiting for DNS name resolution. + /// + /// Default: 2000 milliseconds + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] timeout_ms Request timeout in milliseconds + pub fn cass_cluster_set_resolve_timeout(cluster: *mut CassCluster, timeout_ms: ::std::os::raw::c_uint); +} +extern "C" { + + /// Sets credentials for plain text authentication. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] username + /// @param[in] password + pub fn cass_cluster_set_credentials(cluster: *mut CassCluster, username: *const ::std::os::raw::c_char, + password: *const ::std::os::raw::c_char); +} +extern "C" { + + /// Same as cass_cluster_set_credentials(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] username + /// @param[in] username_length + /// @param[in] password + /// @param[in] password_length + /// @return same as cass_cluster_set_credentials() + /// + /// @see cass_cluster_set_credentials(); + pub fn cass_cluster_set_credentials_n(cluster: *mut CassCluster, username: *const ::std::os::raw::c_char, + username_length: usize, password: *const ::std::os::raw::c_char, + password_length: usize); +} +extern "C" { + + /// Configures the cluster to use round-robin load balancing. + /// + /// The driver discovers all nodes in a cluster and cycles through + /// them per request. All are considered 'local'. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + pub fn cass_cluster_set_load_balance_round_robin(cluster: *mut CassCluster); +} +extern "C" { + + /// Configures the cluster to use DC-aware load balancing. + /// For each query, all live nodes in a primary 'local' DC are tried first, + /// followed by any node from other DCs. + /// + /// Note: This is the default, and does not need to be called unless + /// switching an existing from another policy or changing settings. + /// Without further configuration, a default local_dc is chosen from the + /// first connected contact point, and no remote hosts are considered in + /// query plans. If relying on this mechanism, be sure to use only contact + /// points from the local DC. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] local_dc The primary data center to try first + /// @param[in] used_hosts_per_remote_dc The number of host used in each remote DC if no hosts + /// are available in the local dc + /// @param[in] allow_remote_dcs_for_local_cl Allows remote hosts to be used if no local dc hosts + /// are available and the consistency level is LOCAL_ONE or LOCAL_QUORUM + /// @return CASS_OK if successful, otherwise an error occurred pub fn cass_cluster_set_load_balance_dc_aware(cluster: *mut CassCluster, - local_dc: - *const ::std::os::raw::c_char, - used_hosts_per_remote_dc: - ::std::os::raw::c_uint, - allow_remote_dcs_for_local_cl: - cass_bool_t) - -> CassError; + local_dc: *const ::std::os::raw::c_char, + used_hosts_per_remote_dc: ::std::os::raw::c_uint, + allow_remote_dcs_for_local_cl: cass_bool_t) + -> CassError; +} +extern "C" { + + /// Same as cass_cluster_set_load_balance_dc_aware(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] local_dc + /// @param[in] local_dc_length + /// @param[in] used_hosts_per_remote_dc + /// @param[in] allow_remote_dcs_for_local_cl + /// @return same as cass_cluster_set_load_balance_dc_aware() + /// + /// @see cass_cluster_set_load_balance_dc_aware() pub fn cass_cluster_set_load_balance_dc_aware_n(cluster: *mut CassCluster, - local_dc: - *const ::std::os::raw::c_char, - local_dc_length: size_t, - used_hosts_per_remote_dc: - ::std::os::raw::c_uint, - allow_remote_dcs_for_local_cl: - cass_bool_t) - -> CassError; - pub fn cass_cluster_set_token_aware_routing(cluster: *mut CassCluster, - enabled: cass_bool_t); - pub fn cass_cluster_set_latency_aware_routing(cluster: *mut CassCluster, - enabled: cass_bool_t); - pub fn cass_cluster_set_latency_aware_routing_settings(cluster: - *mut CassCluster, - exclusion_threshold: - cass_double_t, - scale_ms: - cass_uint64_t, - retry_period_ms: - cass_uint64_t, - update_rate_ms: - cass_uint64_t, - min_measured: - cass_uint64_t); - pub fn cass_cluster_set_whitelist_filtering(cluster: *mut CassCluster, - hosts: - *const ::std::os::raw::c_char); - pub fn cass_cluster_set_whitelist_filtering_n(cluster: *mut CassCluster, - hosts: - *const ::std::os::raw::c_char, - hosts_length: size_t); - pub fn cass_cluster_set_blacklist_filtering(cluster: *mut CassCluster, - hosts: - *const ::std::os::raw::c_char); - pub fn cass_cluster_set_blacklist_filtering_n(cluster: *mut CassCluster, - hosts: - *const ::std::os::raw::c_char, - hosts_length: size_t); - pub fn cass_cluster_set_whitelist_dc_filtering(cluster: *mut CassCluster, - dcs: - *const ::std::os::raw::c_char); - pub fn cass_cluster_set_whitelist_dc_filtering_n(cluster: - *mut CassCluster, - dcs: - *const ::std::os::raw::c_char, - dcs_length: size_t); - pub fn cass_cluster_set_blacklist_dc_filtering(cluster: *mut CassCluster, - dcs: - *const ::std::os::raw::c_char); - pub fn cass_cluster_set_blacklist_dc_filtering_n(cluster: - *mut CassCluster, - dcs: - *const ::std::os::raw::c_char, - dcs_length: size_t); - pub fn cass_cluster_set_tcp_nodelay(cluster: *mut CassCluster, - enabled: cass_bool_t); - pub fn cass_cluster_set_tcp_keepalive(cluster: *mut CassCluster, - enabled: cass_bool_t, + local_dc: *const ::std::os::raw::c_char, local_dc_length: usize, + used_hosts_per_remote_dc: ::std::os::raw::c_uint, + allow_remote_dcs_for_local_cl: cass_bool_t) + -> CassError; +} +extern "C" { + + /// Configures the cluster to use token-aware request routing or not. + /// + /// Important: Token-aware routing depends on keyspace metadata. + /// For this reason enabling token-aware routing will also enable retrieving + /// and updating keyspace schema metadata. + /// + /// Default: cass_true (enabled). + /// + /// This routing policy composes the base routing policy, routing + /// requests first to replicas on nodes considered 'local' by + /// the base load balancing policy. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] enabled + pub fn cass_cluster_set_token_aware_routing(cluster: *mut CassCluster, enabled: cass_bool_t); +} +extern "C" { + + /// Configures the cluster to use latency-aware request routing or not. + /// + /// Default: cass_false (disabled). + /// + /// This routing policy is a top-level routing policy. It uses the + /// base routing policy to determine locality (dc-aware) and/or + /// placement (token-aware) before considering the latency. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] enabled + pub fn cass_cluster_set_latency_aware_routing(cluster: *mut CassCluster, enabled: cass_bool_t); +} +extern "C" { + + /// Configures the settings for latency-aware request routing. + /// + /// Defaults: + /// + ///
    + ///
  • exclusion_threshold: 2.0
  • + ///
  • scale_ms: 100 milliseconds
  • + ///
  • retry_period_ms: 10,000 milliseconds (10 seconds)
  • + ///
  • update_rate_ms: 100 milliseconds
  • + ///
  • min_measured: 50
  • + ///
+ /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] exclusion_threshold Controls how much worse the latency must be compared to the + /// average latency of the best performing node before it penalized. + /// @param[in] scale_ms Controls the weight given to older latencies when calculating the average + /// latency of a node. A bigger scale will give more weight to older latency measurements. + /// @param[in] retry_period_ms The amount of time a node is penalized by the policy before + /// being given a second chance when the current average latency exceeds the calculated + /// threshold (exclusion_threshold * best_average_latency). + /// @param[in] update_rate_ms The rate at which the best average latency is recomputed. + /// @param[in] min_measured The minimum number of measurements per-host required to + /// be considered by the policy. + pub fn cass_cluster_set_latency_aware_routing_settings(cluster: *mut CassCluster, + exclusion_threshold: cass_double_t, + scale_ms: cass_uint64_t, retry_period_ms: cass_uint64_t, + update_rate_ms: cass_uint64_t, + min_measured: cass_uint64_t); +} +extern "C" { + + /// Sets/Appends whitelist hosts. The first call sets the whitelist hosts and + /// any subsequent calls appends additional hosts. Passing an empty string will + /// clear and disable the whitelist. White space is striped from the hosts. + /// + /// This policy filters requests to all other policies, only allowing requests + /// to the hosts contained in the whitelist. Any host not in the whitelist will + /// be ignored and a connection will not be established. This policy is useful + /// for ensuring that the driver will only connect to a predefined set of hosts. + /// + /// Examples: "127.0.0.1" "127.0.0.1,127.0.0.2" + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] hosts A comma delimited list of addresses. An empty string will + /// clear the whitelist hosts. The string is copied into the cluster + /// configuration; the memory pointed to by this parameter can be freed after + /// this call. + pub fn cass_cluster_set_whitelist_filtering(cluster: *mut CassCluster, hosts: *const ::std::os::raw::c_char); +} +extern "C" { + + /// Same as cass_cluster_set_whitelist_filtering_hosts(), but with lengths for + /// string parameters. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] hosts + /// @param[in] hosts_length + /// @return same as cass_cluster_set_whitelist_filtering_hosts() + /// + /// @see cass_cluster_set_whitelist_filtering_hosts() + pub fn cass_cluster_set_whitelist_filtering_n(cluster: *mut CassCluster, hosts: *const ::std::os::raw::c_char, + hosts_length: usize); +} +extern "C" { + + /// Sets/Appends blacklist hosts. The first call sets the blacklist hosts and + /// any subsequent calls appends additional hosts. Passing an empty string will + /// clear and disable the blacklist. White space is striped from the hosts. + /// + /// This policy filters requests to all other policies, only allowing requests + /// to the hosts not contained in the blacklist. Any host in the blacklist will + /// be ignored and a connection will not be established. This policy is useful + /// for ensuring that the driver will not connect to a predefined set of hosts. + /// + /// Examples: "127.0.0.1" "127.0.0.1,127.0.0.2" + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] hosts A comma delimited list of addresses. An empty string will + /// clear the blacklist hosts. The string is copied into the cluster + /// configuration; the memory pointed to by this parameter can be freed after + /// this call. + pub fn cass_cluster_set_blacklist_filtering(cluster: *mut CassCluster, hosts: *const ::std::os::raw::c_char); +} +extern "C" { + + /// Same as cass_cluster_set_blacklist_filtering_hosts(), but with lengths for + /// string parameters. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] hosts + /// @param[in] hosts_length + /// @return same as cass_cluster_set_blacklist_filtering_hosts() + /// + /// @see cass_cluster_set_blacklist_filtering_hosts() + pub fn cass_cluster_set_blacklist_filtering_n(cluster: *mut CassCluster, hosts: *const ::std::os::raw::c_char, + hosts_length: usize); +} +extern "C" { + + /// Same as cass_cluster_set_whitelist_filtering(), but whitelist all hosts of a dc + /// + /// Examples: "dc1", "dc1,dc2" + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] dcs A comma delimited list of dcs. An empty string will clear the + /// whitelist dcs. The string is copied into the cluster configuration; the + /// memory pointed to by this parameter can be freed after this call. + pub fn cass_cluster_set_whitelist_dc_filtering(cluster: *mut CassCluster, dcs: *const ::std::os::raw::c_char); +} +extern "C" { + + /// Same as cass_cluster_set_whitelist_dc_filtering(), but with lengths for + /// string parameters. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] dcs + /// @param[in] dcs_length + /// @return same as cass_cluster_set_whitelist_dc_filtering() + /// + /// @see cass_cluster_set_whitelist_dc_filtering() + pub fn cass_cluster_set_whitelist_dc_filtering_n(cluster: *mut CassCluster, dcs: *const ::std::os::raw::c_char, + dcs_length: usize); +} +extern "C" { + + /// Same as cass_cluster_set_blacklist_filtering(), but blacklist all hosts of a dc + /// + /// Examples: "dc1", "dc1,dc2" + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] dcs A comma delimited list of dcs. An empty string will clear the + /// blacklist dcs. The string is copied into the cluster configuration; the + /// memory pointed to by this parameter can be freed after this call. + pub fn cass_cluster_set_blacklist_dc_filtering(cluster: *mut CassCluster, dcs: *const ::std::os::raw::c_char); +} +extern "C" { + + /// Same as cass_cluster_set_blacklist_dc_filtering(), but with lengths for + /// string parameters. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] dcs + /// @param[in] dcs_length + /// @return same as cass_cluster_set_blacklist_dc_filtering() + /// + /// @see cass_cluster_set_blacklist_dc_filtering() + pub fn cass_cluster_set_blacklist_dc_filtering_n(cluster: *mut CassCluster, dcs: *const ::std::os::raw::c_char, + dcs_length: usize); +} +extern "C" { + + /// Enable/Disable Nagel's algorithm on connections. + /// + /// Default: cass_true (disables Nagel's algorithm). + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] enabled + pub fn cass_cluster_set_tcp_nodelay(cluster: *mut CassCluster, enabled: cass_bool_t); +} +extern "C" { + + /// Enable/Disable TCP keep-alive + /// + /// Default: cass_false (disabled). + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] enabled + /// @param[in] delay_secs The initial delay in seconds, ignored when + /// `enabled` is false. + pub fn cass_cluster_set_tcp_keepalive(cluster: *mut CassCluster, enabled: cass_bool_t, delay_secs: ::std::os::raw::c_uint); - pub fn cass_cluster_set_timestamp_gen(cluster: *mut CassCluster, - timestamp_gen: - *mut CassTimestampGen); - pub fn cass_cluster_set_connection_heartbeat_interval(cluster: - *mut CassCluster, - interval_secs: - ::std::os::raw::c_uint); - pub fn cass_cluster_set_connection_idle_timeout(cluster: *mut CassCluster, - timeout_secs: - ::std::os::raw::c_uint); - pub fn cass_cluster_set_retry_policy(cluster: *mut CassCluster, - retry_policy: *mut CassRetryPolicy); - pub fn cass_cluster_set_use_schema(cluster: *mut CassCluster, - enabled: cass_bool_t); - pub fn cass_cluster_set_use_hostname_resolution(cluster: *mut CassCluster, - enabled: cass_bool_t) - -> CassError; - pub fn cass_cluster_set_use_randomized_contact_points(cluster: - *mut CassCluster, - enabled: - cass_bool_t) - -> CassError; +} +extern "C" { + + /// Sets the timestamp generator used to assign timestamps to all requests + /// unless overridden by setting the timestamp on a statement or a batch. + /// + /// Default: server-side timestamp generator. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] timestamp_gen + /// + /// @see cass_statement_set_timestamp() + /// @see cass_batch_set_timestamp() + pub fn cass_cluster_set_timestamp_gen(cluster: *mut CassCluster, timestamp_gen: *mut CassTimestampGen); +} +extern "C" { + + /// Sets the amount of time between heartbeat messages and controls the amount + /// of time the connection must be idle before sending heartbeat messages. This + /// is useful for preventing intermediate network devices from dropping + /// connections. + /// + /// Default: 30 seconds + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] interval_secs Use 0 to disable heartbeat messages + pub fn cass_cluster_set_connection_heartbeat_interval(cluster: *mut CassCluster, + interval_secs: ::std::os::raw::c_uint); +} +extern "C" { + + /// Sets the amount of time a connection is allowed to be without a successful + /// heartbeat response before being terminated and scheduled for reconnection. + /// + /// Default: 60 seconds + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] timeout_secs + pub fn cass_cluster_set_connection_idle_timeout(cluster: *mut CassCluster, timeout_secs: ::std::os::raw::c_uint); +} +extern "C" { + + /// Sets the retry policy used for all requests unless overridden by setting + /// a retry policy on a statement or a batch. + /// + /// Default: The same policy as would be created by the function: + /// cass_retry_policy_default_new(). This policy will retry on a read timeout + /// if there was enough replicas, but no data present, on a write timeout if a + /// logged batch request failed to write the batch log, and on a unavailable + /// error it retries using a new host. In all other cases the default policy + /// will return an error. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] retry_policy + /// + /// @see cass_retry_policy_default_new() + /// @see cass_statement_set_retry_policy() + /// @see cass_batch_set_retry_policy() + pub fn cass_cluster_set_retry_policy(cluster: *mut CassCluster, retry_policy: *mut CassRetryPolicy); +} +extern "C" { + + /// Enable/Disable retrieving and updating schema metadata. If disabled + /// this is allows the driver to skip over retrieving and updating schema + /// metadata and cass_session_get_schema_meta() will always return an empty object. + /// This can be useful for reducing the startup overhead of short-lived sessions. + /// + /// Default: cass_true (enabled). + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] enabled + /// + /// @see cass_session_get_schema_meta() + pub fn cass_cluster_set_use_schema(cluster: *mut CassCluster, enabled: cass_bool_t); +} +extern "C" { + + /// Enable/Disable retrieving hostnames for IP addresses using reverse IP lookup. + /// + /// This is useful for authentication (Kerberos) or encryption (SSL) services + /// that require a valid hostname for verification. + /// + /// Default: cass_false (disabled). + /// + /// Important: Not implemented if using libuv 0.1x or earlier + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] enabled + /// @return CASS_OK if successful, otherwise an error occurred + /// + /// @see cass_cluster_set_resolve_timeout() + pub fn cass_cluster_set_use_hostname_resolution(cluster: *mut CassCluster, enabled: cass_bool_t) -> CassError; +} +extern "C" { + + /// Enable/Disable the randomization of the contact points list. + /// + /// Default: cass_true (enabled). + /// + /// Important: This setting should only be disabled for debugging or + /// tests. + /// + /// @public @memberof CassCluster + /// + /// @param[in] cluster + /// @param[in] enabled + /// @return CASS_OK if successful, otherwise an error occurred + /// + /// @see cass_cluster_set_resolve_timeout() + pub fn cass_cluster_set_use_randomized_contact_points(cluster: *mut CassCluster, enabled: cass_bool_t) + -> CassError; +} +extern "C" { + + /// Creates a new session. + /// + /// @public @memberof CassSession + /// + /// @return Returns a session that must be freed. + /// + /// @see cass_session_free() pub fn cass_session_new() -> *mut CassSession; +} +extern "C" { + + /// Frees a session instance. If the session is still connected it will be synchronously + /// closed before being deallocated. + /// + /// Important: Do not free a session in a future callback. Freeing a session in a future + /// callback will cause a deadlock. + /// + /// @public @memberof CassSession + /// + /// @param[in] session pub fn cass_session_free(session: *mut CassSession); - pub fn cass_session_connect(session: *mut CassSession, - cluster: *const CassCluster) - -> *mut CassFuture; - pub fn cass_session_connect_keyspace(session: *mut CassSession, - cluster: *const CassCluster, - keyspace: - *const ::std::os::raw::c_char) - -> *mut CassFuture; - pub fn cass_session_connect_keyspace_n(session: *mut CassSession, - cluster: *const CassCluster, - keyspace: - *const ::std::os::raw::c_char, - keyspace_length: size_t) - -> *mut CassFuture; +} +extern "C" { + + /// Connects a session. + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @param[in] cluster The cluster configuration is copied into the session and + /// is immutable after connection. + /// @return A future that must be freed. + /// + /// @see cass_session_close() + pub fn cass_session_connect(session: *mut CassSession, cluster: *const CassCluster) -> *mut CassFuture; +} +extern "C" { + + /// Connects a session and sets the keyspace. + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @param[in] cluster The cluster configuration is copied into the session and + /// is immutable after connection. + /// @param[in] keyspace + /// @return A future that must be freed. + /// + /// @see cass_session_close() + pub fn cass_session_connect_keyspace(session: *mut CassSession, cluster: *const CassCluster, + keyspace: *const ::std::os::raw::c_char) + -> *mut CassFuture; +} +extern "C" { + + /// Same as cass_session_connect_keyspace(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @param[in] cluster + /// @param[in] keyspace + /// @param[in] keyspace_length + /// @return same as cass_session_connect_keyspace() + /// + /// @see cass_session_connect_keyspace() + pub fn cass_session_connect_keyspace_n(session: *mut CassSession, cluster: *const CassCluster, + keyspace: *const ::std::os::raw::c_char, keyspace_length: usize) + -> *mut CassFuture; +} +extern "C" { + + /// Closes the session instance, outputs a close future which can + /// be used to determine when the session has been terminated. This allows + /// in-flight requests to finish. + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @return A future that must be freed. pub fn cass_session_close(session: *mut CassSession) -> *mut CassFuture; - pub fn cass_session_prepare(session: *mut CassSession, - query: *const ::std::os::raw::c_char) - -> *mut CassFuture; - pub fn cass_session_prepare_n(session: *mut CassSession, - query: *const ::std::os::raw::c_char, - query_length: size_t) -> *mut CassFuture; - pub fn cass_session_execute(session: *mut CassSession, - statement: *const CassStatement) - -> *mut CassFuture; - pub fn cass_session_execute_batch(session: *mut CassSession, - batch: *const CassBatch) - -> *mut CassFuture; - pub fn cass_session_get_schema_meta(session: *const CassSession) - -> *const CassSchemaMeta; - pub fn cass_session_get_metrics(session: *const CassSession, - output: *mut CassMetrics); +} +extern "C" { + + /// Create a prepared statement. + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @param[in] query The query is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @return A future that must be freed. + /// + /// @see cass_future_get_prepared() + pub fn cass_session_prepare(session: *mut CassSession, query: *const ::std::os::raw::c_char) -> *mut CassFuture; +} +extern "C" { + + /// Same as cass_session_prepare(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @param[in] query + /// @param[in] query_length + /// @return same as cass_session_prepare() + /// + /// @see cass_session_prepare() + pub fn cass_session_prepare_n(session: *mut CassSession, query: *const ::std::os::raw::c_char, + query_length: usize) + -> *mut CassFuture; +} +extern "C" { + + /// Execute a query or bound statement. + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @param[in] statement + /// @return A future that must be freed. + /// + /// @see cass_future_get_result() + pub fn cass_session_execute(session: *mut CassSession, statement: *const CassStatement) -> *mut CassFuture; +} +extern "C" { + + /// Execute a batch statement. + /// + /// @cassandra{2.0+} + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @param[in] batch + /// @return A future that must be freed. + /// + /// @see cass_future_get_result() + pub fn cass_session_execute_batch(session: *mut CassSession, batch: *const CassBatch) -> *mut CassFuture; +} +extern "C" { + + /// Gets a snapshot of this session's schema metadata. The returned + /// snapshot of the schema metadata is not updated. This function + /// must be called again to retrieve any schema changes since the + /// previous call. + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @return A schema instance that must be freed. + /// + /// @see cass_schema_free() + pub fn cass_session_get_schema_meta(session: *const CassSession) -> *const CassSchemaMeta; +} +extern "C" { + + /// Gets a copy of this session's performance/diagnostic metrics. + /// + /// @public @memberof CassSession + /// + /// @param[in] session + /// @param[out] output + /// + /// @see cass_schema_free() + pub fn cass_session_get_metrics(session: *const CassSession, output: *mut CassMetrics); +} +extern "C" { + + /// Frees a schema metadata instance. + /// + /// @public @memberof CassSchemaMeta + /// + /// @param[in] schema_meta pub fn cass_schema_meta_free(schema_meta: *const CassSchemaMeta); - pub fn cass_schema_meta_snapshot_version(schema_meta: - *const CassSchemaMeta) - -> cass_uint32_t; - pub fn cass_schema_meta_version(schema_meta: *const CassSchemaMeta) - -> CassVersion; - pub fn cass_schema_meta_keyspace_by_name(schema_meta: - *const CassSchemaMeta, - keyspace: - *const ::std::os::raw::c_char) - -> *const CassKeyspaceMeta; - pub fn cass_schema_meta_keyspace_by_name_n(schema_meta: - *const CassSchemaMeta, - keyspace: - *const ::std::os::raw::c_char, - keyspace_length: size_t) - -> *const CassKeyspaceMeta; - pub fn cass_keyspace_meta_name(keyspace_meta: *const CassKeyspaceMeta, - name: *mut *const ::std::os::raw::c_char, - name_length: *mut size_t); - pub fn cass_keyspace_meta_table_by_name(keyspace_meta: - *const CassKeyspaceMeta, - table: - *const ::std::os::raw::c_char) - -> *const CassTableMeta; - pub fn cass_keyspace_meta_table_by_name_n(keyspace_meta: - *const CassKeyspaceMeta, - table: - *const ::std::os::raw::c_char, - table_length: size_t) - -> *const CassTableMeta; - pub fn cass_keyspace_meta_materialized_view_by_name(keyspace_meta: - *const CassKeyspaceMeta, - view: - *const ::std::os::raw::c_char) - -> *const CassMaterializedViewMeta; - pub fn cass_keyspace_meta_materialized_view_by_name_n(keyspace_meta: - *const CassKeyspaceMeta, - view: - *const ::std::os::raw::c_char, - view_length: size_t) - -> *const CassMaterializedViewMeta; - pub fn cass_keyspace_meta_user_type_by_name(keyspace_meta: - *const CassKeyspaceMeta, - type_: - *const ::std::os::raw::c_char) - -> *const CassDataType; - pub fn cass_keyspace_meta_user_type_by_name_n(keyspace_meta: - *const CassKeyspaceMeta, - type_: - *const ::std::os::raw::c_char, - type_length: size_t) - -> *const CassDataType; - pub fn cass_keyspace_meta_function_by_name(keyspace_meta: - *const CassKeyspaceMeta, - name: - *const ::std::os::raw::c_char, - arguments: - *const ::std::os::raw::c_char) - -> *const CassFunctionMeta; - pub fn cass_keyspace_meta_function_by_name_n(keyspace_meta: - *const CassKeyspaceMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - arguments: - *const ::std::os::raw::c_char, - arguments_length: size_t) - -> *const CassFunctionMeta; - pub fn cass_keyspace_meta_aggregate_by_name(keyspace_meta: - *const CassKeyspaceMeta, - name: - *const ::std::os::raw::c_char, - arguments: - *const ::std::os::raw::c_char) - -> *const CassAggregateMeta; - pub fn cass_keyspace_meta_aggregate_by_name_n(keyspace_meta: - *const CassKeyspaceMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - arguments: - *const ::std::os::raw::c_char, - arguments_length: size_t) - -> *const CassAggregateMeta; - pub fn cass_keyspace_meta_field_by_name(keyspace_meta: - *const CassKeyspaceMeta, - name: - *const ::std::os::raw::c_char) - -> *const CassValue; - pub fn cass_keyspace_meta_field_by_name_n(keyspace_meta: - *const CassKeyspaceMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassValue; - pub fn cass_table_meta_name(table_meta: *const CassTableMeta, - name: *mut *const ::std::os::raw::c_char, - name_length: *mut size_t); - pub fn cass_table_meta_column_by_name(table_meta: *const CassTableMeta, - column: - *const ::std::os::raw::c_char) - -> *const CassColumnMeta; - pub fn cass_table_meta_column_by_name_n(table_meta: *const CassTableMeta, - column: - *const ::std::os::raw::c_char, - column_length: size_t) - -> *const CassColumnMeta; - pub fn cass_table_meta_column_count(table_meta: *const CassTableMeta) - -> size_t; - pub fn cass_table_meta_column(table_meta: *const CassTableMeta, - index: size_t) -> *const CassColumnMeta; - pub fn cass_table_meta_index_by_name(table_meta: *const CassTableMeta, - index: *const ::std::os::raw::c_char) - -> *const CassIndexMeta; - pub fn cass_table_meta_index_by_name_n(table_meta: *const CassTableMeta, - index: - *const ::std::os::raw::c_char, - index_length: size_t) - -> *const CassIndexMeta; - pub fn cass_table_meta_index_count(table_meta: *const CassTableMeta) - -> size_t; - pub fn cass_table_meta_index(table_meta: *const CassTableMeta, - index: size_t) -> *const CassIndexMeta; - pub fn cass_table_meta_materialized_view_by_name(table_meta: - *const CassTableMeta, - view: - *const ::std::os::raw::c_char) - -> *const CassMaterializedViewMeta; - pub fn cass_table_meta_materialized_view_by_name_n(table_meta: - *const CassTableMeta, - view: - *const ::std::os::raw::c_char, - view_length: size_t) - -> *const CassMaterializedViewMeta; - pub fn cass_table_meta_materialized_view_count(table_meta: - *const CassTableMeta) - -> size_t; - pub fn cass_table_meta_materialized_view(table_meta: *const CassTableMeta, - index: size_t) - -> *const CassMaterializedViewMeta; - pub fn cass_table_meta_partition_key_count(table_meta: - *const CassTableMeta) - -> size_t; - pub fn cass_table_meta_partition_key(table_meta: *const CassTableMeta, - index: size_t) - -> *const CassColumnMeta; - pub fn cass_table_meta_clustering_key_count(table_meta: - *const CassTableMeta) - -> size_t; - pub fn cass_table_meta_clustering_key(table_meta: *const CassTableMeta, - index: size_t) - -> *const CassColumnMeta; - pub fn cass_table_meta_clustering_key_order(table_meta: - *const CassTableMeta, - index: size_t) - -> CassClusteringOrder; - pub fn cass_table_meta_field_by_name(table_meta: *const CassTableMeta, - name: *const ::std::os::raw::c_char) - -> *const CassValue; - pub fn cass_table_meta_field_by_name_n(table_meta: *const CassTableMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassValue; - pub fn cass_materialized_view_meta_column_by_name(view_meta: - *const CassMaterializedViewMeta, - column: - *const ::std::os::raw::c_char) - -> *const CassColumnMeta; - pub fn cass_materialized_view_meta_column_by_name_n(view_meta: - *const CassMaterializedViewMeta, - column: - *const ::std::os::raw::c_char, - column_length: size_t) - -> *const CassColumnMeta; - pub fn cass_materialized_view_meta_name(view_meta: - *const CassMaterializedViewMeta, - name: - *mut *const ::std::os::raw::c_char, - name_length: *mut size_t); - pub fn cass_materialized_view_meta_base_table(view_meta: - *const CassMaterializedViewMeta) - -> *const CassTableMeta; - pub fn cass_materialized_view_meta_column_count(view_meta: - *const CassMaterializedViewMeta) - -> size_t; - pub fn cass_materialized_view_meta_column(view_meta: - *const CassMaterializedViewMeta, - index: size_t) - -> *const CassColumnMeta; - pub fn cass_materialized_view_meta_partition_key_count(view_meta: - *const CassMaterializedViewMeta) - -> size_t; - pub fn cass_materialized_view_meta_partition_key(view_meta: - *const CassMaterializedViewMeta, - index: size_t) - -> *const CassColumnMeta; - pub fn cass_materialized_view_meta_clustering_key_count(view_meta: - *const CassMaterializedViewMeta) - -> size_t; - pub fn cass_materialized_view_meta_clustering_key(view_meta: - *const CassMaterializedViewMeta, - index: size_t) - -> *const CassColumnMeta; - pub fn cass_materialized_view_meta_clustering_key_order(view_meta: - *const CassMaterializedViewMeta, - index: size_t) - -> CassClusteringOrder; - pub fn cass_materialized_view_meta_field_by_name(view_meta: - *const CassMaterializedViewMeta, - name: - *const ::std::os::raw::c_char) - -> *const CassValue; - pub fn cass_materialized_view_meta_field_by_name_n(view_meta: - *const CassMaterializedViewMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassValue; - pub fn cass_column_meta_name(column_meta: *const CassColumnMeta, - name: *mut *const ::std::os::raw::c_char, - name_length: *mut size_t); - pub fn cass_column_meta_type(column_meta: *const CassColumnMeta) - -> CassColumnType; - pub fn cass_column_meta_data_type(column_meta: *const CassColumnMeta) - -> *const CassDataType; - pub fn cass_column_meta_field_by_name(column_meta: *const CassColumnMeta, - name: *const ::std::os::raw::c_char) - -> *const CassValue; - pub fn cass_column_meta_field_by_name_n(column_meta: - *const CassColumnMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassValue; - pub fn cass_index_meta_name(index_meta: *const CassIndexMeta, - name: *mut *const ::std::os::raw::c_char, - name_length: *mut size_t); - pub fn cass_index_meta_type(index_meta: *const CassIndexMeta) - -> CassIndexType; - pub fn cass_index_meta_target(index_meta: *const CassIndexMeta, - target: *mut *const ::std::os::raw::c_char, - target_length: *mut size_t); - pub fn cass_index_meta_options(index_meta: *const CassIndexMeta) - -> *const CassValue; - pub fn cass_index_meta_field_by_name(index_meta: *const CassIndexMeta, - name: *const ::std::os::raw::c_char) - -> *const CassValue; - pub fn cass_index_meta_field_by_name_n(index_meta: *const CassIndexMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassValue; - pub fn cass_function_meta_name(function_meta: *const CassFunctionMeta, - name: *mut *const ::std::os::raw::c_char, - name_length: *mut size_t); - pub fn cass_function_meta_full_name(function_meta: - *const CassFunctionMeta, - full_name: - *mut *const ::std::os::raw::c_char, - full_name_length: *mut size_t); - pub fn cass_function_meta_body(function_meta: *const CassFunctionMeta, - body: *mut *const ::std::os::raw::c_char, - body_length: *mut size_t); - pub fn cass_function_meta_language(function_meta: *const CassFunctionMeta, - language: - *mut *const ::std::os::raw::c_char, - language_length: *mut size_t); - pub fn cass_function_meta_called_on_null_input(function_meta: - *const CassFunctionMeta) - -> cass_bool_t; - pub fn cass_function_meta_argument_count(function_meta: - *const CassFunctionMeta) - -> size_t; - pub fn cass_function_meta_argument(function_meta: *const CassFunctionMeta, - index: size_t, - name: - *mut *const ::std::os::raw::c_char, - name_length: *mut size_t, - type_: *mut *const CassDataType) - -> CassError; - pub fn cass_function_meta_argument_type_by_name(function_meta: - *const CassFunctionMeta, - name: - *const ::std::os::raw::c_char) - -> *const CassDataType; - pub fn cass_function_meta_argument_type_by_name_n(function_meta: - *const CassFunctionMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassDataType; - pub fn cass_function_meta_return_type(function_meta: - *const CassFunctionMeta) - -> *const CassDataType; - pub fn cass_function_meta_field_by_name(function_meta: - *const CassFunctionMeta, - name: - *const ::std::os::raw::c_char) - -> *const CassValue; - pub fn cass_function_meta_field_by_name_n(function_meta: - *const CassFunctionMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassValue; - pub fn cass_aggregate_meta_name(aggregate_meta: *const CassAggregateMeta, - name: *mut *const ::std::os::raw::c_char, - name_length: *mut size_t); - pub fn cass_aggregate_meta_full_name(aggregate_meta: - *const CassAggregateMeta, - full_name: - *mut *const ::std::os::raw::c_char, - full_name_length: *mut size_t); - pub fn cass_aggregate_meta_argument_count(aggregate_meta: - *const CassAggregateMeta) - -> size_t; - pub fn cass_aggregate_meta_argument_type(aggregate_meta: - *const CassAggregateMeta, - index: size_t) - -> *const CassDataType; - pub fn cass_aggregate_meta_return_type(aggregate_meta: - *const CassAggregateMeta) - -> *const CassDataType; - pub fn cass_aggregate_meta_state_type(aggregate_meta: - *const CassAggregateMeta) - -> *const CassDataType; - pub fn cass_aggregate_meta_state_func(aggregate_meta: - *const CassAggregateMeta) - -> *const CassFunctionMeta; - pub fn cass_aggregate_meta_final_func(aggregate_meta: - *const CassAggregateMeta) - -> *const CassFunctionMeta; - pub fn cass_aggregate_meta_init_cond(aggregate_meta: - *const CassAggregateMeta) - -> *const CassValue; - pub fn cass_aggregate_meta_field_by_name(aggregate_meta: - *const CassAggregateMeta, - name: - *const ::std::os::raw::c_char) - -> *const CassValue; - pub fn cass_aggregate_meta_field_by_name_n(aggregate_meta: - *const CassAggregateMeta, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassValue; - pub fn cass_ssl_new() -> *mut CassSsl; - pub fn cass_ssl_free(ssl: *mut CassSsl); - pub fn cass_ssl_add_trusted_cert(ssl: *mut CassSsl, - cert: *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_ssl_add_trusted_cert_n(ssl: *mut CassSsl, - cert: *const ::std::os::raw::c_char, - cert_length: size_t) -> CassError; - pub fn cass_ssl_set_verify_flags(ssl: *mut CassSsl, - flags: ::std::os::raw::c_int); - pub fn cass_ssl_set_cert(ssl: *mut CassSsl, - cert: *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_ssl_set_cert_n(ssl: *mut CassSsl, - cert: *const ::std::os::raw::c_char, - cert_length: size_t) -> CassError; - pub fn cass_ssl_set_private_key(ssl: *mut CassSsl, - key: *const ::std::os::raw::c_char, - password: *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_ssl_set_private_key_n(ssl: *mut CassSsl, - key: *const ::std::os::raw::c_char, - key_length: size_t, - password: *const ::std::os::raw::c_char, - password_length: size_t) -> CassError; - pub fn cass_authenticator_address(auth: *const CassAuthenticator, - address: *mut CassInet); - pub fn cass_authenticator_hostname(auth: *const CassAuthenticator, - length: *mut size_t) - -> *const ::std::os::raw::c_char; - pub fn cass_authenticator_class_name(auth: *const CassAuthenticator, - length: *mut size_t) - -> *const ::std::os::raw::c_char; - pub fn cass_authenticator_exchange_data(auth: *mut CassAuthenticator) - -> *mut ::std::os::raw::c_void; - pub fn cass_authenticator_set_exchange_data(auth: *mut CassAuthenticator, - exchange_data: - *mut ::std::os::raw::c_void); - pub fn cass_authenticator_response(auth: *mut CassAuthenticator, - size: size_t) - -> *mut ::std::os::raw::c_char; - pub fn cass_authenticator_set_response(auth: *mut CassAuthenticator, - response: - *const ::std::os::raw::c_char, - response_size: size_t); - pub fn cass_authenticator_set_error(auth: *mut CassAuthenticator, - message: - *const ::std::os::raw::c_char); - pub fn cass_authenticator_set_error_n(auth: *mut CassAuthenticator, - message: - *const ::std::os::raw::c_char, - message_length: size_t); - pub fn cass_future_free(future: *mut CassFuture); - pub fn cass_future_set_callback(future: *mut CassFuture, - callback: CassFutureCallback, - data: *mut ::std::os::raw::c_void) - -> CassError; +} +extern "C" { + + /// Gets the version of the schema metadata snapshot. + /// + /// @public @memberof CassSchemaMeta + /// + /// @param[in] schema_meta + /// + /// @return The snapshot version. + pub fn cass_schema_meta_snapshot_version(schema_meta: *const CassSchemaMeta) -> cass_uint32_t; +} +extern "C" { + + /// Gets the version of the connected Cassandra cluster. + /// + /// @public @memberof CassSchemaMeta + /// + /// @param[in] schema_meta + /// + /// @return Cassandra's version + pub fn cass_schema_meta_version(schema_meta: *const CassSchemaMeta) -> CassVersion; +} +extern "C" { + + /// Gets the keyspace metadata for the provided keyspace name. + /// + /// @public @memberof CassSchemaMeta + /// + /// @param[in] schema_meta + /// @param[in] keyspace + /// + /// @return The metadata for a keyspace. NULL if keyspace does not exist. + pub fn cass_schema_meta_keyspace_by_name(schema_meta: *const CassSchemaMeta, + keyspace: *const ::std::os::raw::c_char) + -> *const CassKeyspaceMeta; +} +extern "C" { + + /// Same as cass_schema_meta_keyspace_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassSchemaMeta + /// + /// @param[in] schema_meta + /// @param[in] keyspace + /// @param[in] keyspace_length + /// @return same as cass_schema_meta_keyspace_by_name() + /// + /// @see cass_schema_meta_keyspace_by_name() + pub fn cass_schema_meta_keyspace_by_name_n(schema_meta: *const CassSchemaMeta, + keyspace: *const ::std::os::raw::c_char, keyspace_length: usize) + -> *const CassKeyspaceMeta; +} +extern "C" { + + /// Gets the name of the keyspace. + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[out] name + /// @param[out] name_length + pub fn cass_keyspace_meta_name(keyspace_meta: *const CassKeyspaceMeta, name: *mut *const ::std::os::raw::c_char, + name_length: *mut usize); +} +extern "C" { + + /// Gets the table metadata for the provided table name. + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] table + /// + /// @return The metadata for a table. NULL if table does not exist. + pub fn cass_keyspace_meta_table_by_name(keyspace_meta: *const CassKeyspaceMeta, + table: *const ::std::os::raw::c_char) + -> *const CassTableMeta; +} +extern "C" { + + /// Same as cass_keyspace_meta_table_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] table + /// @param[in] table_length + /// @return same as cass_keyspace_meta_table_by_name() + /// + /// @see cass_keyspace_meta_table_by_name() + pub fn cass_keyspace_meta_table_by_name_n(keyspace_meta: *const CassKeyspaceMeta, + table: *const ::std::os::raw::c_char, table_length: usize) + -> *const CassTableMeta; +} +extern "C" { + + /// Gets the materialized view metadata for the provided view name. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] view + /// + /// @return The metadata for a view. NULL if view does not exist. + pub fn cass_keyspace_meta_materialized_view_by_name(keyspace_meta: *const CassKeyspaceMeta, + view: *const ::std::os::raw::c_char) + -> *const CassMaterializedViewMeta; +} +extern "C" { + + /// Same as cass_keyspace_meta_materialized_view_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] view + /// @param[in] view_length + /// @return same as cass_keyspace_meta_materialized_view_by_name() + /// + /// @see cass_keyspace_meta_materialized_view_by_name() + pub fn cass_keyspace_meta_materialized_view_by_name_n(keyspace_meta: *const CassKeyspaceMeta, + view: *const ::std::os::raw::c_char, view_length: usize) + -> *const CassMaterializedViewMeta; +} +extern "C" { + + /// Gets the data type for the provided type name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] type + /// + /// @return The data type for a user defined type. NULL if type does not exist. + pub fn cass_keyspace_meta_user_type_by_name(keyspace_meta: *const CassKeyspaceMeta, + type_: *const ::std::os::raw::c_char) + -> *const CassDataType; +} +extern "C" { + + /// Same as cass_keyspace_meta_type_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] type + /// @param[in] type_length + /// @return same as cass_keyspace_meta_type_by_name() + /// + /// @see cass_keyspace_meta_type_by_name() + pub fn cass_keyspace_meta_user_type_by_name_n(keyspace_meta: *const CassKeyspaceMeta, + type_: *const ::std::os::raw::c_char, type_length: usize) + -> *const CassDataType; +} +extern "C" { + + /// Gets the function metadata for the provided function name. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] name + /// @param[in] arguments A comma delimited list of CQL types (e.g "text,int,...") + /// describing the function's signature. + /// + /// @return The data function for a user defined function. NULL if function does not exist. + pub fn cass_keyspace_meta_function_by_name(keyspace_meta: *const CassKeyspaceMeta, + name: *const ::std::os::raw::c_char, + arguments: *const ::std::os::raw::c_char) + -> *const CassFunctionMeta; +} +extern "C" { + + /// Same as cass_keyspace_meta_function_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] name + /// @param[in] name_length + /// @param[in] arguments + /// @param[in] arguments_length + /// @return same as cass_keyspace_meta_function_by_name() + /// + /// @see cass_keyspace_meta_function_by_name() + pub fn cass_keyspace_meta_function_by_name_n(keyspace_meta: *const CassKeyspaceMeta, + name: *const ::std::os::raw::c_char, name_length: usize, + arguments: *const ::std::os::raw::c_char, arguments_length: usize) + -> *const CassFunctionMeta; +} +extern "C" { + + /// Gets the aggregate metadata for the provided aggregate name. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] name + /// @param[in] arguments A comma delimited list of CQL types (e.g "text,int,...") + /// describing the aggregate's signature. + /// + /// @return The data aggregate for a user defined aggregate. NULL if aggregate does not exist. + pub fn cass_keyspace_meta_aggregate_by_name(keyspace_meta: *const CassKeyspaceMeta, + name: *const ::std::os::raw::c_char, + arguments: *const ::std::os::raw::c_char) + -> *const CassAggregateMeta; +} +extern "C" { + + /// Same as cass_keyspace_meta_aggregate_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] name + /// @param[in] name_length + /// @param[in] arguments + /// @param[in] arguments_length + /// @return same as cass_keyspace_meta_aggregate_by_name() + /// + /// @see cass_keyspace_meta_aggregate_by_name() + pub fn cass_keyspace_meta_aggregate_by_name_n(keyspace_meta: *const CassKeyspaceMeta, + name: *const ::std::os::raw::c_char, name_length: usize, + arguments: *const ::std::os::raw::c_char, arguments_length: usize) + -> *const CassAggregateMeta; +} +extern "C" { + + /// Gets a metadata field for the provided name. Metadata fields allow direct + /// access to the column data found in the underlying "keyspaces" metadata table. + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] name + /// @return A metadata field value. NULL if the field does not exist. + pub fn cass_keyspace_meta_field_by_name(keyspace_meta: *const CassKeyspaceMeta, + name: *const ::std::os::raw::c_char) + -> *const CassValue; +} +extern "C" { + + /// Same as cass_keyspace_meta_field_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_keyspace_meta_field_by_name() + /// + /// @see cass_keyspace_meta_field_by_name() + pub fn cass_keyspace_meta_field_by_name_n(keyspace_meta: *const CassKeyspaceMeta, + name: *const ::std::os::raw::c_char, name_length: usize) + -> *const CassValue; +} +extern "C" { + + /// Gets the name of the table. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[out] name + /// @param[out] name_length + pub fn cass_table_meta_name(table_meta: *const CassTableMeta, name: *mut *const ::std::os::raw::c_char, + name_length: *mut usize); +} +extern "C" { + + /// Gets the column metadata for the provided column name. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] column + /// + /// @return The metadata for a column. NULL if column does not exist. + pub fn cass_table_meta_column_by_name(table_meta: *const CassTableMeta, column: *const ::std::os::raw::c_char) + -> *const CassColumnMeta; +} +extern "C" { + + /// Same as cass_table_meta_column_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] column + /// @param[in] column_length + /// @return same as cass_table_meta_column_by_name() + /// + /// @see cass_table_meta_column_by_name() + pub fn cass_table_meta_column_by_name_n(table_meta: *const CassTableMeta, column: *const ::std::os::raw::c_char, + column_length: usize) + -> *const CassColumnMeta; +} +extern "C" { + + /// Gets the total number of columns for the table. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @return The total column count. + pub fn cass_table_meta_column_count(table_meta: *const CassTableMeta) -> usize; +} +extern "C" { + + /// Gets the column metadata for the provided index. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] index + /// @return The metadata for a column. NULL returned if the index is out of range. + pub fn cass_table_meta_column(table_meta: *const CassTableMeta, index: usize) -> *const CassColumnMeta; +} +extern "C" { + + /// Gets the index metadata for the provided index name. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] index + /// + /// @return The metadata for a index. NULL if index does not exist. + pub fn cass_table_meta_index_by_name(table_meta: *const CassTableMeta, index: *const ::std::os::raw::c_char) + -> *const CassIndexMeta; +} +extern "C" { + + /// Same as cass_table_meta_index_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] index + /// @param[in] index_length + /// @return same as cass_table_meta_index_by_name() + /// + /// @see cass_table_meta_index_by_name() + pub fn cass_table_meta_index_by_name_n(table_meta: *const CassTableMeta, index: *const ::std::os::raw::c_char, + index_length: usize) + -> *const CassIndexMeta; +} +extern "C" { + + /// Gets the total number of indexes for the table. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @return The total index count. + pub fn cass_table_meta_index_count(table_meta: *const CassTableMeta) -> usize; +} +extern "C" { + + /// Gets the index metadata for the provided index. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] index + /// @return The metadata for a index. NULL returned if the index is out of range. + pub fn cass_table_meta_index(table_meta: *const CassTableMeta, index: usize) -> *const CassIndexMeta; +} +extern "C" { + + /// Gets the materialized view metadata for the provided view name. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] view + /// + /// @return The metadata for a view. NULL if view does not exist. + pub fn cass_table_meta_materialized_view_by_name(table_meta: *const CassTableMeta, + view: *const ::std::os::raw::c_char) + -> *const CassMaterializedViewMeta; +} +extern "C" { + + /// Same as cass_table_meta_materialized_view_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] view + /// @param[in] view_length + /// @return same as cass_table_meta_materialized_view_by_name() + /// + /// @see cass_table_meta_materialized_view_by_name() + pub fn cass_table_meta_materialized_view_by_name_n(table_meta: *const CassTableMeta, + view: *const ::std::os::raw::c_char, view_length: usize) + -> *const CassMaterializedViewMeta; +} +extern "C" { + + /// Gets the total number of views for the table. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @return The total view count. + pub fn cass_table_meta_materialized_view_count(table_meta: *const CassTableMeta) -> usize; +} +extern "C" { + + /// Gets the materialized view metadata for the provided index. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] index + /// @return The metadata for a view. NULL returned if the index is out of range. + pub fn cass_table_meta_materialized_view(table_meta: *const CassTableMeta, index: usize) + -> *const CassMaterializedViewMeta; +} +extern "C" { + + /// Gets the number of columns for the table's partition key. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @return The count for the number of columns in the partition key. + pub fn cass_table_meta_partition_key_count(table_meta: *const CassTableMeta) -> usize; +} +extern "C" { + + /// Gets the partition key column metadata for the provided index. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] index + /// @return The metadata for a column. NULL returned if the index is out of range. + /// + /// @see cass_table_meta_partition_key_count() + pub fn cass_table_meta_partition_key(table_meta: *const CassTableMeta, index: usize) -> *const CassColumnMeta; +} +extern "C" { + + /// Gets the number of columns for the table's clustering key. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @return The count for the number of columns in the clustering key. + pub fn cass_table_meta_clustering_key_count(table_meta: *const CassTableMeta) -> usize; +} +extern "C" { + + /// Gets the clustering key column metadata for the provided index. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] index + /// @return The metadata for a column. NULL returned if the index is out of range. + /// + /// @see cass_table_meta_clustering_key_count() + pub fn cass_table_meta_clustering_key(table_meta: *const CassTableMeta, index: usize) -> *const CassColumnMeta; +} +extern "C" { + + /// Gets the clustering order column metadata for the provided index. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] index + /// @return The clustering order for a column. + /// CASS_CLUSTERING_ORDER_NONE returned if the index is out of range. + /// + /// @see cass_table_meta_clustering_key_count() + pub fn cass_table_meta_clustering_key_order(table_meta: *const CassTableMeta, index: usize) -> CassClusteringOrder; +} +extern "C" { + + /// Gets a metadata field for the provided name. Metadata fields allow direct + /// access to the column data found in the underlying "tables" metadata table. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] name + /// @return A metadata field value. NULL if the field does not exist. + pub fn cass_table_meta_field_by_name(table_meta: *const CassTableMeta, name: *const ::std::os::raw::c_char) + -> *const CassValue; +} +extern "C" { + + /// Same as cass_table_meta_field_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_table_meta_field_by_name() + /// + /// @see cass_table_meta_field_by_name() + pub fn cass_table_meta_field_by_name_n(table_meta: *const CassTableMeta, name: *const ::std::os::raw::c_char, + name_length: usize) + -> *const CassValue; +} +extern "C" { + + /// Gets the column metadata for the provided column name. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @param[in] column + /// + /// @return The metadata for a column. NULL if column does not exist. + pub fn cass_materialized_view_meta_column_by_name(view_meta: *const CassMaterializedViewMeta, + column: *const ::std::os::raw::c_char) + -> *const CassColumnMeta; +} +extern "C" { + + /// Same as cass_materialized_view_meta_column_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @param[in] column + /// @param[in] column_length + /// @return same as cass_materialized_view_meta_column_by_name() + /// + /// @see cass_materialized_view_meta_column_by_name() + pub fn cass_materialized_view_meta_column_by_name_n(view_meta: *const CassMaterializedViewMeta, + column: *const ::std::os::raw::c_char, column_length: usize) + -> *const CassColumnMeta; +} +extern "C" { + + /// Gets the name of the view. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @param[out] name + /// @param[out] name_length + pub fn cass_materialized_view_meta_name(view_meta: *const CassMaterializedViewMeta, + name: *mut *const ::std::os::raw::c_char, name_length: *mut usize); +} +extern "C" { + + /// Gets the base table of the view. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// + /// @return The base table for the view. + pub fn cass_materialized_view_meta_base_table(view_meta: *const CassMaterializedViewMeta) -> *const CassTableMeta; +} +extern "C" { + + /// Gets the total number of columns for the view. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @return The total column count. + pub fn cass_materialized_view_meta_column_count(view_meta: *const CassMaterializedViewMeta) -> usize; +} +extern "C" { + + /// Gets the column metadata for the provided index. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @param[in] index + /// @return The metadata for a column. NULL returned if the index is out of range. + pub fn cass_materialized_view_meta_column(view_meta: *const CassMaterializedViewMeta, index: usize) + -> *const CassColumnMeta; +} +extern "C" { + + /// Gets the number of columns for the view's partition key. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @return The count for the number of columns in the partition key. + pub fn cass_materialized_view_meta_partition_key_count(view_meta: *const CassMaterializedViewMeta) -> usize; +} +extern "C" { + + /// Gets the partition key column metadata for the provided index. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @param[in] index + /// @return The metadata for a column. NULL returned if the index is out of range. + pub fn cass_materialized_view_meta_partition_key(view_meta: *const CassMaterializedViewMeta, index: usize) + -> *const CassColumnMeta; +} +extern "C" { + + /// Gets the number of columns for the view's clustering key. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @return The count for the number of columns in the clustering key. + pub fn cass_materialized_view_meta_clustering_key_count(view_meta: *const CassMaterializedViewMeta) -> usize; +} +extern "C" { + + /// Gets the clustering key column metadata for the provided index. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @param[in] index + /// @return The metadata for a column. NULL returned if the index is out of range. + pub fn cass_materialized_view_meta_clustering_key(view_meta: *const CassMaterializedViewMeta, index: usize) + -> *const CassColumnMeta; +} +extern "C" { + + /// Gets the clustering order column metadata for the provided index. + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @param[in] index + /// @return The clustering order for a column. + /// CASS_CLUSTERING_ORDER_NONE returned if the index is out of range. + /// + /// @see cass_materialized_view_meta_clustering_key_count() + pub fn cass_materialized_view_meta_clustering_key_order(view_meta: *const CassMaterializedViewMeta, index: usize) + -> CassClusteringOrder; +} +extern "C" { + + /// Gets a metadata field for the provided name. Metadata fields allow direct + /// access to the column data found in the underlying "views" metadata view. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @param[in] name + /// @return A metadata field value. NULL if the field does not exist. + pub fn cass_materialized_view_meta_field_by_name(view_meta: *const CassMaterializedViewMeta, + name: *const ::std::os::raw::c_char) + -> *const CassValue; +} +extern "C" { + + /// Same as cass_materialized_view_meta_field_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_materialized_view_meta_field_by_name() + /// + /// @see cass_materialized_view_meta_field_by_name() + pub fn cass_materialized_view_meta_field_by_name_n(view_meta: *const CassMaterializedViewMeta, + name: *const ::std::os::raw::c_char, name_length: usize) + -> *const CassValue; +} +extern "C" { + + /// Gets the name of the column. + /// + /// @public @memberof CassColumnMeta + /// + /// @param[in] column_meta + /// @param[out] name + /// @param[out] name_length + pub fn cass_column_meta_name(column_meta: *const CassColumnMeta, name: *mut *const ::std::os::raw::c_char, + name_length: *mut usize); +} +extern "C" { + + /// Gets the type of the column. + /// + /// @public @memberof CassColumnMeta + /// + /// @param[in] column_meta + /// @return The column's type. + pub fn cass_column_meta_type(column_meta: *const CassColumnMeta) -> CassColumnType; +} +extern "C" { + + /// Gets the data type of the column. + /// + /// @public @memberof CassColumnMeta + /// + /// @param[in] column_meta + /// @return The column's data type. + pub fn cass_column_meta_data_type(column_meta: *const CassColumnMeta) -> *const CassDataType; +} +extern "C" { + + /// Gets a metadata field for the provided name. Metadata fields allow direct + /// access to the column data found in the underlying "columns" metadata table. + /// + /// @public @memberof CassColumnMeta + /// + /// @param[in] column_meta + /// @param[in] name + /// @return A metadata field value. NULL if the field does not exist. + pub fn cass_column_meta_field_by_name(column_meta: *const CassColumnMeta, name: *const ::std::os::raw::c_char) + -> *const CassValue; +} +extern "C" { + + /// Same as cass_column_meta_field_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassColumnMeta + /// + /// @param[in] column_meta + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_column_meta_field_by_name() + /// + /// @see cass_column_meta_field_by_name() + pub fn cass_column_meta_field_by_name_n(column_meta: *const CassColumnMeta, name: *const ::std::os::raw::c_char, + name_length: usize) + -> *const CassValue; +} +extern "C" { + + /// Gets the name of the index. + /// + /// @public @memberof CassIndexMeta + /// + /// @param[in] index_meta + /// @param[out] name + /// @param[out] name_length + pub fn cass_index_meta_name(index_meta: *const CassIndexMeta, name: *mut *const ::std::os::raw::c_char, + name_length: *mut usize); +} +extern "C" { + + /// Gets the type of the index. + /// + /// @public @memberof CassIndexMeta + /// + /// @param[in] index_meta + /// @return The index's type. + pub fn cass_index_meta_type(index_meta: *const CassIndexMeta) -> CassIndexType; +} +extern "C" { + + /// Gets the target of the index. + /// + /// @public @memberof CassIndexMeta + /// + /// @param[in] index_meta + /// @param[out] target + /// @param[out] target_length + pub fn cass_index_meta_target(index_meta: *const CassIndexMeta, target: *mut *const ::std::os::raw::c_char, + target_length: *mut usize); +} +extern "C" { + + /// Gets the options of the index. + /// + /// @public @memberof CassIndexMeta + /// + /// @param[in] index_meta + /// @return The index's options. + pub fn cass_index_meta_options(index_meta: *const CassIndexMeta) -> *const CassValue; +} +extern "C" { + + /// Gets a metadata field for the provided name. Metadata fields allow direct + /// access to the index data found in the underlying "indexes" metadata table. + /// + /// @public @memberof CassIndexMeta + /// + /// @param[in] index_meta + /// @param[in] name + /// @return A metadata field value. NULL if the field does not exist. + pub fn cass_index_meta_field_by_name(index_meta: *const CassIndexMeta, name: *const ::std::os::raw::c_char) + -> *const CassValue; +} +extern "C" { + + /// Same as cass_index_meta_field_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassIndexMeta + /// + /// @param[in] index_meta + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_index_meta_field_by_name() + /// + /// @see cass_index_meta_field_by_name() + pub fn cass_index_meta_field_by_name_n(index_meta: *const CassIndexMeta, name: *const ::std::os::raw::c_char, + name_length: usize) + -> *const CassValue; +} +extern "C" { + + /// Gets the name of the function. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @param[out] name + /// @param[out] name_length + pub fn cass_function_meta_name(function_meta: *const CassFunctionMeta, name: *mut *const ::std::os::raw::c_char, + name_length: *mut usize); +} +extern "C" { + + /// Gets the full name of the function. The full name includes the + /// function's name and the function's signature: + /// "name(type1 type2.. typeN)". + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @param[out] full_name + /// @param[out] full_name_length + pub fn cass_function_meta_full_name(function_meta: *const CassFunctionMeta, + full_name: *mut *const ::std::os::raw::c_char, full_name_length: *mut usize); +} +extern "C" { + + /// Gets the body of the function. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @param[out] body + /// @param[out] body_length + pub fn cass_function_meta_body(function_meta: *const CassFunctionMeta, body: *mut *const ::std::os::raw::c_char, + body_length: *mut usize); +} +extern "C" { + + /// Gets the language of the function. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @param[out] language + /// @param[out] language_length + pub fn cass_function_meta_language(function_meta: *const CassFunctionMeta, + language: *mut *const ::std::os::raw::c_char, language_length: *mut usize); +} +extern "C" { + + /// Gets whether a function is called on "null". + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @return cass_true if a function is called on null, otherwise cass_false. + pub fn cass_function_meta_called_on_null_input(function_meta: *const CassFunctionMeta) -> cass_bool_t; +} +extern "C" { + + /// Gets the number of arguments this function takes. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @return The number of arguments. + pub fn cass_function_meta_argument_count(function_meta: *const CassFunctionMeta) -> usize; +} +extern "C" { + + /// Gets the function's argument name and type for the provided index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @param[in] index + /// @param[out] name + /// @param[out] name_length + /// @param[out] type + /// @return CASS_OK if successful, otherwise an error occurred + pub fn cass_function_meta_argument(function_meta: *const CassFunctionMeta, index: usize, + name: *mut *const ::std::os::raw::c_char, name_length: *mut usize, + type_: *mut *const CassDataType) + -> CassError; +} +extern "C" { + + /// Gets the function's argument and type for the provided name. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @param[in] name + /// @return A data type. NULL if the argument does not exist. + pub fn cass_function_meta_argument_type_by_name(function_meta: *const CassFunctionMeta, + name: *const ::std::os::raw::c_char) + -> *const CassDataType; +} +extern "C" { + + /// Same as cass_function_meta_argument_type_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_function_meta_argument_type_by_name() + /// + /// @see cass_function_meta_argument_type_by_name() + pub fn cass_function_meta_argument_type_by_name_n(function_meta: *const CassFunctionMeta, + name: *const ::std::os::raw::c_char, name_length: usize) + -> *const CassDataType; +} +extern "C" { + + /// Gets the return type of the function. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @return The data type returned by the function. + pub fn cass_function_meta_return_type(function_meta: *const CassFunctionMeta) -> *const CassDataType; +} +extern "C" { + + /// Gets a metadata field for the provided name. Metadata fields allow direct + /// access to the column data found in the underlying "functions" metadata table. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @param[in] name + /// @return A metadata field value. NULL if the field does not exist. + pub fn cass_function_meta_field_by_name(function_meta: *const CassFunctionMeta, + name: *const ::std::os::raw::c_char) + -> *const CassValue; +} +extern "C" { + + /// Same as cass_function_meta_field_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_function_meta_field_by_name() + /// + /// @see cass_function_meta_field_by_name() + pub fn cass_function_meta_field_by_name_n(function_meta: *const CassFunctionMeta, + name: *const ::std::os::raw::c_char, name_length: usize) + -> *const CassValue; +} +extern "C" { + + /// Gets the name of the aggregate. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @param[out] name + /// @param[out] name_length + pub fn cass_aggregate_meta_name(aggregate_meta: *const CassAggregateMeta, + name: *mut *const ::std::os::raw::c_char, name_length: *mut usize); +} +extern "C" { + + /// Gets the full name of the aggregate. The full name includes the + /// aggregate's name and the aggregate's signature: + /// "name(type1 type2.. typeN)". + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @param[out] full_name + /// @param[out] full_name_length + pub fn cass_aggregate_meta_full_name(aggregate_meta: *const CassAggregateMeta, + full_name: *mut *const ::std::os::raw::c_char, full_name_length: *mut usize); +} +extern "C" { + + /// Gets the number of arguments this aggregate takes. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @return The number of arguments. + pub fn cass_aggregate_meta_argument_count(aggregate_meta: *const CassAggregateMeta) -> usize; +} +extern "C" { + + /// Gets the aggregate's argument type for the provided index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @param[in] index + /// @return The data type for argument. NULL returned if the index is out of range. + pub fn cass_aggregate_meta_argument_type(aggregate_meta: *const CassAggregateMeta, index: usize) + -> *const CassDataType; +} +extern "C" { + + /// Gets the return type of the aggregate. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @return The data type returned by the aggregate. + pub fn cass_aggregate_meta_return_type(aggregate_meta: *const CassAggregateMeta) -> *const CassDataType; +} +extern "C" { + + /// Gets the state type of the aggregate. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @return The data type of the aggregate's state. + pub fn cass_aggregate_meta_state_type(aggregate_meta: *const CassAggregateMeta) -> *const CassDataType; +} +extern "C" { + + /// Gets the function metadata for the aggregate's state function. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @return The function metadata for the state function. + pub fn cass_aggregate_meta_state_func(aggregate_meta: *const CassAggregateMeta) -> *const CassFunctionMeta; +} +extern "C" { + + /// Gets the function metadata for the aggregates's final function. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @return The function metadata for the final function. + pub fn cass_aggregate_meta_final_func(aggregate_meta: *const CassAggregateMeta) -> *const CassFunctionMeta; +} +extern "C" { + + /// Gets the initial condition value for the aggregate. + /// + /// @cassandra{2.2+} + /// + /// Note: The value of the initial condition will always be + /// a "varchar" type for Cassandra 3.0+. + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @return The value of the initial condition. + pub fn cass_aggregate_meta_init_cond(aggregate_meta: *const CassAggregateMeta) -> *const CassValue; +} +extern "C" { + + /// Gets a metadata field for the provided name. Metadata fields allow direct + /// access to the column data found in the underlying "aggregates" metadata table. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @param[in] name + /// @return A metadata field value. NULL if the field does not exist. + pub fn cass_aggregate_meta_field_by_name(aggregate_meta: *const CassAggregateMeta, + name: *const ::std::os::raw::c_char) + -> *const CassValue; +} +extern "C" { + + /// Same as cass_aggregate_meta_field_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_aggregate_meta_field_by_name() + /// + /// @see cass_aggregate_meta_field_by_name() + pub fn cass_aggregate_meta_field_by_name_n(aggregate_meta: *const CassAggregateMeta, + name: *const ::std::os::raw::c_char, name_length: usize) + -> *const CassValue; +} +extern "C" { + + /// Creates a new SSL context. + /// + /// @public @memberof CassSsl + /// + /// @return Returns a SSL context that must be freed. + /// + /// @see cass_ssl_free() + pub fn cass_ssl_new() -> *mut CassSsl; +} +extern "C" { + + /// Frees a SSL context instance. + /// + /// @public @memberof CassSsl + /// + /// @param[in] ssl + pub fn cass_ssl_free(ssl: *mut CassSsl); +} +extern "C" { + + /// Adds a trusted certificate. This is used to verify + /// the peer's certificate. + /// + /// @public @memberof CassSsl + /// + /// @param[in] ssl + /// @param[in] cert PEM formatted certificate string + /// @return CASS_OK if successful, otherwise an error occurred + pub fn cass_ssl_add_trusted_cert(ssl: *mut CassSsl, cert: *const ::std::os::raw::c_char) -> CassError; +} +extern "C" { + + /// Same as cass_ssl_add_trusted_cert(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassSsl + /// + /// @param[in] ssl + /// @param[in] cert + /// @param[in] cert_length + /// @return same as cass_ssl_add_trusted_cert() + /// + /// @see cass_ssl_add_trusted_cert() + pub fn cass_ssl_add_trusted_cert_n(ssl: *mut CassSsl, cert: *const ::std::os::raw::c_char, cert_length: usize) + -> CassError; +} +extern "C" { + + /// Sets verification performed on the peer's certificate. + /// + /// CASS_SSL_VERIFY_NONE - No verification is performed + /// CASS_SSL_VERIFY_PEER_CERT - Certificate is present and valid + /// CASS_SSL_VERIFY_PEER_IDENTITY - IP address matches the certificate's + /// common name or one of its subject alternative names. This implies the + /// certificate is also present. + /// CASS_SSL_VERIFY_PEER_IDENTITY_DNS - Hostname matches the certificate's + /// common name or one of its subject alternative names. This implies the + /// certificate is also present. Hostname resolution must also be enabled. + /// + /// Default: CASS_SSL_VERIFY_PEER_CERT + /// + /// @public @memberof CassSsl + /// + /// @param[in] ssl + /// @param[in] flags + /// @return CASS_OK if successful, otherwise an error occurred + /// + /// @see cass_cluster_set_use_hostname_resolution() + pub fn cass_ssl_set_verify_flags(ssl: *mut CassSsl, flags: ::std::os::raw::c_int); +} +extern "C" { + + /// Set client-side certificate chain. This is used to authenticate + /// the client on the server-side. This should contain the entire + /// Certificate chain starting with the certificate itself. + /// + /// @public @memberof CassSsl + /// + /// @param[in] ssl + /// @param[in] cert PEM formatted certificate string + /// @return CASS_OK if successful, otherwise an error occurred + pub fn cass_ssl_set_cert(ssl: *mut CassSsl, cert: *const ::std::os::raw::c_char) -> CassError; +} +extern "C" { + + /// Same as cass_ssl_set_cert(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassSsl + /// + /// @param[in] ssl + /// @param[in] cert + /// @param[in] cert_length + /// @return same as cass_ssl_set_cert() + /// + /// @see cass_ssl_set_cert() + pub fn cass_ssl_set_cert_n(ssl: *mut CassSsl, cert: *const ::std::os::raw::c_char, cert_length: usize) + -> CassError; +} +extern "C" { + + /// Set client-side private key. This is used to authenticate + /// the client on the server-side. + /// + /// @public @memberof CassSsl + /// + /// @param[in] ssl + /// @param[in] key PEM formatted key string + /// @param[in] password used to decrypt key + /// @return CASS_OK if successful, otherwise an error occurred + pub fn cass_ssl_set_private_key(ssl: *mut CassSsl, key: *const ::std::os::raw::c_char, + password: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_ssl_set_private_key(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassSsl + /// + /// @param[in] ssl + /// @param[in] key + /// @param[in] key_length + /// @param[in] password + /// @param[in] password_length + /// @return same as cass_ssl_set_private_key() + /// + /// @see cass_ssl_set_private_key() + pub fn cass_ssl_set_private_key_n(ssl: *mut CassSsl, key: *const ::std::os::raw::c_char, key_length: usize, + password: *const ::std::os::raw::c_char, password_length: usize) + -> CassError; +} +extern "C" { + + /// Gets the IP address of the host being authenticated. + /// + /// @param[in] auth + /// @param[out] address + /// + /// @public @memberof CassAuthenticator + pub fn cass_authenticator_address(auth: *const CassAuthenticator, address: *mut CassInet); +} +extern "C" { + + /// Gets the hostname of the host being authenticated. + /// + /// @public @memberof CassAuthenticator + /// + /// @param[in] auth + /// @param[out] length + /// @return A null-terminated string. + pub fn cass_authenticator_hostname(auth: *const CassAuthenticator, length: *mut usize) + -> *const ::std::os::raw::c_char; +} +extern "C" { + + /// Gets the class name for the server-side IAuthentication implementation. + /// + /// @public @memberof CassAuthenticator + /// + /// @param[in] auth + /// @param[out] length + /// @return A null-terminated string. + pub fn cass_authenticator_class_name(auth: *const CassAuthenticator, length: *mut usize) + -> *const ::std::os::raw::c_char; +} +extern "C" { + + /// Gets the user data created during the authenticator exchange. This + /// is set using cass_authenticator_set_exchange_data(). + /// + /// @public @memberof CassAuthenticator + /// + /// @param[in] auth + /// @return User specified exchange data previously set by + /// cass_authenticator_set_exchange_data(). + /// + /// @see cass_authenticator_set_exchange_data() + pub fn cass_authenticator_exchange_data(auth: *mut CassAuthenticator) -> *mut ::std::os::raw::c_void; +} +extern "C" { + + /// Sets the user data to be used during the authenticator exchange. + /// + /// @public @memberof CassAuthenticator + /// + /// @param[in] auth + /// @param[in] exchange_data + /// + /// @see cass_authenticator_exchange_data() + pub fn cass_authenticator_set_exchange_data(auth: *mut CassAuthenticator, + exchange_data: *mut ::std::os::raw::c_void); +} +extern "C" { + + /// Gets a response token buffer of the provided size. + /// + /// @public @memberof CassAuthenticator + /// + /// @param[in] auth + /// @param[in] size + /// @return A buffer to copy the response token. + pub fn cass_authenticator_response(auth: *mut CassAuthenticator, size: usize) -> *mut ::std::os::raw::c_char; +} +extern "C" { + + /// Sets the response token. + /// + /// @public @memberof CassAuthenticator + /// + /// @param[in] auth + /// @param[in] response + /// @param[in] response_size + pub fn cass_authenticator_set_response(auth: *mut CassAuthenticator, response: *const ::std::os::raw::c_char, + response_size: usize); +} +extern "C" { + + /// Sets an error for the authenticator exchange. + /// + /// @public @memberof CassAuthenticator + /// + /// @param[in] auth + /// @param[in] message + pub fn cass_authenticator_set_error(auth: *mut CassAuthenticator, message: *const ::std::os::raw::c_char); +} +extern "C" { + + /// Same as cass_authenticator_set_error_n(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassAuthenticator + /// + /// @param[in] auth + /// @param[in] message + /// @param[in] message_length + /// + /// @see cass_authenticator_set_error() + pub fn cass_authenticator_set_error_n(auth: *mut CassAuthenticator, message: *const ::std::os::raw::c_char, + message_length: usize); +} +extern "C" { + + /// Frees a future instance. A future can be freed anytime. + /// + /// @public @memberof CassFuture + pub fn cass_future_free(future: *mut CassFuture); +} +extern "C" { + + /// Sets a callback that is called when a future is set + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @param[in] callback + /// @param[in] data + /// @return CASS_OK if successful, otherwise an error occurred + pub fn cass_future_set_callback(future: *mut CassFuture, callback: CassFutureCallback, + data: *mut ::std::os::raw::c_void) + -> CassError; +} +extern "C" { + + /// Gets the set status of the future. + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @return true if set pub fn cass_future_ready(future: *mut CassFuture) -> cass_bool_t; +} +extern "C" { + + /// Wait for the future to be set with either a result or error. + /// + /// Important: Do not wait in a future callback. Waiting in a future + /// callback will cause a deadlock. + /// + /// @public @memberof CassFuture + /// + /// @param[in] future pub fn cass_future_wait(future: *mut CassFuture); - pub fn cass_future_wait_timed(future: *mut CassFuture, - timeout_us: cass_duration_t) -> cass_bool_t; - pub fn cass_future_get_result(future: *mut CassFuture) - -> *const CassResult; - pub fn cass_future_get_error_result(future: *mut CassFuture) - -> *const CassErrorResult; - pub fn cass_future_get_prepared(future: *mut CassFuture) - -> *const CassPrepared; +} +extern "C" { + + /// Wait for the future to be set or timeout. + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @param[in] timeout_us wait time in microseconds + /// @return false if returned due to timeout + pub fn cass_future_wait_timed(future: *mut CassFuture, timeout_us: cass_duration_t) -> cass_bool_t; +} +extern "C" { + + /// Gets the result of a successful future. If the future is not ready this method will + /// wait for the future to be set. + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @return CassResult instance if successful, otherwise NULL for error. The return instance + /// must be freed using cass_result_free(). + /// + /// @see cass_session_execute() and cass_session_execute_batch() + pub fn cass_future_get_result(future: *mut CassFuture) -> *const CassResult; +} +extern "C" { + + /// Gets the error result from a future that failed as a result of a server error. If the + /// future is not ready this method will wait for the future to be set. + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @return CassErrorResult instance if the request failed with a server error, + /// otherwise NULL if the request was successful or the failure was not caused by + /// a server error. The return instance must be freed using cass_error_result_free(). + /// + /// @see cass_session_execute() and cass_session_execute_batch() + pub fn cass_future_get_error_result(future: *mut CassFuture) -> *const CassErrorResult; +} +extern "C" { + + /// Gets the result of a successful future. If the future is not ready this method will + /// wait for the future to be set. The first successful call consumes the future, all + /// subsequent calls will return NULL. + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @return CassPrepared instance if successful, otherwise NULL for error. The return instance + /// must be freed using cass_prepared_free(). + /// + /// @see cass_session_prepare() + pub fn cass_future_get_prepared(future: *mut CassFuture) -> *const CassPrepared; +} +extern "C" { + + /// Gets the error code from future. If the future is not ready this method will + /// wait for the future to be set. + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @return CASS_OK if successful, otherwise an error occurred. + /// + /// @see cass_error_desc() pub fn cass_future_error_code(future: *mut CassFuture) -> CassError; - pub fn cass_future_error_message(future: *mut CassFuture, - message: - *mut *const ::std::os::raw::c_char, - message_length: *mut size_t); - pub fn cass_future_custom_payload_item_count(future: *mut CassFuture) - -> size_t; - pub fn cass_future_custom_payload_item(future: *mut CassFuture, - index: size_t, - name: - *mut *const ::std::os::raw::c_char, - name_length: *mut size_t, - value: *mut *const cass_byte_t, - value_size: *mut size_t) - -> CassError; - pub fn cass_statement_new(query: *const ::std::os::raw::c_char, - parameter_count: size_t) -> *mut CassStatement; - pub fn cass_statement_new_n(query: *const ::std::os::raw::c_char, - query_length: size_t, parameter_count: size_t) - -> *mut CassStatement; - pub fn cass_statement_reset_parameters(statement: *mut CassStatement, - count: size_t) -> CassError; +} +extern "C" { + + /// Gets the error message from future. If the future is not ready this method will + /// wait for the future to be set. + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @param[out] message Empty string returned if successful, otherwise + /// a message describing the error is returned. + /// @param[out] message_length + pub fn cass_future_error_message(future: *mut CassFuture, message: *mut *const ::std::os::raw::c_char, + message_length: *mut usize); +} +extern "C" { + + /// Gets a the number of custom payload items from a response future. If the future is not + /// ready this method will wait for the future to be set. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @return the number of custom payload items. + pub fn cass_future_custom_payload_item_count(future: *mut CassFuture) -> usize; +} +extern "C" { + + /// Gets a custom payload item from a response future at the specified index. If the future is not + /// ready this method will wait for the future to be set. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFuture + /// + /// @param[in] future + /// @param[in] index + /// @param[out] name + /// @param[out] name_length + /// @param[out] value + /// @param[out] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_future_custom_payload_item(future: *mut CassFuture, index: usize, + name: *mut *const ::std::os::raw::c_char, name_length: *mut usize, + value: *mut *const cass_byte_t, value_size: *mut usize) + -> CassError; +} +extern "C" { + + /// Creates a new query statement. + /// + /// @public @memberof CassStatement + /// + /// @param[in] query The query is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] parameter_count The number of bound parameters. + /// @return Returns a statement that must be freed. + /// + /// @see cass_statement_free() + pub fn cass_statement_new(query: *const ::std::os::raw::c_char, parameter_count: usize) -> *mut CassStatement; +} +extern "C" { + + /// Same as cass_statement_new(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] query + /// @param[in] query_length + /// @param[in] parameter_count + /// @return same as cass_statement_new() + /// + /// @see cass_statement_new() + pub fn cass_statement_new_n(query: *const ::std::os::raw::c_char, query_length: usize, parameter_count: usize) + -> *mut CassStatement; +} +extern "C" { + + /// Clear and/or resize the statement's parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] count + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_reset_parameters(statement: *mut CassStatement, count: usize) -> CassError; +} +extern "C" { + + /// Frees a statement instance. Statements can be immediately freed after + /// being prepared, executed or added to a batch. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement pub fn cass_statement_free(statement: *mut CassStatement); - pub fn cass_statement_add_key_index(statement: *mut CassStatement, - index: size_t) -> CassError; - pub fn cass_statement_set_keyspace(statement: *mut CassStatement, - keyspace: - *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_statement_set_keyspace_n(statement: *mut CassStatement, - keyspace: - *const ::std::os::raw::c_char, - keyspace_length: size_t) - -> CassError; - pub fn cass_statement_set_consistency(statement: *mut CassStatement, - consistency: CassConsistency) - -> CassError; - pub fn cass_statement_set_serial_consistency(statement: - *mut CassStatement, - serial_consistency: - CassConsistency) - -> CassError; - pub fn cass_statement_set_paging_size(statement: *mut CassStatement, - page_size: ::std::os::raw::c_int) - -> CassError; - pub fn cass_statement_set_paging_state(statement: *mut CassStatement, - result: *const CassResult) - -> CassError; - pub fn cass_statement_set_paging_state_token(statement: - *mut CassStatement, - paging_state: - *const ::std::os::raw::c_char, - paging_state_size: size_t) - -> CassError; - pub fn cass_statement_set_timestamp(statement: *mut CassStatement, - timestamp: cass_int64_t) -> CassError; - pub fn cass_statement_set_request_timeout(statement: *mut CassStatement, - timeout_ms: cass_uint64_t) - -> CassError; - pub fn cass_statement_set_retry_policy(statement: *mut CassStatement, - retry_policy: *mut CassRetryPolicy) - -> CassError; - pub fn cass_statement_set_custom_payload(statement: *mut CassStatement, - payload: - *const CassCustomPayload) - -> CassError; - pub fn cass_statement_bind_null(statement: *mut CassStatement, - index: size_t) -> CassError; - pub fn cass_statement_bind_null_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_statement_bind_null_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> CassError; - pub fn cass_statement_bind_int8(statement: *mut CassStatement, - index: size_t, value: cass_int8_t) - -> CassError; - pub fn cass_statement_bind_int8_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - value: cass_int8_t) -> CassError; - pub fn cass_statement_bind_int8_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_int8_t) - -> CassError; - pub fn cass_statement_bind_int16(statement: *mut CassStatement, - index: size_t, value: cass_int16_t) - -> CassError; - pub fn cass_statement_bind_int16_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, +} +extern "C" { + + /// Adds a key index specifier to this a statement. + /// When using token-aware routing, this can be used to tell the driver which + /// parameters within a non-prepared, parameterized statement are part of + /// the partition key. + /// + /// Use consecutive calls for composite partition keys. + /// + /// This is not necessary for prepared statements, as the key + /// parameters are determined in the metadata processed in the prepare phase. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_add_key_index(statement: *mut CassStatement, index: usize) -> CassError; +} +extern "C" { + + /// Sets the statement's keyspace for use with token-aware routing. + /// + /// This is not necessary for prepared statements, as the keyspace + /// is determined in the metadata processed in the prepare phase. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] keyspace + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_set_keyspace(statement: *mut CassStatement, keyspace: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_set_keyspace(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] keyspace + /// @param[in] keyspace_length + /// @return same as cass_statement_set_keyspace() + /// + /// @see cass_statement_set_keyspace() + pub fn cass_statement_set_keyspace_n(statement: *mut CassStatement, keyspace: *const ::std::os::raw::c_char, + keyspace_length: usize) + -> CassError; +} +extern "C" { + + /// Sets the statement's consistency level. + /// + /// Default: CASS_CONSISTENCY_LOCAL_ONE + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] consistency + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_set_consistency(statement: *mut CassStatement, consistency: CassConsistency) -> CassError; +} +extern "C" { + + /// Sets the statement's serial consistency level. + /// + /// @cassandra{2.0+} + /// + /// Default: Not set + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] serial_consistency + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_set_serial_consistency(statement: *mut CassStatement, serial_consistency: CassConsistency) + -> CassError; +} +extern "C" { + + /// Sets the statement's page size. + /// + /// @cassandra{2.0+} + /// + /// Default: -1 (Disabled) + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] page_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_set_paging_size(statement: *mut CassStatement, page_size: ::std::os::raw::c_int) + -> CassError; +} +extern "C" { + + /// Sets the statement's paging state. This can be used to get the next page of + /// data in a multi-page query. + /// + /// @cassandra{2.0+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] result + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_set_paging_state(statement: *mut CassStatement, result: *const CassResult) -> CassError; +} +extern "C" { + + /// Sets the statement's paging state. This can be used to get the next page of + /// data in a multi-page query. + /// + /// @cassandra{2.0+} + /// + /// Warning: The paging state should not be exposed to or come from + /// untrusted environments. The paging state could be spoofed and potentially + /// used to gain access to other data. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] paging_state + /// @param[in] paging_state_size + /// @return CASS_OK if successful, otherwise an error occurred. + /// + /// @see cass_result_paging_state_token() + pub fn cass_statement_set_paging_state_token(statement: *mut CassStatement, + paging_state: *const ::std::os::raw::c_char, + paging_state_size: usize) + -> CassError; +} +extern "C" { + + /// Sets the statement's timestamp. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] timestamp + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_set_timestamp(statement: *mut CassStatement, timestamp: cass_int64_t) -> CassError; +} +extern "C" { + + /// Sets the statement's timeout for waiting for a response from a node. + /// + /// Default: Disabled (use the cluster-level request timeout) + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] timeout_ms Request timeout in milliseconds. Use 0 for no timeout + /// or CASS_UINT64_MAX to disable (to use the cluster-level request timeout). + /// @return CASS_OK if successful, otherwise an error occurred. + /// + /// @see cass_cluster_set_request_timeout() + pub fn cass_statement_set_request_timeout(statement: *mut CassStatement, timeout_ms: cass_uint64_t) -> CassError; +} +extern "C" { + + /// Sets the statement's retry policy. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] retry_policy + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_set_retry_policy(statement: *mut CassStatement, retry_policy: *mut CassRetryPolicy) + -> CassError; +} +extern "C" { + + /// Sets the statement's custom payload. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] payload + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_set_custom_payload(statement: *mut CassStatement, payload: *const CassCustomPayload) + -> CassError; +} +extern "C" { + + /// Binds null to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_null(statement: *mut CassStatement, index: usize) -> CassError; +} +extern "C" { + + /// Binds a null to all the values with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_null_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_null_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_statement_bind_null_by_name() + /// + /// @see cass_statement_bind_null_by_name() + pub fn cass_statement_bind_null_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize) + -> CassError; +} +extern "C" { + + /// Binds a "tinyint" to a query or bound statement at the specified index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_int8(statement: *mut CassStatement, index: usize, value: cass_int8_t) -> CassError; +} +extern "C" { + + /// Binds a "tinyint" to all the values with the specified name. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_int8_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + value: cass_int8_t) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_int8_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_int8_by_name() + /// + /// @see cass_statement_bind_int8_by_name() + pub fn cass_statement_bind_int8_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_int8_t) + -> CassError; +} +extern "C" { + + /// Binds an "smallint" to a query or bound statement at the specified index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_int16(statement: *mut CassStatement, index: usize, value: cass_int16_t) -> CassError; +} +extern "C" { + + /// Binds an "smallint" to all the values with the specified name. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_int16_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, value: cass_int16_t) - -> CassError; - pub fn cass_statement_bind_int16_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_int16_t) - -> CassError; - pub fn cass_statement_bind_int32(statement: *mut CassStatement, - index: size_t, value: cass_int32_t) - -> CassError; - pub fn cass_statement_bind_int32_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_int16_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_int16_by_name() + /// + /// @see cass_statement_bind_int16_by_name() + pub fn cass_statement_bind_int16_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_int16_t) + -> CassError; +} +extern "C" { + + /// Binds an "int" to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_int32(statement: *mut CassStatement, index: usize, value: cass_int32_t) -> CassError; +} +extern "C" { + + /// Binds an "int" to all the values with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_int32_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, value: cass_int32_t) - -> CassError; - pub fn cass_statement_bind_int32_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_int32_t) - -> CassError; - pub fn cass_statement_bind_uint32(statement: *mut CassStatement, - index: size_t, value: cass_uint32_t) - -> CassError; - pub fn cass_statement_bind_uint32_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_int32_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_int32_by_name() + /// + /// @see cass_statement_bind_int32_by_name() + pub fn cass_statement_bind_int32_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_int32_t) + -> CassError; +} +extern "C" { + + /// Binds a "date" to a query or bound statement at the specified index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_uint32(statement: *mut CassStatement, index: usize, value: cass_uint32_t) -> CassError; +} +extern "C" { + + /// Binds a "date" to all the values with the specified name. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_uint32_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, value: cass_uint32_t) - -> CassError; - pub fn cass_statement_bind_uint32_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_uint32_t) - -> CassError; - pub fn cass_statement_bind_int64(statement: *mut CassStatement, - index: size_t, value: cass_int64_t) - -> CassError; - pub fn cass_statement_bind_int64_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_uint32_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_uint32_by_name() + /// + /// @see cass_statement_bind_uint32_by_name() + pub fn cass_statement_bind_uint32_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_uint32_t) + -> CassError; +} +extern "C" { + + /// Binds a "bigint", "counter", "timestamp" or "time" to a query or + /// bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_int64(statement: *mut CassStatement, index: usize, value: cass_int64_t) -> CassError; +} +extern "C" { + + /// Binds a "bigint", "counter", "timestamp" or "time" to all values + /// with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_int64_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, value: cass_int64_t) - -> CassError; - pub fn cass_statement_bind_int64_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_int64_t) - -> CassError; - pub fn cass_statement_bind_float(statement: *mut CassStatement, - index: size_t, value: cass_float_t) - -> CassError; - pub fn cass_statement_bind_float_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_int64_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_int64_by_name(0 + /// + /// @see cass_statement_bind_int64_by_name() + pub fn cass_statement_bind_int64_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_int64_t) + -> CassError; +} +extern "C" { + + /// Binds a "float" to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_float(statement: *mut CassStatement, index: usize, value: cass_float_t) -> CassError; +} +extern "C" { + + /// Binds a "float" to all the values with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_float_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, value: cass_float_t) - -> CassError; - pub fn cass_statement_bind_float_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_float_t) - -> CassError; - pub fn cass_statement_bind_double(statement: *mut CassStatement, - index: size_t, value: cass_double_t) - -> CassError; - pub fn cass_statement_bind_double_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_float_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_float_by_name() + /// + /// @see cass_statement_bind_float_by_name() + pub fn cass_statement_bind_float_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_float_t) + -> CassError; +} +extern "C" { + + /// Binds a "double" to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_double(statement: *mut CassStatement, index: usize, value: cass_double_t) -> CassError; +} +extern "C" { + + /// Binds a "double" to all the values with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_double_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, value: cass_double_t) - -> CassError; - pub fn cass_statement_bind_double_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_double_t) - -> CassError; - pub fn cass_statement_bind_bool(statement: *mut CassStatement, - index: size_t, value: cass_bool_t) - -> CassError; - pub fn cass_statement_bind_bool_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - value: cass_bool_t) -> CassError; - pub fn cass_statement_bind_bool_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_bool_t) - -> CassError; - pub fn cass_statement_bind_string(statement: *mut CassStatement, - index: size_t, + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_double_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_double_by_name() + /// + /// @see cass_statement_bind_double_by_name() + pub fn cass_statement_bind_double_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_double_t) + -> CassError; +} +extern "C" { + + /// Binds a "boolean" to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_bool(statement: *mut CassStatement, index: usize, value: cass_bool_t) -> CassError; +} +extern "C" { + + /// Binds a "boolean" to all the values with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_bool_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + value: cass_bool_t) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_bool_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_bool_by_name() + /// + /// @see cass_statement_bind_bool_by_name() + pub fn cass_statement_bind_bool_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_bool_t) + -> CassError; +} +extern "C" { + + /// Binds an "ascii", "text" or "varchar" to a query or bound statement + /// at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value The value is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_string(statement: *mut CassStatement, index: usize, value: *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_statement_bind_string_n(statement: *mut CassStatement, - index: size_t, - value: *const ::std::os::raw::c_char, - value_length: size_t) -> CassError; - pub fn cass_statement_bind_string_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - value: - *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_statement_bind_string_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: - *const ::std::os::raw::c_char, - value_length: size_t) - -> CassError; - pub fn cass_statement_bind_bytes(statement: *mut CassStatement, - index: size_t, value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_statement_bind_bytes_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_statement_bind_bytes_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: *const cass_byte_t, - value_size: size_t) - -> CassError; - pub fn cass_statement_bind_custom(statement: *mut CassStatement, - index: size_t, - class_name: - *const ::std::os::raw::c_char, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_statement_bind_custom_n(statement: *mut CassStatement, - index: size_t, - class_name: - *const ::std::os::raw::c_char, - class_name_length: size_t, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_statement_bind_custom_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - class_name: - *const ::std::os::raw::c_char, - value: *const cass_byte_t, - value_size: size_t) - -> CassError; - pub fn cass_statement_bind_custom_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - class_name: - *const ::std::os::raw::c_char, - class_name_length: size_t, - value: *const cass_byte_t, - value_size: size_t) - -> CassError; - pub fn cass_statement_bind_uuid(statement: *mut CassStatement, - index: size_t, value: CassUuid) - -> CassError; - pub fn cass_statement_bind_uuid_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - value: CassUuid) -> CassError; - pub fn cass_statement_bind_uuid_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: CassUuid) -> CassError; - pub fn cass_statement_bind_inet(statement: *mut CassStatement, - index: size_t, value: CassInet) - -> CassError; - pub fn cass_statement_bind_inet_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - value: CassInet) -> CassError; - pub fn cass_statement_bind_inet_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: CassInet) -> CassError; - pub fn cass_statement_bind_decimal(statement: *mut CassStatement, - index: size_t, - varint: *const cass_byte_t, - varint_size: size_t, - scale: cass_int32_t) -> CassError; - pub fn cass_statement_bind_decimal_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - varint: *const cass_byte_t, - varint_size: size_t, - scale: cass_int32_t) - -> CassError; - pub fn cass_statement_bind_decimal_by_name_n(statement: - *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - varint: *const cass_byte_t, - varint_size: size_t, + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_string(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @param[in] value_length + /// @return same as cass_statement_bind_string() + /// + /// @see cass_statement_bind_string() + pub fn cass_statement_bind_string_n(statement: *mut CassStatement, index: usize, + value: *const ::std::os::raw::c_char, value_length: usize) + -> CassError; +} +extern "C" { + + /// Binds an "ascii", "text" or "varchar" to all the values + /// with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value The value is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_string_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + value: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_string_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @param[in] value_length + /// @return same as cass_statement_bind_string_by_name() + /// + /// @see cass_statement_bind_string_by_name() + pub fn cass_statement_bind_string_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: *const ::std::os::raw::c_char, + value_length: usize) + -> CassError; +} +extern "C" { + + /// Binds a "blob", "varint" or "custom" to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value The value is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_bytes(statement: *mut CassStatement, index: usize, value: *const cass_byte_t, + value_size: usize) + -> CassError; +} +extern "C" { + + /// Binds a "blob", "varint" or "custom" to all the values with the + /// specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value The value is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_bytes_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_bytes_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @param[in] value_size + /// @return same as cass_statement_bind_bytes_by_name() + /// + /// @see cass_statement_bind_bytes_by_name() + pub fn cass_statement_bind_bytes_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Binds a "custom" to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] class_name + /// @param[in] value The value is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_custom(statement: *mut CassStatement, index: usize, + class_name: *const ::std::os::raw::c_char, value: *const cass_byte_t, + value_size: usize) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_custom(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] class_name + /// @param[in] class_name_length + /// @param[in] value The value is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_custom_n(statement: *mut CassStatement, index: usize, + class_name: *const ::std::os::raw::c_char, class_name_length: usize, + value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Binds a "custom" to all the values with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] class_name + /// @param[in] value The value is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_custom_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + class_name: *const ::std::os::raw::c_char, value: *const cass_byte_t, + value_size: usize) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_custom_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] class_name + /// @param[in] class_name_length + /// @param[in] value + /// @param[in] value_size + /// @return same as cass_statement_bind_custom_by_name() + /// + /// @see cass_statement_bind_custom_by_name() + pub fn cass_statement_bind_custom_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, class_name: *const ::std::os::raw::c_char, + class_name_length: usize, value: *const cass_byte_t, + value_size: usize) + -> CassError; +} +extern "C" { + + /// Binds a "uuid" or "timeuuid" to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_uuid(statement: *mut CassStatement, index: usize, value: CassUuid) -> CassError; +} +extern "C" { + + /// Binds a "uuid" or "timeuuid" to all the values + /// with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_uuid_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + value: CassUuid) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_uuid_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_uuid_by_name() + /// + /// @see cass_statement_bind_uuid_by_name() + pub fn cass_statement_bind_uuid_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: CassUuid) + -> CassError; +} +extern "C" { + + /// Binds an "inet" to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_inet(statement: *mut CassStatement, index: usize, value: CassInet) -> CassError; +} +extern "C" { + + /// Binds an "inet" to all the values with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_inet_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + value: CassInet) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_inet_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_statement_bind_inet_by_name() + /// + /// @see cass_statement_bind_inet_by_name() + pub fn cass_statement_bind_inet_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, value: CassInet) + -> CassError; +} +extern "C" { + + /// Bind a "decimal" to a query or bound statement at the specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] varint The value is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] varint_size + /// @param[in] scale + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_decimal(statement: *mut CassStatement, index: usize, varint: *const cass_byte_t, + varint_size: usize, scale: cass_int32_t) + -> CassError; +} +extern "C" { + + /// Binds a "decimal" to all the values with the specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] varint The value is copied into the statement object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] varint_size + /// @param[in] scale + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_decimal_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + varint: *const cass_byte_t, varint_size: usize, scale: cass_int32_t) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_decimal_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] varint + /// @param[in] varint_size + /// @param[in] scale + /// @return same as cass_statement_bind_decimal_by_name() + /// + /// @see cass_statement_bind_decimal_by_name() + pub fn cass_statement_bind_decimal_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, varint: *const cass_byte_t, varint_size: usize, scale: cass_int32_t) - -> CassError; - pub fn cass_statement_bind_collection(statement: *mut CassStatement, - index: size_t, + -> CassError; +} +extern "C" { + + /// Bind a "list", "map" or "set" to a query or bound statement at the + /// specified index. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] collection The collection can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_collection(statement: *mut CassStatement, index: usize, collection: *const CassCollection) - -> CassError; - pub fn cass_statement_bind_collection_by_name(statement: - *mut CassStatement, - name: - *const ::std::os::raw::c_char, - collection: - *const CassCollection) - -> CassError; - pub fn cass_statement_bind_collection_by_name_n(statement: - *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - collection: - *const CassCollection) - -> CassError; - pub fn cass_statement_bind_tuple(statement: *mut CassStatement, - index: size_t, tuple: *const CassTuple) - -> CassError; - pub fn cass_statement_bind_tuple_by_name(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Bind a "list", "map" or "set" to all the values with the + /// specified name. + /// + /// This can only be used with statements created by + /// cass_prepared_bind() when using Cassandra 2.0 or earlier. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] collection The collection can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_collection_by_name(statement: *mut CassStatement, + name: *const ::std::os::raw::c_char, + collection: *const CassCollection) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_collection_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] collection + /// @return same as cass_statement_bind_collection_by_name() + /// + /// @see cass_statement_bind_collection_by_name() + pub fn cass_statement_bind_collection_by_name_n(statement: *mut CassStatement, + name: *const ::std::os::raw::c_char, name_length: usize, + collection: *const CassCollection) + -> CassError; +} +extern "C" { + + /// Bind a "tuple" to a query or bound statement at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] tuple The tuple can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_tuple(statement: *mut CassStatement, index: usize, tuple: *const CassTuple) + -> CassError; +} +extern "C" { + + /// Bind a "tuple" to all the values with the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] tuple The tuple can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_tuple_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, tuple: *const CassTuple) - -> CassError; - pub fn cass_statement_bind_tuple_by_name_n(statement: *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - tuple: *const CassTuple) - -> CassError; - pub fn cass_statement_bind_user_type(statement: *mut CassStatement, - index: size_t, - user_type: *const CassUserType) - -> CassError; - pub fn cass_statement_bind_user_type_by_name(statement: - *mut CassStatement, - name: - *const ::std::os::raw::c_char, - user_type: - *const CassUserType) - -> CassError; - pub fn cass_statement_bind_user_type_by_name_n(statement: - *mut CassStatement, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - user_type: - *const CassUserType) - -> CassError; + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_tuple_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] tuple + /// @return same as cass_statement_bind_tuple_by_name() + /// + /// @see cass_statement_bind_tuple_by_name() + pub fn cass_statement_bind_tuple_by_name_n(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + name_length: usize, tuple: *const CassTuple) + -> CassError; +} +extern "C" { + + /// Bind a user defined type to a query or bound statement at the + /// specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] index + /// @param[in] user_type The user type can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_user_type(statement: *mut CassStatement, index: usize, user_type: *const CassUserType) + -> CassError; +} +extern "C" { + + /// Bind a user defined type to a query or bound statement with the + /// specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] user_type The user type can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_statement_bind_user_type_by_name(statement: *mut CassStatement, name: *const ::std::os::raw::c_char, + user_type: *const CassUserType) + -> CassError; +} +extern "C" { + + /// Same as cass_statement_bind_user_type_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassStatement + /// + /// @param[in] statement + /// @param[in] name + /// @param[in] name_length + /// @param[in] user_type + /// @return same as cass_statement_bind_user_type_by_name() + /// + /// @see cass_statement_bind_collection_by_name() + pub fn cass_statement_bind_user_type_by_name_n(statement: *mut CassStatement, + name: *const ::std::os::raw::c_char, name_length: usize, + user_type: *const CassUserType) + -> CassError; +} +extern "C" { + + /// Frees a prepared instance. + /// + /// @public @memberof CassPrepared + /// + /// @param[in] prepared pub fn cass_prepared_free(prepared: *const CassPrepared); - pub fn cass_prepared_bind(prepared: *const CassPrepared) - -> *mut CassStatement; - pub fn cass_prepared_parameter_name(prepared: *const CassPrepared, - index: size_t, - name: - *mut *const ::std::os::raw::c_char, - name_length: *mut size_t) - -> CassError; - pub fn cass_prepared_parameter_data_type(prepared: *const CassPrepared, - index: size_t) - -> *const CassDataType; - pub fn cass_prepared_parameter_data_type_by_name(prepared: - *const CassPrepared, - name: - *const ::std::os::raw::c_char) - -> *const CassDataType; - pub fn cass_prepared_parameter_data_type_by_name_n(prepared: - *const CassPrepared, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassDataType; +} +extern "C" { + + /// Creates a bound statement from a pre-prepared statement. + /// + /// @public @memberof CassPrepared + /// + /// @param[in] prepared + /// @return Returns a bound statement that must be freed. + /// + /// @see cass_statement_free() + pub fn cass_prepared_bind(prepared: *const CassPrepared) -> *mut CassStatement; +} +extern "C" { + + /// Gets the name of a parameter at the specified index. + /// + /// @public @memberof CassPrepared + /// + /// @param[in] prepared + /// @param[in] index + /// @param[out] name + /// @param[out] name_length + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_prepared_parameter_name(prepared: *const CassPrepared, index: usize, + name: *mut *const ::std::os::raw::c_char, name_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Gets the data type of a parameter at the specified index. + /// + /// @public @memberof CassPrepared + /// + /// @param[in] prepared + /// @param[in] index + /// @return Returns a reference to the data type of the parameter. Do not free + /// this reference as it is bound to the lifetime of the prepared. + pub fn cass_prepared_parameter_data_type(prepared: *const CassPrepared, index: usize) -> *const CassDataType; +} +extern "C" { + + /// Gets the data type of a parameter for the specified name. + /// + /// @public @memberof CassPrepared + /// + /// @param[in] prepared + /// @param[in] name + /// @return Returns a reference to the data type of the parameter. Do not free + /// this reference as it is bound to the lifetime of the prepared. + pub fn cass_prepared_parameter_data_type_by_name(prepared: *const CassPrepared, + name: *const ::std::os::raw::c_char) + -> *const CassDataType; +} +extern "C" { + + /// Same as cass_prepared_parameter_data_type_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassPrepared + /// + /// @param[in] prepared + /// @param[in] name + /// @param[in] name_length + /// @return Returns a reference to the data type of the parameter. Do not free + /// this reference as it is bound to the lifetime of the prepared. + /// + /// @see cass_prepared_parameter_data_type_by_name() + pub fn cass_prepared_parameter_data_type_by_name_n(prepared: *const CassPrepared, + name: *const ::std::os::raw::c_char, name_length: usize) + -> *const CassDataType; +} +extern "C" { + + /// Creates a new batch statement with batch type. + /// + /// @cassandra{2.0+} + /// + /// @public @memberof CassBatch + /// + /// @param[in] type + /// @return Returns a batch statement that must be freed. + /// + /// @see cass_batch_free() pub fn cass_batch_new(type_: CassBatchType) -> *mut CassBatch; +} +extern "C" { + + /// Frees a batch instance. Batches can be immediately freed after being + /// executed. + /// + /// @cassandra{2.0+} + /// + /// @public @memberof CassBatch + /// + /// @param[in] batch pub fn cass_batch_free(batch: *mut CassBatch); - pub fn cass_batch_set_consistency(batch: *mut CassBatch, - consistency: CassConsistency) - -> CassError; - pub fn cass_batch_set_serial_consistency(batch: *mut CassBatch, - serial_consistency: - CassConsistency) - -> CassError; - pub fn cass_batch_set_timestamp(batch: *mut CassBatch, - timestamp: cass_int64_t) -> CassError; - pub fn cass_batch_set_request_timeout(batch: *mut CassBatch, - timeout_ms: cass_uint64_t) - -> CassError; - pub fn cass_batch_set_retry_policy(batch: *mut CassBatch, - retry_policy: *mut CassRetryPolicy) - -> CassError; - pub fn cass_batch_set_custom_payload(batch: *mut CassBatch, - payload: *const CassCustomPayload) - -> CassError; - pub fn cass_batch_add_statement(batch: *mut CassBatch, - statement: *mut CassStatement) - -> CassError; +} +extern "C" { + + /// Sets the batch's consistency level + /// + /// @cassandra{2.0+} + /// + /// @public @memberof CassBatch + /// + /// @param[in] batch + /// @param[in] consistency The batch's write consistency. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_batch_set_consistency(batch: *mut CassBatch, consistency: CassConsistency) -> CassError; +} +extern "C" { + + /// Sets the batch's serial consistency level. + /// + /// @cassandra{2.0+} + /// + /// Default: Not set + /// + /// @public @memberof CassBatch + /// + /// @param[in] batch + /// @param[in] serial_consistency + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_batch_set_serial_consistency(batch: *mut CassBatch, serial_consistency: CassConsistency) -> CassError; +} +extern "C" { + + /// Sets the batch's timestamp. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassBatch + /// + /// @param[in] batch + /// @param[in] timestamp + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_batch_set_timestamp(batch: *mut CassBatch, timestamp: cass_int64_t) -> CassError; +} +extern "C" { + + /// Sets the batch's timeout for waiting for a response from a node. + /// + /// Default: Disabled (use the cluster-level request timeout) + /// + /// @public @memberof CassBatch + /// + /// @param[in] batch + /// @param[in] timeout_ms Request timeout in milliseconds. Use 0 for no timeout + /// or CASS_UINT64_MAX to disable (to use the cluster-level request timeout). + /// @return CASS_OK if successful, otherwise an error occurred. + /// + /// @see cass_cluster_set_request_timeout() + pub fn cass_batch_set_request_timeout(batch: *mut CassBatch, timeout_ms: cass_uint64_t) -> CassError; +} +extern "C" { + + /// Sets the batch's retry policy. + /// + /// @cassandra{2.0+} + /// + /// @public @memberof CassBatch + /// + /// @param[in] batch + /// @param[in] retry_policy + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_batch_set_retry_policy(batch: *mut CassBatch, retry_policy: *mut CassRetryPolicy) -> CassError; +} +extern "C" { + + /// Sets the batch's custom payload. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassBatch + /// + /// @param[in] batch + /// @param[in] payload + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_batch_set_custom_payload(batch: *mut CassBatch, payload: *const CassCustomPayload) -> CassError; +} +extern "C" { + + /// Adds a statement to a batch. + /// + /// @cassandra{2.0+} + /// + /// @public @memberof CassBatch + /// + /// @param[in] batch + /// @param[in] statement + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_batch_add_statement(batch: *mut CassBatch, statement: *mut CassStatement) -> CassError; +} +extern "C" { + + /// Creates a new data type with value type. + /// + /// @public @memberof CassDataType + /// + /// @param[in] type + /// @return Returns a data type that must be freed. + /// + /// @see cass_data_type_free() pub fn cass_data_type_new(type_: CassValueType) -> *mut CassDataType; - pub fn cass_data_type_new_from_existing(data_type: *const CassDataType) - -> *mut CassDataType; - pub fn cass_data_type_new_tuple(item_count: size_t) -> *mut CassDataType; - pub fn cass_data_type_new_udt(field_count: size_t) -> *mut CassDataType; +} +extern "C" { + + /// Creates a new data type from an existing data type. + /// + /// @public @memberof CassDataType + /// + /// @param[in] data_type + /// @return Returns a data type that must be freed. + /// + /// @see cass_data_type_free() + pub fn cass_data_type_new_from_existing(data_type: *const CassDataType) -> *mut CassDataType; +} +extern "C" { + + /// Creates a new tuple data type. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassDataType + /// + /// @param[in] item_count The number of items in the tuple + /// @return Returns a data type that must be freed. + /// + /// @see cass_data_type_free() + pub fn cass_data_type_new_tuple(item_count: usize) -> *mut CassDataType; +} +extern "C" { + + /// Creates a new UDT (user defined type) data type. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassDataType + /// + /// @param[in] field_count The number of fields in the UDT + /// @return Returns a data type that must be freed. + /// + /// @see cass_data_type_free() + pub fn cass_data_type_new_udt(field_count: usize) -> *mut CassDataType; +} +extern "C" { + + /// Frees a data type instance. + /// + /// @public @memberof CassDataType + /// + /// @param[in] data_type pub fn cass_data_type_free(data_type: *mut CassDataType); - pub fn cass_data_type_type(data_type: *const CassDataType) - -> CassValueType; - pub fn cass_data_type_is_frozen(data_type: *const CassDataType) - -> cass_bool_t; - pub fn cass_data_type_type_name(data_type: *const CassDataType, - type_name: - *mut *const ::std::os::raw::c_char, - type_name_length: *mut size_t) - -> CassError; - pub fn cass_data_type_set_type_name(data_type: *mut CassDataType, - type_name: - *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_data_type_set_type_name_n(data_type: *mut CassDataType, - type_name: - *const ::std::os::raw::c_char, - type_name_length: size_t) - -> CassError; - pub fn cass_data_type_keyspace(data_type: *const CassDataType, - keyspace: - *mut *const ::std::os::raw::c_char, - keyspace_length: *mut size_t) -> CassError; - pub fn cass_data_type_set_keyspace(data_type: *mut CassDataType, - keyspace: - *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_data_type_set_keyspace_n(data_type: *mut CassDataType, - keyspace: - *const ::std::os::raw::c_char, - keyspace_length: size_t) - -> CassError; - pub fn cass_data_type_class_name(data_type: *const CassDataType, - class_name: - *mut *const ::std::os::raw::c_char, - class_name_length: *mut size_t) - -> CassError; - pub fn cass_data_type_set_class_name(data_type: *mut CassDataType, - class_name: - *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_data_type_set_class_name_n(data_type: *mut CassDataType, - class_name: - *const ::std::os::raw::c_char, - class_name_length: size_t) - -> CassError; - pub fn cass_data_type_sub_type_count(data_type: *const CassDataType) - -> size_t; - pub fn cass_data_sub_type_count(data_type: *const CassDataType) -> size_t; - pub fn cass_data_type_sub_data_type(data_type: *const CassDataType, - index: size_t) -> *const CassDataType; - pub fn cass_data_type_sub_data_type_by_name(data_type: - *const CassDataType, - name: - *const ::std::os::raw::c_char) - -> *const CassDataType; - pub fn cass_data_type_sub_data_type_by_name_n(data_type: - *const CassDataType, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassDataType; - pub fn cass_data_type_sub_type_name(data_type: *const CassDataType, - index: size_t, - name: - *mut *const ::std::os::raw::c_char, - name_length: *mut size_t) - -> CassError; - pub fn cass_data_type_add_sub_type(data_type: *mut CassDataType, - sub_data_type: *const CassDataType) - -> CassError; - pub fn cass_data_type_add_sub_type_by_name(data_type: *mut CassDataType, - name: - *const ::std::os::raw::c_char, - sub_data_type: - *const CassDataType) - -> CassError; - pub fn cass_data_type_add_sub_type_by_name_n(data_type: *mut CassDataType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - sub_data_type: - *const CassDataType) - -> CassError; - pub fn cass_data_type_add_sub_value_type(data_type: *mut CassDataType, - sub_value_type: CassValueType) - -> CassError; - pub fn cass_data_type_add_sub_value_type_by_name(data_type: - *mut CassDataType, - name: - *const ::std::os::raw::c_char, - sub_value_type: - CassValueType) - -> CassError; - pub fn cass_data_type_add_sub_value_type_by_name_n(data_type: - *mut CassDataType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - sub_value_type: - CassValueType) - -> CassError; - pub fn cass_collection_new(type_: CassCollectionType, item_count: size_t) - -> *mut CassCollection; - pub fn cass_collection_new_from_data_type(data_type: *const CassDataType, - item_count: size_t) - -> *mut CassCollection; +} +extern "C" { + + /// Gets the value type of the specified data type. + /// + /// @param[in] data_type + /// @return The value type + pub fn cass_data_type_type(data_type: *const CassDataType) -> CassValueType; +} +extern "C" { + + /// Gets whether a data type is frozen. + /// + /// @cassandra{2.1+} + /// + /// @param[in] data_type + /// @return cass_true if the data type is frozen, otherwise cass_false. + pub fn cass_data_type_is_frozen(data_type: *const CassDataType) -> cass_bool_t; +} +extern "C" { + + /// Gets the type name of a UDT data type. + /// + /// Note: Only valid for UDT data types. + /// + /// @param[in] data_type + /// @param[out] type_name + /// @param[out] type_name_length + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_type_name(data_type: *const CassDataType, type_name: *mut *const ::std::os::raw::c_char, + type_name_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Sets the type name of a UDT data type. + /// + /// Note: Only valid for UDT data types. + /// + /// @param[in] data_type + /// @param[in] type_name + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_set_type_name(data_type: *mut CassDataType, type_name: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_data_type_set_type_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassDataType + /// + /// @param[in] data_type + /// @param[in] type_name + /// @param[in] type_name_length + /// @return Returns a data type that must be freed. + pub fn cass_data_type_set_type_name_n(data_type: *mut CassDataType, type_name: *const ::std::os::raw::c_char, + type_name_length: usize) + -> CassError; +} +extern "C" { + + /// Gets the type name of a UDT data type. + /// + /// Note: Only valid for UDT data types. + /// + /// @cassandra{2.1+} + /// + /// @param[in] data_type + /// @param[out] keyspace + /// @param[out] keyspace_length + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_keyspace(data_type: *const CassDataType, keyspace: *mut *const ::std::os::raw::c_char, + keyspace_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Sets the keyspace of a UDT data type. + /// + /// Note: Only valid for UDT data types. + /// + /// @cassandra{2.1+} + /// + /// @param[in] data_type + /// @param[in] keyspace + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_set_keyspace(data_type: *mut CassDataType, keyspace: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_data_type_set_keyspace(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassDataType + /// + /// @param[in] data_type + /// @param[in] keyspace + /// @param[in] keyspace_length + /// @return Returns a data type that must be freed. + pub fn cass_data_type_set_keyspace_n(data_type: *mut CassDataType, keyspace: *const ::std::os::raw::c_char, + keyspace_length: usize) + -> CassError; +} +extern "C" { + + /// Gets the class name of a custom data type. + /// + /// Note: Only valid for custom data types. + /// + /// @param[in] data_type + /// @param[out] class_name + /// @param[out] class_name_length + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_class_name(data_type: *const CassDataType, class_name: *mut *const ::std::os::raw::c_char, + class_name_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Sets the class name of a custom data type. + /// + /// Note: Only valid for custom data types. + /// + /// @param[in] data_type + /// @param[in] class_name + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_set_class_name(data_type: *mut CassDataType, class_name: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_data_type_set_class_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassDataType + /// + /// @param[in] data_type + /// @param[in] class_name + /// @param[in] class_name_length + /// @return Returns a data type that must be freed. + pub fn cass_data_type_set_class_name_n(data_type: *mut CassDataType, class_name: *const ::std::os::raw::c_char, + class_name_length: usize) + -> CassError; +} +extern "C" { + + /// Gets the sub-data type count of a UDT (user defined type), tuple + /// or collection. + /// + /// Note: Only valid for UDT, tuple and collection data types. + /// + /// @param[in] data_type + /// @return Returns the number of sub-data types + pub fn cass_data_type_sub_type_count(data_type: *const CassDataType) -> usize; +} +extern "C" { + pub fn cass_data_sub_type_count(data_type: *const CassDataType) -> usize; +} +extern "C" { + + /// Gets the sub-data type of a UDT (user defined type), tuple or collection at + /// the specified index. + /// + /// Note: Only valid for UDT, tuple and collection data types. + /// + /// @param[in] data_type + /// @param[in] index + /// @return Returns a reference to a child data type. Do not free this + /// reference as it is bound to the lifetime of the parent data type. NULL + /// is returned if the index is out of range. + pub fn cass_data_type_sub_data_type(data_type: *const CassDataType, index: usize) -> *const CassDataType; +} +extern "C" { + + /// Gets the sub-data type of a UDT (user defined type) at the specified index. + /// + /// Note: Only valid for UDT data types. + /// + /// @cassandra{2.1+} + /// + /// @param[in] data_type + /// @param[in] name + /// @return Returns a reference to a child data type. Do not free this + /// reference as it is bound to the lifetime of the parent data type. NULL + /// is returned if the name doesn't exist. + pub fn cass_data_type_sub_data_type_by_name(data_type: *const CassDataType, name: *const ::std::os::raw::c_char) + -> *const CassDataType; +} +extern "C" { + + /// Same as cass_data_type_sub_data_type_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassDataType + /// + /// @param[in] data_type + /// @param[in] name + /// @param[in] name_length + /// @return Returns a reference to a child data type. Do not free this + /// reference as it is bound to the lifetime of the parent data type. NULL + /// is returned if the name doesn't exist. + pub fn cass_data_type_sub_data_type_by_name_n(data_type: *const CassDataType, + name: *const ::std::os::raw::c_char, name_length: usize) + -> *const CassDataType; +} +extern "C" { + + /// Gets the sub-type name of a UDT (user defined type) at the specified index. + /// + /// @cassandra{2.1+} + /// + /// Note: Only valid for UDT data types. + /// + /// @param[in] data_type + /// @param[in] index + /// @param[out] name + /// @param[out] name_length + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_sub_type_name(data_type: *const CassDataType, index: usize, + name: *mut *const ::std::os::raw::c_char, name_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Adds a sub-data type to a tuple or collection. + /// + /// Note: Only valid for tuple and collection data types. + /// + /// @param[in] data_type + /// @param[in] sub_data_type + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_add_sub_type(data_type: *mut CassDataType, sub_data_type: *const CassDataType) -> CassError; +} +extern "C" { + + /// Adds a sub-data type to a UDT (user defined type). + /// + /// Note: Only valid for UDT data types. + /// + /// @cassandra{2.1+} + /// + /// @param[in] data_type + /// @param[in] name + /// @param[in] sub_data_type + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_add_sub_type_by_name(data_type: *mut CassDataType, name: *const ::std::os::raw::c_char, + sub_data_type: *const CassDataType) + -> CassError; +} +extern "C" { + + /// Same as cass_data_type_add_sub_type_by_name(), but with lengths for string + /// parameters. + /// + /// Note: Only valid for UDT data types. + /// + /// @cassandra{2.1+} + /// + /// @param[in] data_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] sub_data_type + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_add_sub_type_by_name_n(data_type: *mut CassDataType, name: *const ::std::os::raw::c_char, + name_length: usize, sub_data_type: *const CassDataType) + -> CassError; +} +extern "C" { + + /// Adds a sub-data type to a tuple or collection using a value type. + /// + /// Note: Only valid for tuple and collection data types. + /// + /// @param[in] data_type + /// @param[in] sub_value_type + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_add_sub_value_type(data_type: *mut CassDataType, sub_value_type: CassValueType) -> CassError; +} +extern "C" { + + /// Adds a sub-data type to a UDT (user defined type) using a value type. + /// + /// Note: Only valid for UDT data types. + /// + /// @cassandra{2.1+} + /// + /// @param[in] data_type + /// @param[in] name + /// @param[in] sub_value_type + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_add_sub_value_type_by_name(data_type: *mut CassDataType, + name: *const ::std::os::raw::c_char, + sub_value_type: CassValueType) + -> CassError; +} +extern "C" { + + /// Same as cass_data_type_add_sub_value_type_by_name(), but with lengths for string + /// parameters. + /// + /// Note: Only valid for UDT data types. + /// + /// @cassandra{2.1+} + /// + /// @param[in] data_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] sub_value_type + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_data_type_add_sub_value_type_by_name_n(data_type: *mut CassDataType, + name: *const ::std::os::raw::c_char, name_length: usize, + sub_value_type: CassValueType) + -> CassError; +} +extern "C" { + + /// Creates a new collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] type + /// @param[in] item_count The approximate number of items in the collection. + /// @return Returns a collection that must be freed. + /// + /// @see cass_collection_free() + pub fn cass_collection_new(type_: CassCollectionType, item_count: usize) -> *mut CassCollection; +} +extern "C" { + + /// Creates a new collection from an existing data type. + /// + /// @public @memberof CassCollection + /// + /// @param[in] data_type + /// @param[in] item_count The approximate number of items in the collection. + /// @return Returns a collection that must be freed. + /// + /// @see cass_collection_free(); + pub fn cass_collection_new_from_data_type(data_type: *const CassDataType, item_count: usize) + -> *mut CassCollection; +} +extern "C" { + + /// Frees a collection instance. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection pub fn cass_collection_free(collection: *mut CassCollection); - pub fn cass_collection_data_type(collection: *const CassCollection) - -> *const CassDataType; - pub fn cass_collection_append_int8(collection: *mut CassCollection, - value: cass_int8_t) -> CassError; - pub fn cass_collection_append_int16(collection: *mut CassCollection, - value: cass_int16_t) -> CassError; - pub fn cass_collection_append_int32(collection: *mut CassCollection, - value: cass_int32_t) -> CassError; - pub fn cass_collection_append_uint32(collection: *mut CassCollection, - value: cass_uint32_t) -> CassError; - pub fn cass_collection_append_int64(collection: *mut CassCollection, - value: cass_int64_t) -> CassError; - pub fn cass_collection_append_float(collection: *mut CassCollection, - value: cass_float_t) -> CassError; - pub fn cass_collection_append_double(collection: *mut CassCollection, - value: cass_double_t) -> CassError; - pub fn cass_collection_append_bool(collection: *mut CassCollection, - value: cass_bool_t) -> CassError; - pub fn cass_collection_append_string(collection: *mut CassCollection, - value: *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_collection_append_string_n(collection: *mut CassCollection, - value: - *const ::std::os::raw::c_char, - value_length: size_t) -> CassError; - pub fn cass_collection_append_bytes(collection: *mut CassCollection, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_collection_append_custom(collection: *mut CassCollection, - class_name: - *const ::std::os::raw::c_char, - value: *const cass_byte_t, - value_size: size_t) -> CassError; +} +extern "C" { + + /// Gets the data type of a collection. + /// + /// @param[in] collection + /// @return Returns a reference to the data type of the collection. Do not free + /// this reference as it is bound to the lifetime of the collection. + pub fn cass_collection_data_type(collection: *const CassCollection) -> *const CassDataType; +} +extern "C" { + + /// Appends a "tinyint" to the collection. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_int8(collection: *mut CassCollection, value: cass_int8_t) -> CassError; +} +extern "C" { + + /// Appends an "smallint" to the collection. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_int16(collection: *mut CassCollection, value: cass_int16_t) -> CassError; +} +extern "C" { + + /// Appends an "int" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_int32(collection: *mut CassCollection, value: cass_int32_t) -> CassError; +} +extern "C" { + + /// Appends a "date" to the collection. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_uint32(collection: *mut CassCollection, value: cass_uint32_t) -> CassError; +} +extern "C" { + + /// Appends a "bigint", "counter", "timestamp" or "time" to the + /// collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_int64(collection: *mut CassCollection, value: cass_int64_t) -> CassError; +} +extern "C" { + + /// Appends a "float" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_float(collection: *mut CassCollection, value: cass_float_t) -> CassError; +} +extern "C" { + + /// Appends a "double" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_double(collection: *mut CassCollection, value: cass_double_t) -> CassError; +} +extern "C" { + + /// Appends a "boolean" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_bool(collection: *mut CassCollection, value: cass_bool_t) -> CassError; +} +extern "C" { + + /// Appends an "ascii", "text" or "varchar" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value The value is copied into the collection object; the + /// memory pointed to by this parameter can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_string(collection: *mut CassCollection, value: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_collection_append_string(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @param[in] value_length + /// @return same as cass_collection_append_string() + /// + /// @see cass_collection_append_string(); + pub fn cass_collection_append_string_n(collection: *mut CassCollection, value: *const ::std::os::raw::c_char, + value_length: usize) + -> CassError; +} +extern "C" { + + /// Appends a "blob", "varint" or "custom" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value The value is copied into the collection object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_bytes(collection: *mut CassCollection, value: *const cass_byte_t, + value_size: usize) + -> CassError; +} +extern "C" { + + /// Appends a "custom" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] class_name + /// @param[in] value The value is copied into the collection object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_custom(collection: *mut CassCollection, class_name: *const ::std::os::raw::c_char, + value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Same as cass_collection_append_custom(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] class_name + /// @param[in] class_name_length + /// @param[in] value + /// @param[in] value_size + /// @return same as cass_collection_append_custom() + /// + /// @see cass_collection_append_custom() pub fn cass_collection_append_custom_n(collection: *mut CassCollection, - class_name: - *const ::std::os::raw::c_char, - class_name_length: size_t, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_collection_append_uuid(collection: *mut CassCollection, - value: CassUuid) -> CassError; - pub fn cass_collection_append_inet(collection: *mut CassCollection, - value: CassInet) -> CassError; - pub fn cass_collection_append_decimal(collection: *mut CassCollection, - varint: *const cass_byte_t, - varint_size: size_t, - scale: cass_int32_t) -> CassError; - pub fn cass_collection_append_collection(collection: *mut CassCollection, - value: *const CassCollection) - -> CassError; - pub fn cass_collection_append_tuple(collection: *mut CassCollection, - value: *const CassTuple) -> CassError; - pub fn cass_collection_append_user_type(collection: *mut CassCollection, - value: *const CassUserType) - -> CassError; - pub fn cass_tuple_new(item_count: size_t) -> *mut CassTuple; - pub fn cass_tuple_new_from_data_type(data_type: *const CassDataType) - -> *mut CassTuple; + class_name: *const ::std::os::raw::c_char, class_name_length: usize, + value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Appends a "uuid" or "timeuuid" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_uuid(collection: *mut CassCollection, value: CassUuid) -> CassError; +} +extern "C" { + + /// Appends an "inet" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_inet(collection: *mut CassCollection, value: CassInet) -> CassError; +} +extern "C" { + + /// Appends a "decimal" to the collection. + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] varint The value is copied into the collection object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] varint_size + /// @param[in] scale + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_decimal(collection: *mut CassCollection, varint: *const cass_byte_t, + varint_size: usize, scale: cass_int32_t) + -> CassError; +} +extern "C" { + + /// Appends a "list", "map" or "set" to the collection. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_collection(collection: *mut CassCollection, value: *const CassCollection) + -> CassError; +} +extern "C" { + + /// Appends a "tuple" to the collection. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_tuple(collection: *mut CassCollection, value: *const CassTuple) -> CassError; +} +extern "C" { + + /// Appends a "udt" to the collection. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassCollection + /// + /// @param[in] collection + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_collection_append_user_type(collection: *mut CassCollection, value: *const CassUserType) -> CassError; +} +extern "C" { + + /// Creates a new tuple. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] item_count The number of items in the tuple. + /// @return Returns a tuple that must be freed. + /// + /// @see cass_tuple_free() + pub fn cass_tuple_new(item_count: usize) -> *mut CassTuple; +} +extern "C" { + + /// Creates a new tuple from an existing data type. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] data_type + /// @return Returns a tuple that must be freed. + /// + /// @see cass_tuple_free(); + pub fn cass_tuple_new_from_data_type(data_type: *const CassDataType) -> *mut CassTuple; +} +extern "C" { + + /// Frees a tuple instance. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple pub fn cass_tuple_free(tuple: *mut CassTuple); - pub fn cass_tuple_data_type(tuple: *const CassTuple) - -> *const CassDataType; - pub fn cass_tuple_set_null(tuple: *mut CassTuple, index: size_t) - -> CassError; - pub fn cass_tuple_set_int8(tuple: *mut CassTuple, index: size_t, - value: cass_int8_t) -> CassError; - pub fn cass_tuple_set_int16(tuple: *mut CassTuple, index: size_t, - value: cass_int16_t) -> CassError; - pub fn cass_tuple_set_int32(tuple: *mut CassTuple, index: size_t, - value: cass_int32_t) -> CassError; - pub fn cass_tuple_set_uint32(tuple: *mut CassTuple, index: size_t, - value: cass_uint32_t) -> CassError; - pub fn cass_tuple_set_int64(tuple: *mut CassTuple, index: size_t, - value: cass_int64_t) -> CassError; - pub fn cass_tuple_set_float(tuple: *mut CassTuple, index: size_t, - value: cass_float_t) -> CassError; - pub fn cass_tuple_set_double(tuple: *mut CassTuple, index: size_t, - value: cass_double_t) -> CassError; - pub fn cass_tuple_set_bool(tuple: *mut CassTuple, index: size_t, - value: cass_bool_t) -> CassError; - pub fn cass_tuple_set_string(tuple: *mut CassTuple, index: size_t, - value: *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_tuple_set_string_n(tuple: *mut CassTuple, index: size_t, - value: *const ::std::os::raw::c_char, - value_length: size_t) -> CassError; - pub fn cass_tuple_set_bytes(tuple: *mut CassTuple, index: size_t, - value: *const cass_byte_t, value_size: size_t) - -> CassError; - pub fn cass_tuple_set_custom(tuple: *mut CassTuple, index: size_t, - class_name: *const ::std::os::raw::c_char, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_tuple_set_custom_n(tuple: *mut CassTuple, index: size_t, - class_name: *const ::std::os::raw::c_char, - class_name_length: size_t, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_tuple_set_uuid(tuple: *mut CassTuple, index: size_t, - value: CassUuid) -> CassError; - pub fn cass_tuple_set_inet(tuple: *mut CassTuple, index: size_t, - value: CassInet) -> CassError; - pub fn cass_tuple_set_decimal(tuple: *mut CassTuple, index: size_t, - varint: *const cass_byte_t, - varint_size: size_t, scale: cass_int32_t) - -> CassError; - pub fn cass_tuple_set_collection(tuple: *mut CassTuple, index: size_t, - value: *const CassCollection) - -> CassError; - pub fn cass_tuple_set_tuple(tuple: *mut CassTuple, index: size_t, - value: *const CassTuple) -> CassError; - pub fn cass_tuple_set_user_type(tuple: *mut CassTuple, index: size_t, - value: *const CassUserType) -> CassError; - pub fn cass_user_type_new_from_data_type(data_type: *const CassDataType) - -> *mut CassUserType; +} +extern "C" { + + /// Gets the data type of a tuple. + /// + /// @cassandra{2.1+} + /// + /// @param[in] tuple + /// @return Returns a reference to the data type of the tuple. Do not free + /// this reference as it is bound to the lifetime of the tuple. + pub fn cass_tuple_data_type(tuple: *const CassTuple) -> *const CassDataType; +} +extern "C" { + + /// Sets an null in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_null(tuple: *mut CassTuple, index: usize) -> CassError; +} +extern "C" { + + /// Sets a "tinyint" in a tuple at the specified index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_int8(tuple: *mut CassTuple, index: usize, value: cass_int8_t) -> CassError; +} +extern "C" { + + /// Sets an "smallint" in a tuple at the specified index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_int16(tuple: *mut CassTuple, index: usize, value: cass_int16_t) -> CassError; +} +extern "C" { + + /// Sets an "int" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_int32(tuple: *mut CassTuple, index: usize, value: cass_int32_t) -> CassError; +} +extern "C" { + + /// Sets a "date" in a tuple at the specified index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_uint32(tuple: *mut CassTuple, index: usize, value: cass_uint32_t) -> CassError; +} +extern "C" { + + /// Sets a "bigint", "counter", "timestamp" or "time" in a tuple at the + /// specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_int64(tuple: *mut CassTuple, index: usize, value: cass_int64_t) -> CassError; +} +extern "C" { + + /// Sets a "float" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_float(tuple: *mut CassTuple, index: usize, value: cass_float_t) -> CassError; +} +extern "C" { + + /// Sets a "double" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_double(tuple: *mut CassTuple, index: usize, value: cass_double_t) -> CassError; +} +extern "C" { + + /// Sets a "boolean" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_bool(tuple: *mut CassTuple, index: usize, value: cass_bool_t) -> CassError; +} +extern "C" { + + /// Sets an "ascii", "text" or "varchar" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value The value is copied into the tuple object; the + /// memory pointed to by this parameter can be freed after this call. + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_string(tuple: *mut CassTuple, index: usize, value: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_tuple_set_string(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @param[in] value_length + /// @return same as cass_tuple_set_string() + /// + /// @see cass_tuple_set_string(); + pub fn cass_tuple_set_string_n(tuple: *mut CassTuple, index: usize, value: *const ::std::os::raw::c_char, + value_length: usize) + -> CassError; +} +extern "C" { + + /// Sets a "blob", "varint" or "custom" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value The value is copied into the tuple object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_bytes(tuple: *mut CassTuple, index: usize, value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Sets a "custom" in a tuple at the specified index. + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] class_name + /// @param[in] value The value is copied into the tuple object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_custom(tuple: *mut CassTuple, index: usize, class_name: *const ::std::os::raw::c_char, + value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Same as cass_tuple_set_custom(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] class_name + /// @param[in] class_name_length + /// @param[in] value + /// @param[in] value_size + /// @return same as cass_tuple_set_custom() + /// + /// @see cass_tuple_set_custom() + pub fn cass_tuple_set_custom_n(tuple: *mut CassTuple, index: usize, class_name: *const ::std::os::raw::c_char, + class_name_length: usize, value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Sets a "uuid" or "timeuuid" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_uuid(tuple: *mut CassTuple, index: usize, value: CassUuid) -> CassError; +} +extern "C" { + + /// Sets an "inet" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_inet(tuple: *mut CassTuple, index: usize, value: CassInet) -> CassError; +} +extern "C" { + + /// Sets a "decimal" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] varint The value is copied into the tuple object; the + /// memory pointed to by this parameter can be freed after this call. + /// @param[in] varint_size + /// @param[in] scale + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_decimal(tuple: *mut CassTuple, index: usize, varint: *const cass_byte_t, + varint_size: usize, scale: cass_int32_t) + -> CassError; +} +extern "C" { + + /// Sets a "list", "map" or "set" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_collection(tuple: *mut CassTuple, index: usize, value: *const CassCollection) -> CassError; +} +extern "C" { + + /// Sets a "tuple" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_tuple(tuple: *mut CassTuple, index: usize, value: *const CassTuple) -> CassError; +} +extern "C" { + + /// Sets a "udt" in a tuple at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTuple + /// + /// @param[in] tuple + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_tuple_set_user_type(tuple: *mut CassTuple, index: usize, value: *const CassUserType) -> CassError; +} +extern "C" { + + /// Creates a new user defined type from existing data type; + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] data_type + /// @return Returns a user defined type that must be freed. NULL is returned if + /// the data type is not a user defined type. + /// + /// @see cass_user_type_free() + pub fn cass_user_type_new_from_data_type(data_type: *const CassDataType) -> *mut CassUserType; +} +extern "C" { + + /// Frees a user defined type instance. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type pub fn cass_user_type_free(user_type: *mut CassUserType); - pub fn cass_user_type_data_type(user_type: *const CassUserType) - -> *const CassDataType; - pub fn cass_user_type_set_null(user_type: *mut CassUserType, - index: size_t) -> CassError; - pub fn cass_user_type_set_null_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_user_type_set_null_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t) - -> CassError; - pub fn cass_user_type_set_int8(user_type: *mut CassUserType, - index: size_t, value: cass_int8_t) - -> CassError; - pub fn cass_user_type_set_int8_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: cass_int8_t) -> CassError; - pub fn cass_user_type_set_int8_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_int8_t) -> CassError; - pub fn cass_user_type_set_int16(user_type: *mut CassUserType, - index: size_t, value: cass_int16_t) - -> CassError; - pub fn cass_user_type_set_int16_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: cass_int16_t) -> CassError; - pub fn cass_user_type_set_int16_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_int16_t) - -> CassError; - pub fn cass_user_type_set_int32(user_type: *mut CassUserType, - index: size_t, value: cass_int32_t) - -> CassError; - pub fn cass_user_type_set_int32_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: cass_int32_t) -> CassError; - pub fn cass_user_type_set_int32_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_int32_t) - -> CassError; - pub fn cass_user_type_set_uint32(user_type: *mut CassUserType, - index: size_t, value: cass_uint32_t) - -> CassError; - pub fn cass_user_type_set_uint32_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, +} +extern "C" { + + /// Gets the data type of a user defined type. + /// + /// @cassandra{2.1+} + /// + /// @param[in] user_type + /// @return Returns a reference to the data type of the user defined type. + /// Do not free this reference as it is bound to the lifetime of the + /// user defined type. + pub fn cass_user_type_data_type(user_type: *const CassUserType) -> *const CassDataType; +} +extern "C" { + + /// Sets a null in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_null(user_type: *mut CassUserType, index: usize) -> CassError; +} +extern "C" { + + /// Sets a null in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_null_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_null_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_user_type_set_null_by_name() + /// + /// @see cass_user_type_set_null_by_name() + pub fn cass_user_type_set_null_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize) + -> CassError; +} +extern "C" { + + /// Sets a "tinyint" in a user defined type at the specified index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_int8(user_type: *mut CassUserType, index: usize, value: cass_int8_t) -> CassError; +} +extern "C" { + + /// Sets a "tinyint" in a user defined type at the specified name. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_int8_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: cass_int8_t) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_int8_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_int8_by_name() + /// + /// @see cass_user_type_set_int8_by_name() + pub fn cass_user_type_set_int8_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_int8_t) + -> CassError; +} +extern "C" { + + /// Sets an "smallint" in a user defined type at the specified index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_int16(user_type: *mut CassUserType, index: usize, value: cass_int16_t) -> CassError; +} +extern "C" { + + /// Sets an "smallint" in a user defined type at the specified name. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_int16_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: cass_int16_t) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_int16_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_int16_by_name() + /// + /// @see cass_user_type_set_int16_by_name() + pub fn cass_user_type_set_int16_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_int16_t) + -> CassError; +} +extern "C" { + + /// Sets an "int" in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_int32(user_type: *mut CassUserType, index: usize, value: cass_int32_t) -> CassError; +} +extern "C" { + + /// Sets an "int" in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_int32_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: cass_int32_t) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_int32_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_int32_by_name() + /// + /// @see cass_user_type_set_int32_by_name() + pub fn cass_user_type_set_int32_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_int32_t) + -> CassError; +} +extern "C" { + + /// Sets a "date" in a user defined type at the specified index. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_uint32(user_type: *mut CassUserType, index: usize, value: cass_uint32_t) -> CassError; +} +extern "C" { + + /// Sets a "date" in a user defined type at the specified name. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_uint32_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, value: cass_uint32_t) - -> CassError; - pub fn cass_user_type_set_uint32_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_uint32_t) - -> CassError; - pub fn cass_user_type_set_int64(user_type: *mut CassUserType, - index: size_t, value: cass_int64_t) - -> CassError; - pub fn cass_user_type_set_int64_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: cass_int64_t) -> CassError; - pub fn cass_user_type_set_int64_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_int64_t) - -> CassError; - pub fn cass_user_type_set_float(user_type: *mut CassUserType, - index: size_t, value: cass_float_t) - -> CassError; - pub fn cass_user_type_set_float_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: cass_float_t) -> CassError; - pub fn cass_user_type_set_float_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_float_t) - -> CassError; - pub fn cass_user_type_set_double(user_type: *mut CassUserType, - index: size_t, value: cass_double_t) - -> CassError; - pub fn cass_user_type_set_double_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_uint32_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_uint32_by_name() + /// + /// @see cass_user_type_set_uint32_by_name() + pub fn cass_user_type_set_uint32_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_uint32_t) + -> CassError; +} +extern "C" { + + /// Sets an "bigint", "counter", "timestamp" or "time" in a + /// user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_int64(user_type: *mut CassUserType, index: usize, value: cass_int64_t) -> CassError; +} +extern "C" { + + /// Sets an "bigint", "counter", "timestamp" or "time" in a + /// user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_int64_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: cass_int64_t) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_int64_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_int64_by_name() + /// + /// @see cass_user_type_set_int64_by_name() + pub fn cass_user_type_set_int64_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_int64_t) + -> CassError; +} +extern "C" { + + /// Sets a "float" in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_float(user_type: *mut CassUserType, index: usize, value: cass_float_t) -> CassError; +} +extern "C" { + + /// Sets a "float" in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_float_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: cass_float_t) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_float_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_float_by_name() + /// + /// @see cass_user_type_set_float_by_name() + pub fn cass_user_type_set_float_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_float_t) + -> CassError; +} +extern "C" { + + /// Sets an "double" in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_double(user_type: *mut CassUserType, index: usize, value: cass_double_t) -> CassError; +} +extern "C" { + + /// Sets an "double" in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_double_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, value: cass_double_t) - -> CassError; - pub fn cass_user_type_set_double_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_double_t) - -> CassError; - pub fn cass_user_type_set_bool(user_type: *mut CassUserType, - index: size_t, value: cass_bool_t) - -> CassError; - pub fn cass_user_type_set_bool_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: cass_bool_t) -> CassError; - pub fn cass_user_type_set_bool_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: cass_bool_t) -> CassError; - pub fn cass_user_type_set_string(user_type: *mut CassUserType, - index: size_t, + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_double_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_double_by_name() + /// + /// @see cass_user_type_set_double_by_name() + pub fn cass_user_type_set_double_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_double_t) + -> CassError; +} +extern "C" { + + /// Sets a "boolean" in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_bool(user_type: *mut CassUserType, index: usize, value: cass_bool_t) -> CassError; +} +extern "C" { + + /// Sets a "boolean" in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_bool_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: cass_bool_t) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_double_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_double_by_name() + /// + /// @see cass_user_type_set_double_by_name() + pub fn cass_user_type_set_bool_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: cass_bool_t) + -> CassError; +} +extern "C" { + + /// Sets an "ascii", "text" or "varchar" in a user defined type at the + /// specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_string(user_type: *mut CassUserType, index: usize, value: *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_user_type_set_string_n(user_type: *mut CassUserType, - index: size_t, - value: *const ::std::os::raw::c_char, - value_length: size_t) -> CassError; - pub fn cass_user_type_set_string_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: - *const ::std::os::raw::c_char) - -> CassError; - pub fn cass_user_type_set_string_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: - *const ::std::os::raw::c_char, - value_length: size_t) - -> CassError; - pub fn cass_user_type_set_bytes(user_type: *mut CassUserType, - index: size_t, value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_user_type_set_bytes_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_user_type_set_bytes_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: *const cass_byte_t, - value_size: size_t) - -> CassError; - pub fn cass_user_type_set_custom(user_type: *mut CassUserType, - index: size_t, - class_name: - *const ::std::os::raw::c_char, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_user_type_set_custom_n(user_type: *mut CassUserType, - index: size_t, - class_name: - *const ::std::os::raw::c_char, - class_name_length: size_t, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_user_type_set_custom_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - class_name: - *const ::std::os::raw::c_char, - value: *const cass_byte_t, - value_size: size_t) -> CassError; - pub fn cass_user_type_set_custom_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - class_name: - *const ::std::os::raw::c_char, - class_name_length: size_t, - value: *const cass_byte_t, - value_size: size_t) - -> CassError; - pub fn cass_user_type_set_uuid(user_type: *mut CassUserType, - index: size_t, value: CassUuid) - -> CassError; - pub fn cass_user_type_set_uuid_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: CassUuid) -> CassError; - pub fn cass_user_type_set_uuid_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: CassUuid) -> CassError; - pub fn cass_user_type_set_inet(user_type: *mut CassUserType, - index: size_t, value: CassInet) - -> CassError; - pub fn cass_user_type_set_inet_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - value: CassInet) -> CassError; - pub fn cass_user_type_set_inet_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: CassInet) -> CassError; - pub fn cass_user_type_set_decimal(user_type: *mut CassUserType, - index: size_t, - varint: *const cass_byte_t, - varint_size: size_t, - scale: ::std::os::raw::c_int) - -> CassError; - pub fn cass_user_type_set_decimal_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - varint: *const cass_byte_t, - varint_size: size_t, + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_string(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @param[in] value_length + /// @return same as cass_user_type_set_string() + /// + /// @see cass_user_type_set_string() + pub fn cass_user_type_set_string_n(user_type: *mut CassUserType, index: usize, + value: *const ::std::os::raw::c_char, value_length: usize) + -> CassError; +} +extern "C" { + + /// Sets an "ascii", "text" or "varchar" in a user defined type at the + /// specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_string_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: *const ::std::os::raw::c_char) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_string_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @param[in] value_length + /// @return same as cass_user_type_set_string_by_name() + /// + /// @see cass_user_type_set_string_by_name() + pub fn cass_user_type_set_string_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: *const ::std::os::raw::c_char, + value_length: usize) + -> CassError; +} +extern "C" { + + /// Sets a "blob" "varint" or "custom" in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_bytes(user_type: *mut CassUserType, index: usize, value: *const cass_byte_t, + value_size: usize) + -> CassError; +} +extern "C" { + + /// Sets a "blob", "varint" or "custom" in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_bytes_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_bytes_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @param[in] value_size + /// @return same as cass_user_type_set_bytes_by_name() + /// + /// @see cass_user_type_set_bytes_by_name() + pub fn cass_user_type_set_bytes_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Sets a "custom" in a user defined type at the specified index. + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] class_name + /// @param[in] value + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_custom(user_type: *mut CassUserType, index: usize, + class_name: *const ::std::os::raw::c_char, value: *const cass_byte_t, + value_size: usize) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_custom(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] class_name + /// @param[in] class_name_length + /// @param[in] value + /// @param[in] value_size + /// @return same as cass_user_type_set_custom() + /// + /// @see cass_user_type_set_custom() + pub fn cass_user_type_set_custom_n(user_type: *mut CassUserType, index: usize, + class_name: *const ::std::os::raw::c_char, class_name_length: usize, + value: *const cass_byte_t, value_size: usize) + -> CassError; +} +extern "C" { + + /// Sets a "custom" in a user defined type at the specified name. + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] class_name + /// @param[in] value + /// @param[in] value_size + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_custom_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + class_name: *const ::std::os::raw::c_char, value: *const cass_byte_t, + value_size: usize) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_custom_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] class_name + /// @param[in] class_name_length + /// @param[in] value + /// @param[in] value_size + /// @return same as cass_user_type_set_custom_by_name() + /// + /// @see cass_user_type_set_custom_by_name() + pub fn cass_user_type_set_custom_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, class_name: *const ::std::os::raw::c_char, + class_name_length: usize, value: *const cass_byte_t, + value_size: usize) + -> CassError; +} +extern "C" { + + /// Sets a "uuid" or "timeuuid" in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_uuid(user_type: *mut CassUserType, index: usize, value: CassUuid) -> CassError; +} +extern "C" { + + /// Sets a "uuid" or "timeuuid" in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_uuid_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: CassUuid) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_uuid_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_uuid_by_name() + /// + /// @see cass_user_type_set_uuid_by_name() + pub fn cass_user_type_set_uuid_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: CassUuid) + -> CassError; +} +extern "C" { + + /// Sets a "inet" in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_inet(user_type: *mut CassUserType, index: usize, value: CassInet) -> CassError; +} +extern "C" { + + /// Sets a "inet" in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_inet_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + value: CassInet) + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_inet_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_inet_by_name() + /// + /// @see cass_user_type_set_inet_by_name() + pub fn cass_user_type_set_inet_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: CassInet) + -> CassError; +} +extern "C" { + + /// Sets an "decimal" in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] varint + /// @param[in] varint_size + /// @param[in] scale + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_decimal(user_type: *mut CassUserType, index: usize, varint: *const cass_byte_t, + varint_size: usize, scale: ::std::os::raw::c_int) + -> CassError; +} +extern "C" { + + /// Sets "decimal" in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] varint + /// @param[in] varint_size + /// @param[in] scale + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_decimal_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + varint: *const cass_byte_t, varint_size: usize, scale: ::std::os::raw::c_int) - -> CassError; - pub fn cass_user_type_set_decimal_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - varint: *const cass_byte_t, - varint_size: size_t, + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_decimal_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] varint + /// @param[in] varint_size + /// @param[in] scale + /// @return same as cass_user_type_set_decimal_by_name() + /// + /// @see cass_user_type_set_decimal_by_name() + pub fn cass_user_type_set_decimal_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, varint: *const cass_byte_t, varint_size: usize, scale: ::std::os::raw::c_int) - -> CassError; - pub fn cass_user_type_set_collection(user_type: *mut CassUserType, - index: size_t, - value: *const CassCollection) - -> CassError; - pub fn cass_user_type_set_collection_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Sets a "list", "map" or "set" in a user defined type at the + /// specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_collection(user_type: *mut CassUserType, index: usize, value: *const CassCollection) + -> CassError; +} +extern "C" { + + /// Sets a "list", "map" or "set" in a user defined type at the + /// specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_collection_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, value: *const CassCollection) - -> CassError; - pub fn cass_user_type_set_collection_by_name_n(user_type: - *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: - *const CassCollection) - -> CassError; - pub fn cass_user_type_set_tuple(user_type: *mut CassUserType, - index: size_t, value: *const CassTuple) - -> CassError; - pub fn cass_user_type_set_tuple_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_collection_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_collection_by_name() + /// + /// @see cass_user_type_set_collection_by_name() + pub fn cass_user_type_set_collection_by_name_n(user_type: *mut CassUserType, + name: *const ::std::os::raw::c_char, name_length: usize, + value: *const CassCollection) + -> CassError; +} +extern "C" { + + /// Sets a "tuple" in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_tuple(user_type: *mut CassUserType, index: usize, value: *const CassTuple) -> CassError; +} +extern "C" { + + /// Sets a "tuple" in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_tuple_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, value: *const CassTuple) - -> CassError; - pub fn cass_user_type_set_tuple_by_name_n(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: *const CassTuple) - -> CassError; - pub fn cass_user_type_set_user_type(user_type: *mut CassUserType, - index: size_t, - value: *const CassUserType) - -> CassError; - pub fn cass_user_type_set_user_type_by_name(user_type: *mut CassUserType, - name: - *const ::std::os::raw::c_char, + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_tuple_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_tuple_by_name() + /// + /// @see cass_user_type_set_tuple_by_name() + pub fn cass_user_type_set_tuple_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: *const CassTuple) + -> CassError; +} +extern "C" { + + /// Sets a user defined type in a user defined type at the specified index. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] index + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_user_type(user_type: *mut CassUserType, index: usize, value: *const CassUserType) + -> CassError; +} +extern "C" { + + /// Sets a user defined type in a user defined type at the specified name. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] value + /// @return CASS_OK if successful, otherwise an error occurred. + pub fn cass_user_type_set_user_type_by_name(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, value: *const CassUserType) - -> CassError; - pub fn cass_user_type_set_user_type_by_name_n(user_type: - *mut CassUserType, - name: - *const ::std::os::raw::c_char, - name_length: size_t, - value: *const CassUserType) - -> CassError; + -> CassError; +} +extern "C" { + + /// Same as cass_user_type_set_user_type_by_name(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassUserType + /// + /// @param[in] user_type + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @return same as cass_user_type_set_user_type_by_name() + /// + /// @see cass_user_type_set_user_type_by_name() + pub fn cass_user_type_set_user_type_by_name_n(user_type: *mut CassUserType, name: *const ::std::os::raw::c_char, + name_length: usize, value: *const CassUserType) + -> CassError; +} +extern "C" { + + /// Frees a result instance. + /// + /// This method invalidates all values, rows, and + /// iterators that were derived from this result. + /// + /// @public @memberof CassResult + /// + /// @param[in] result pub fn cass_result_free(result: *const CassResult); - pub fn cass_result_row_count(result: *const CassResult) -> size_t; - pub fn cass_result_column_count(result: *const CassResult) -> size_t; - pub fn cass_result_column_name(result: *const CassResult, index: size_t, - name: *mut *const ::std::os::raw::c_char, - name_length: *mut size_t) -> CassError; - pub fn cass_result_column_type(result: *const CassResult, index: size_t) - -> CassValueType; - pub fn cass_result_column_data_type(result: *const CassResult, - index: size_t) -> *const CassDataType; +} +extern "C" { + + /// Gets the number of rows for the specified result. + /// + /// @public @memberof CassResult + /// + /// @param[in] result + /// @return The number of rows in the result. + pub fn cass_result_row_count(result: *const CassResult) -> usize; +} +extern "C" { + + /// Gets the number of columns per row for the specified result. + /// + /// @public @memberof CassResult + /// + /// @param[in] result + /// @return The number of columns per row in the result. + pub fn cass_result_column_count(result: *const CassResult) -> usize; +} +extern "C" { + + /// Gets the column name at index for the specified result. + /// + /// @public @memberof CassResult + /// + /// @param[in] result + /// @param[in] index + /// @param[out] name The column name at the specified index. + /// @param[out] name_length + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_result_column_name(result: *const CassResult, index: usize, + name: *mut *const ::std::os::raw::c_char, name_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Gets the column type at index for the specified result. + /// + /// @public @memberof CassResult + /// + /// @param[in] result + /// @param[in] index + /// @return The column type at the specified index. CASS_VALUE_TYPE_UNKNOWN + /// is returned if the index is out of bounds. + pub fn cass_result_column_type(result: *const CassResult, index: usize) -> CassValueType; +} +extern "C" { + + /// Gets the column data type at index for the specified result. + /// + /// @public @memberof CassResult + /// + /// @param[in] result + /// @param[in] index + /// @return The column type at the specified index. NULL is returned if the + /// index is out of bounds. + pub fn cass_result_column_data_type(result: *const CassResult, index: usize) -> *const CassDataType; +} +extern "C" { + + /// Gets the first row of the result. + /// + /// @public @memberof CassResult + /// + /// @param[in] result + /// @return The first row of the result. NULL if there are no rows. pub fn cass_result_first_row(result: *const CassResult) -> *const CassRow; - pub fn cass_result_has_more_pages(result: *const CassResult) - -> cass_bool_t; +} +extern "C" { + + /// Returns true if there are more pages. + /// + /// @cassandra{2.0+} + /// + /// @public @memberof CassResult + /// + /// @param[in] result + /// @return cass_true if there are more pages + pub fn cass_result_has_more_pages(result: *const CassResult) -> cass_bool_t; +} +extern "C" { + + /// Gets the raw paging state from the result. The paging state is bound to the + /// lifetime of the result object. If paging state needs to live beyond the + /// lifetime of the result object it must be copied. + /// + /// Warning: The paging state should not be exposed to or come from + /// untrusted environments. The paging state could be spoofed and potentially + /// used to gain access to other data. + /// + /// @cassandra{2.0+} + /// + /// @public @memberof CassResult + /// + /// @param[in] result + /// @param[out] paging_state + /// @param[out] paging_state_size + /// @return CASS_OK if successful, otherwise error occurred + /// + /// @see cass_statement_set_paging_state_token() pub fn cass_result_paging_state_token(result: *const CassResult, - paging_state: - *mut *const ::std::os::raw::c_char, - paging_state_size: *mut size_t) - -> CassError; + paging_state: *mut *const ::std::os::raw::c_char, + paging_state_size: *mut usize) + -> CassError; +} +extern "C" { + + /// Frees an error result instance. + /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result pub fn cass_error_result_free(error_result: *const CassErrorResult); - pub fn cass_error_result_code(error_result: *const CassErrorResult) - -> CassError; - pub fn cass_error_result_consistency(error_result: *const CassErrorResult) - -> CassConsistency; - // Name corrected; see CPP-502 - pub fn cass_error_result_actual(error_result: *const CassErrorResult) - -> cass_int32_t; - // Name corrected; see CPP-502 - pub fn cass_error_result_required(error_result: *const CassErrorResult) - -> cass_int32_t; - pub fn cass_error_result_num_failures(error_result: - *const CassErrorResult) - -> cass_int32_t; - pub fn cass_error_result_data_present(error_result: - *const CassErrorResult) - -> cass_bool_t; - pub fn cass_error_result_write_type(error_result: *const CassErrorResult) - -> CassWriteType; +} +extern "C" { + + /// Gets error code for the error result. This error code will always + /// have an server error source. + /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @return The server error code + pub fn cass_error_result_code(error_result: *const CassErrorResult) -> CassError; +} +extern "C" { + + /// Gets consistency that triggered the error result of the + /// following types: + /// + ///
    + ///
  • CASS_ERROR_SERVER_READ_TIMEOUT
  • + ///
  • CASS_ERROR_SERVER_WRITE_TIMEOUT
  • + ///
  • CASS_ERROR_SERVER_READ_FAILURE
  • + ///
  • CASS_ERROR_SERVER_WRITE_FAILURE
  • + ///
  • CASS_ERROR_SERVER_UNAVAILABLE
  • + ///
+ /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @return The consistency that triggered the error for a read timeout, + /// write timeout or an unavailable error result. Undefined for other + /// error result types. + pub fn cass_error_result_consistency(error_result: *const CassErrorResult) -> CassConsistency; +} +extern "C" { + pub fn cass_error_result_actual(error_result: *const CassErrorResult) -> cass_int32_t; +} +extern "C" { + pub fn cass_error_result_required(error_result: *const CassErrorResult) -> cass_int32_t; +} +extern "C" { + + /// Gets the number of nodes that experienced failures for the following error types: + /// + ///
    + ///
  • CASS_ERROR_SERVER_READ_FAILURE
  • + ///
  • CASS_ERROR_SERVER_WRITE_FAILURE
  • + ///
+ /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @return The number of nodes that failed during a read or write request. + pub fn cass_error_result_num_failures(error_result: *const CassErrorResult) -> cass_int32_t; +} +extern "C" { + + /// Determines whether the actual data was present in the responses from the + /// replicas for the following error result types: + /// + ///
    + ///
  • CASS_ERROR_SERVER_READ_TIMEOUT
  • + ///
  • CASS_ERROR_SERVER_READ_FAILURE
  • + ///
+ /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @return cass_true if the data was present in the received responses when the + /// read timeout occurred. Undefined for other error result types. + pub fn cass_error_result_data_present(error_result: *const CassErrorResult) -> cass_bool_t; +} +extern "C" { + + /// Gets the write type of a request for the following error result types: + /// + ///
    + ///
  • CASS_ERROR_SERVER_WRITE_TIMEOUT
  • + ///
  • CASS_ERROR_SERVER_WRITE_FAILURE
  • + ///
+ /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @return The type of the write that timed out. Undefined for + /// other error result types. + pub fn cass_error_result_write_type(error_result: *const CassErrorResult) -> CassWriteType; +} +extern "C" { + + /// Gets the affected keyspace for the following error result types: + /// + ///
    + ///
  • CASS_ERROR_SERVER_ALREADY_EXISTS
  • + ///
  • CASS_ERROR_SERVER_FUNCTION_FAILURE
  • + ///
+ /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @param[out] keyspace + /// @param[out] keyspace_length + /// @return CASS_OK if successful, otherwise error occurred pub fn cass_error_result_keyspace(error_result: *const CassErrorResult, - keyspace: - *mut *const ::std::os::raw::c_char, - keyspace_length: *mut size_t) - -> CassError; - pub fn cass_error_result_table(error_result: *const CassErrorResult, - table: *mut *const ::std::os::raw::c_char, - table_length: *mut size_t) -> CassError; + keyspace: *mut *const ::std::os::raw::c_char, keyspace_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Gets the affected table for the already exists error + /// (CASS_ERROR_SERVER_ALREADY_EXISTS) result type. + /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @param[out] table + /// @param[out] table_length + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_error_result_table(error_result: *const CassErrorResult, table: *mut *const ::std::os::raw::c_char, + table_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Gets the affected function for the function failure error + /// (CASS_ERROR_SERVER_FUNCTION_FAILURE) result type. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @param[out] function + /// @param[out] function_length + /// @return CASS_OK if successful, otherwise error occurred pub fn cass_error_result_function(error_result: *const CassErrorResult, - function: - *mut *const ::std::os::raw::c_char, - function_length: *mut size_t) - -> CassError; - pub fn cass_error_num_arg_types(error_result: *const CassErrorResult) - -> size_t; - pub fn cass_error_result_arg_type(error_result: *const CassErrorResult, - index: size_t, - arg_type: - *mut *const ::std::os::raw::c_char, - arg_type_length: *mut size_t) - -> CassError; + function: *mut *const ::std::os::raw::c_char, function_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Gets the number of argument types for the function failure error + /// (CASS_ERROR_SERVER_FUNCTION_FAILURE) result type. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @return The number of arguments for the affected function. + pub fn cass_error_num_arg_types(error_result: *const CassErrorResult) -> usize; +} +extern "C" { + + /// Gets the argument type at the specified index for the function failure + /// error (CASS_ERROR_SERVER_FUNCTION_FAILURE) result type. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassErrorResult + /// + /// @param[in] error_result + /// @param[in] index + /// @param[out] arg_type + /// @param[out] arg_type_length + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_error_result_arg_type(error_result: *const CassErrorResult, index: usize, + arg_type: *mut *const ::std::os::raw::c_char, arg_type_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Frees an iterator instance. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator pub fn cass_iterator_free(iterator: *mut CassIterator); - pub fn cass_iterator_type(iterator: *mut CassIterator) - -> CassIteratorType; - pub fn cass_iterator_from_result(result: *const CassResult) - -> *mut CassIterator; +} +extern "C" { + + /// Gets the type of the specified iterator. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return The type of the iterator. + pub fn cass_iterator_type(iterator: *mut CassIterator) -> CassIteratorType; +} +extern "C" { + + /// Creates a new iterator for the specified result. This can be + /// used to iterate over rows in the result. + /// + /// @public @memberof CassResult + /// + /// @param[in] result + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_free() + pub fn cass_iterator_from_result(result: *const CassResult) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified row. This can be + /// used to iterate over columns in a row. + /// + /// @public @memberof CassRow + /// + /// @param[in] row + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_free() pub fn cass_iterator_from_row(row: *const CassRow) -> *mut CassIterator; - pub fn cass_iterator_from_collection(value: *const CassValue) - -> *mut CassIterator; - pub fn cass_iterator_from_map(value: *const CassValue) - -> *mut CassIterator; - pub fn cass_iterator_from_tuple(value: *const CassValue) - -> *mut CassIterator; - pub fn cass_iterator_fields_from_user_type(value: *const CassValue) - -> *mut CassIterator; - pub fn cass_iterator_keyspaces_from_schema_meta(schema_meta: - *const CassSchemaMeta) - -> *mut CassIterator; - pub fn cass_iterator_tables_from_keyspace_meta(keyspace_meta: - *const CassKeyspaceMeta) - -> *mut CassIterator; - pub fn cass_iterator_materialized_views_from_keyspace_meta(keyspace_meta: - *const CassKeyspaceMeta) - -> *mut CassIterator; - pub fn cass_iterator_user_types_from_keyspace_meta(keyspace_meta: - *const CassKeyspaceMeta) - -> *mut CassIterator; - pub fn cass_iterator_functions_from_keyspace_meta(keyspace_meta: - *const CassKeyspaceMeta) - -> *mut CassIterator; - pub fn cass_iterator_aggregates_from_keyspace_meta(keyspace_meta: - *const CassKeyspaceMeta) - -> *mut CassIterator; - pub fn cass_iterator_fields_from_keyspace_meta(keyspace_meta: - *const CassKeyspaceMeta) - -> *mut CassIterator; - pub fn cass_iterator_columns_from_table_meta(table_meta: - *const CassTableMeta) - -> *mut CassIterator; - pub fn cass_iterator_indexes_from_table_meta(table_meta: - *const CassTableMeta) - -> *mut CassIterator; - pub fn cass_iterator_materialized_views_from_table_meta(table_meta: - *const CassTableMeta) - -> *mut CassIterator; - pub fn cass_iterator_fields_from_table_meta(table_meta: - *const CassTableMeta) - -> *mut CassIterator; - pub fn cass_iterator_columns_from_materialized_view_meta(view_meta: - *const CassMaterializedViewMeta) - -> *mut CassIterator; - pub fn cass_iterator_fields_from_materialized_view_meta(view_meta: - *const CassMaterializedViewMeta) - -> *mut CassIterator; - pub fn cass_iterator_fields_from_column_meta(column_meta: - *const CassColumnMeta) - -> *mut CassIterator; - pub fn cass_iterator_fields_from_index_meta(index_meta: - *const CassIndexMeta) - -> *mut CassIterator; - pub fn cass_iterator_fields_from_function_meta(function_meta: - *const CassFunctionMeta) - -> *mut CassIterator; - pub fn cass_iterator_fields_from_aggregate_meta(aggregate_meta: - *const CassAggregateMeta) - -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified collection. This can be + /// used to iterate over values in a collection. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @return A new iterator that must be freed. NULL returned if the + /// value is not a collection. + /// + /// @see cass_iterator_free() + pub fn cass_iterator_from_collection(value: *const CassValue) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified map. This can be + /// used to iterate over key/value pairs in a map. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @return A new iterator that must be freed. NULL returned if the + /// value is not a map. + /// + /// @see cass_iterator_free() + pub fn cass_iterator_from_map(value: *const CassValue) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified tuple. This can be + /// used to iterate over values in a tuple. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @return A new iterator that must be freed. NULL returned if the + /// value is not a tuple. + /// + /// @see cass_iterator_free() + pub fn cass_iterator_from_tuple(value: *const CassValue) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified user defined type. This can be + /// used to iterate over fields in a user defined type. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @return A new iterator that must be freed. NULL returned if the + /// value is not a user defined type. + /// + /// @see cass_iterator_free() + pub fn cass_iterator_fields_from_user_type(value: *const CassValue) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified schema metadata. + /// This can be used to iterate over keyspace. + /// + /// @public @memberof CassSchemaMeta + /// + /// @param[in] schema_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_keyspace_meta() + /// @see cass_iterator_free() + pub fn cass_iterator_keyspaces_from_schema_meta(schema_meta: *const CassSchemaMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified keyspace metadata. + /// This can be used to iterate over tables. + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_table_meta() + /// @see cass_iterator_free() + pub fn cass_iterator_tables_from_keyspace_meta(keyspace_meta: *const CassKeyspaceMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified keyspace metadata. + /// This can be used to iterate over views. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_materialized_view_meta() + /// @see cass_iterator_free() + pub fn cass_iterator_materialized_views_from_keyspace_meta(keyspace_meta: *const CassKeyspaceMeta) + -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified keyspace metadata. + /// This can be used to iterate over types. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_user_type() + /// @see cass_iterator_free() + pub fn cass_iterator_user_types_from_keyspace_meta(keyspace_meta: *const CassKeyspaceMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified keyspace metadata. + /// This can be used to iterate over functions. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_function_meta() + /// @see cass_iterator_free() + pub fn cass_iterator_functions_from_keyspace_meta(keyspace_meta: *const CassKeyspaceMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified keyspace metadata. + /// This can be used to iterate over aggregates. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_aggregate_meta() + /// @see cass_iterator_free() + pub fn cass_iterator_aggregates_from_keyspace_meta(keyspace_meta: *const CassKeyspaceMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new fields iterator for the specified keyspace metadata. Metadata + /// fields allow direct access to the column data found in the underlying + /// "keyspaces" metadata table. This can be used to iterate those metadata + /// field entries. + /// + /// @public @memberof CassKeyspaceMeta + /// + /// @param[in] keyspace_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_meta_field_name() + /// @see cass_iterator_get_meta_field_value() + /// @see cass_iterator_free() + pub fn cass_iterator_fields_from_keyspace_meta(keyspace_meta: *const CassKeyspaceMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified table metadata. + /// This can be used to iterate over columns. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_column_meta() + /// @see cass_iterator_free() + pub fn cass_iterator_columns_from_table_meta(table_meta: *const CassTableMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified table metadata. + /// This can be used to iterate over indexes. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_index_meta() + /// @see cass_iterator_free() + pub fn cass_iterator_indexes_from_table_meta(table_meta: *const CassTableMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified materialized view metadata. + /// This can be used to iterate over columns. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_materialized_view_meta() + /// @see cass_iterator_free() + pub fn cass_iterator_materialized_views_from_table_meta(table_meta: *const CassTableMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new fields iterator for the specified table metadata. Metadata + /// fields allow direct access to the column data found in the underlying + /// "tables" metadata table. This can be used to iterate those metadata + /// field entries. + /// + /// @public @memberof CassTableMeta + /// + /// @param[in] table_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_meta_field_name() + /// @see cass_iterator_get_meta_field_value() + /// @see cass_iterator_free() + pub fn cass_iterator_fields_from_table_meta(table_meta: *const CassTableMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new iterator for the specified materialized view metadata. + /// This can be used to iterate over columns. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_column_meta() + /// @see cass_iterator_free() + pub fn cass_iterator_columns_from_materialized_view_meta(view_meta: *const CassMaterializedViewMeta) + -> *mut CassIterator; +} +extern "C" { + + /// Creates a new fields iterator for the specified materialized view metadata. + /// Metadata fields allow direct access to the column data found in the + /// underlying "views" metadata view. This can be used to iterate those metadata + /// field entries. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassMaterializedViewMeta + /// + /// @param[in] view_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_meta_field_name() + /// @see cass_iterator_get_meta_field_value() + /// @see cass_iterator_free() + pub fn cass_iterator_fields_from_materialized_view_meta(view_meta: *const CassMaterializedViewMeta) + -> *mut CassIterator; +} +extern "C" { + + /// Creates a new fields iterator for the specified column metadata. Metadata + /// fields allow direct access to the column data found in the underlying + /// "columns" metadata table. This can be used to iterate those metadata + /// field entries. + /// + /// @public @memberof CassColumnMeta + /// + /// @param[in] column_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_meta_field_name() + /// @see cass_iterator_get_meta_field_value() + /// @see cass_iterator_free() + pub fn cass_iterator_fields_from_column_meta(column_meta: *const CassColumnMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new fields iterator for the specified index metadata. Metadata + /// fields allow direct access to the index data found in the underlying + /// "indexes" metadata table. This can be used to iterate those metadata + /// field entries. + /// + /// @public @memberof CassIndexMeta + /// + /// @param[in] index_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_meta_field_name() + /// @see cass_iterator_get_meta_field_value() + /// @see cass_iterator_free() + pub fn cass_iterator_fields_from_index_meta(index_meta: *const CassIndexMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new fields iterator for the specified function metadata. Metadata + /// fields allow direct access to the column data found in the underlying + /// "functions" metadata table. This can be used to iterate those metadata + /// field entries. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassFunctionMeta + /// + /// @param[in] function_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_meta_field() + /// @see cass_iterator_free() + pub fn cass_iterator_fields_from_function_meta(function_meta: *const CassFunctionMeta) -> *mut CassIterator; +} +extern "C" { + + /// Creates a new fields iterator for the specified aggregate metadata. Metadata + /// fields allow direct access to the column data found in the underlying + /// "aggregates" metadata table. This can be used to iterate those metadata + /// field entries. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassAggregateMeta + /// + /// @param[in] aggregate_meta + /// @return A new iterator that must be freed. + /// + /// @see cass_iterator_get_meta_field() + /// @see cass_iterator_free() + pub fn cass_iterator_fields_from_aggregate_meta(aggregate_meta: *const CassAggregateMeta) -> *mut CassIterator; +} +extern "C" { + + /// Advance the iterator to the next row, column or collection item. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return false if no more rows, columns or items, otherwise true pub fn cass_iterator_next(iterator: *mut CassIterator) -> cass_bool_t; - pub fn cass_iterator_get_row(iterator: *const CassIterator) - -> *const CassRow; - pub fn cass_iterator_get_column(iterator: *const CassIterator) - -> *const CassValue; - pub fn cass_iterator_get_value(iterator: *const CassIterator) - -> *const CassValue; - pub fn cass_iterator_get_map_key(iterator: *const CassIterator) - -> *const CassValue; - pub fn cass_iterator_get_map_value(iterator: *const CassIterator) - -> *const CassValue; - pub fn cass_iterator_get_user_type_field_name(iterator: - *const CassIterator, - name: - *mut *const ::std::os::raw::c_char, - name_length: *mut size_t) - -> CassError; - pub fn cass_iterator_get_user_type_field_value(iterator: - *const CassIterator) - -> *const CassValue; - pub fn cass_iterator_get_keyspace_meta(iterator: *const CassIterator) - -> *const CassKeyspaceMeta; - pub fn cass_iterator_get_table_meta(iterator: *const CassIterator) - -> *const CassTableMeta; - pub fn cass_iterator_get_materialized_view_meta(iterator: - *const CassIterator) - -> *const CassMaterializedViewMeta; - pub fn cass_iterator_get_user_type(iterator: *const CassIterator) - -> *const CassDataType; - pub fn cass_iterator_get_function_meta(iterator: *const CassIterator) - -> *const CassFunctionMeta; - pub fn cass_iterator_get_aggregate_meta(iterator: *const CassIterator) - -> *const CassAggregateMeta; - pub fn cass_iterator_get_column_meta(iterator: *const CassIterator) - -> *const CassColumnMeta; - pub fn cass_iterator_get_index_meta(iterator: *const CassIterator) - -> *const CassIndexMeta; +} +extern "C" { + + /// Gets the row at the result iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// row returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A row + pub fn cass_iterator_get_row(iterator: *const CassIterator) -> *const CassRow; +} +extern "C" { + + /// Gets the column value at the row iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// column returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A value + pub fn cass_iterator_get_column(iterator: *const CassIterator) -> *const CassValue; +} +extern "C" { + + /// Gets the value at a collection or tuple iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A value + pub fn cass_iterator_get_value(iterator: *const CassIterator) -> *const CassValue; +} +extern "C" { + + /// Gets the key at the map iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A value + pub fn cass_iterator_get_map_key(iterator: *const CassIterator) -> *const CassValue; +} +extern "C" { + + /// Gets the value at the map iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A value + pub fn cass_iterator_get_map_value(iterator: *const CassIterator) -> *const CassValue; +} +extern "C" { + + /// Gets the field name at the user type defined iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// name returned by this method. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @param[out] name + /// @param[out] name_length + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_iterator_get_user_type_field_name(iterator: *const CassIterator, + name: *mut *const ::std::os::raw::c_char, name_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Gets the field value at the user type defined iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A value + pub fn cass_iterator_get_user_type_field_value(iterator: *const CassIterator) -> *const CassValue; +} +extern "C" { + + /// Gets the keyspace metadata entry at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A keyspace metadata entry + pub fn cass_iterator_get_keyspace_meta(iterator: *const CassIterator) -> *const CassKeyspaceMeta; +} +extern "C" { + + /// Gets the table metadata entry at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A table metadata entry + pub fn cass_iterator_get_table_meta(iterator: *const CassIterator) -> *const CassTableMeta; +} +extern "C" { + + /// Gets the materialized view metadata entry at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @cassandra{3.0+} + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A materialized view metadata entry + pub fn cass_iterator_get_materialized_view_meta(iterator: *const CassIterator) -> *const CassMaterializedViewMeta; +} +extern "C" { + + /// Gets the type metadata entry at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A type metadata entry + pub fn cass_iterator_get_user_type(iterator: *const CassIterator) -> *const CassDataType; +} +extern "C" { + + /// Gets the function metadata entry at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A function metadata entry + pub fn cass_iterator_get_function_meta(iterator: *const CassIterator) -> *const CassFunctionMeta; +} +extern "C" { + + /// Gets the aggregate metadata entry at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A aggregate metadata entry + pub fn cass_iterator_get_aggregate_meta(iterator: *const CassIterator) -> *const CassAggregateMeta; +} +extern "C" { + + /// Gets the column metadata entry at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A column metadata entry + pub fn cass_iterator_get_column_meta(iterator: *const CassIterator) -> *const CassColumnMeta; +} +extern "C" { + + /// Gets the index metadata entry at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A index metadata entry + pub fn cass_iterator_get_index_meta(iterator: *const CassIterator) -> *const CassIndexMeta; +} +extern "C" { + + /// Gets the metadata field name at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @param[out] name + /// @param[out] name_length + /// @return CASS_OK if successful, otherwise error occurred pub fn cass_iterator_get_meta_field_name(iterator: *const CassIterator, - name: - *mut *const ::std::os::raw::c_char, - name_length: *mut size_t) - -> CassError; - pub fn cass_iterator_get_meta_field_value(iterator: *const CassIterator) - -> *const CassValue; - pub fn cass_row_get_column(row: *const CassRow, index: size_t) - -> *const CassValue; - pub fn cass_row_get_column_by_name(row: *const CassRow, - name: *const ::std::os::raw::c_char) - -> *const CassValue; - pub fn cass_row_get_column_by_name_n(row: *const CassRow, - name: *const ::std::os::raw::c_char, - name_length: size_t) - -> *const CassValue; - pub fn cass_value_data_type(value: *const CassValue) - -> *const CassDataType; - pub fn cass_value_get_int8(value: *const CassValue, - output: *mut cass_int8_t) -> CassError; - pub fn cass_value_get_int16(value: *const CassValue, - output: *mut cass_int16_t) -> CassError; - pub fn cass_value_get_int32(value: *const CassValue, - output: *mut cass_int32_t) -> CassError; - pub fn cass_value_get_uint32(value: *const CassValue, - output: *mut cass_uint32_t) -> CassError; - pub fn cass_value_get_int64(value: *const CassValue, - output: *mut cass_int64_t) -> CassError; - pub fn cass_value_get_float(value: *const CassValue, - output: *mut cass_float_t) -> CassError; - pub fn cass_value_get_double(value: *const CassValue, - output: *mut cass_double_t) -> CassError; - pub fn cass_value_get_bool(value: *const CassValue, - output: *mut cass_bool_t) -> CassError; - pub fn cass_value_get_uuid(value: *const CassValue, output: *mut CassUuid) - -> CassError; - pub fn cass_value_get_inet(value: *const CassValue, output: *mut CassInet) - -> CassError; - pub fn cass_value_get_string(value: *const CassValue, - output: *mut *const ::std::os::raw::c_char, - output_size: *mut size_t) -> CassError; - pub fn cass_value_get_bytes(value: *const CassValue, - output: *mut *const cass_byte_t, - output_size: *mut size_t) -> CassError; - pub fn cass_value_get_decimal(value: *const CassValue, - varint: *mut *const cass_byte_t, - varint_size: *mut size_t, - scale: *mut cass_int32_t) -> CassError; + name: *mut *const ::std::os::raw::c_char, name_length: *mut usize) + -> CassError; +} +extern "C" { + + /// Gets the metadata field value at the iterator's current position. + /// + /// Calling cass_iterator_next() will invalidate the previous + /// value returned by this method. + /// + /// @public @memberof CassIterator + /// + /// @param[in] iterator + /// @return A metadata field value + pub fn cass_iterator_get_meta_field_value(iterator: *const CassIterator) -> *const CassValue; +} +extern "C" { + + /// Get the column value at index for the specified row. + /// + /// @public @memberof CassRow + /// + /// @param[in] row + /// @param[in] index + /// @return The column value at the specified index. NULL is + /// returned if the index is out of bounds. + pub fn cass_row_get_column(row: *const CassRow, index: usize) -> *const CassValue; +} +extern "C" { + + /// Get the column value by name for the specified row. + /// + /// @public @memberof CassRow + /// + /// @param[in] row + /// @param[in] name + /// @return The column value for the specified name. NULL is + /// returned if the column does not exist. + pub fn cass_row_get_column_by_name(row: *const CassRow, name: *const ::std::os::raw::c_char) -> *const CassValue; +} +extern "C" { + + /// Same as cass_row_get_column_by_name(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassRow + /// + /// @param[in] row + /// @param[in] name + /// @param[in] name_length + /// @return same as cass_row_get_column_by_name() + /// + /// @see cass_row_get_column_by_name() + pub fn cass_row_get_column_by_name_n(row: *const CassRow, name: *const ::std::os::raw::c_char, + name_length: usize) + -> *const CassValue; +} +extern "C" { + + /// Gets the data type of a value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @return Returns a reference to the data type of the value. + /// Do not free this reference as it is bound to the lifetime of the value. + pub fn cass_value_data_type(value: *const CassValue) -> *const CassDataType; +} +extern "C" { + + /// Gets an int8 for the specified value. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_int8(value: *const CassValue, output: *mut cass_int8_t) -> CassError; +} +extern "C" { + + /// Gets an int16 for the specified value. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_int16(value: *const CassValue, output: *mut cass_int16_t) -> CassError; +} +extern "C" { + + /// Gets an int32 for the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_int32(value: *const CassValue, output: *mut cass_int32_t) -> CassError; +} +extern "C" { + + /// Gets an uint32 for the specified value. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_uint32(value: *const CassValue, output: *mut cass_uint32_t) -> CassError; +} +extern "C" { + + /// Gets an int64 for the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_int64(value: *const CassValue, output: *mut cass_int64_t) -> CassError; +} +extern "C" { + + /// Gets a float for the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_float(value: *const CassValue, output: *mut cass_float_t) -> CassError; +} +extern "C" { + + /// Gets a double for the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_double(value: *const CassValue, output: *mut cass_double_t) -> CassError; +} +extern "C" { + + /// Gets a bool for the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_bool(value: *const CassValue, output: *mut cass_bool_t) -> CassError; +} +extern "C" { + + /// Gets a UUID for the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_uuid(value: *const CassValue, output: *mut CassUuid) -> CassError; +} +extern "C" { + + /// Gets an INET for the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_inet(value: *const CassValue, output: *mut CassInet) -> CassError; +} +extern "C" { + + /// Gets a string for the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @param[out] output_size + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_string(value: *const CassValue, output: *mut *const ::std::os::raw::c_char, + output_size: *mut usize) + -> CassError; +} +extern "C" { + + /// Gets the bytes of the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] output + /// @param[out] output_size + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_bytes(value: *const CassValue, output: *mut *const cass_byte_t, output_size: *mut usize) + -> CassError; +} +extern "C" { + + /// Gets a decimal for the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @param[out] varint + /// @param[out] varint_size + /// @param[out] scale + /// @return CASS_OK if successful, otherwise error occurred + pub fn cass_value_get_decimal(value: *const CassValue, varint: *mut *const cass_byte_t, varint_size: *mut usize, + scale: *mut cass_int32_t) + -> CassError; +} +extern "C" { + + /// Gets the type of the specified value. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @return The type of the specified value. pub fn cass_value_type(value: *const CassValue) -> CassValueType; +} +extern "C" { + + /// Returns true if a specified value is null. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @return true if the value is null, otherwise false. pub fn cass_value_is_null(value: *const CassValue) -> cass_bool_t; +} +extern "C" { + + /// Returns true if a specified value is a collection. + /// + /// @public @memberof CassValue + /// + /// @param[in] value + /// @return true if the value is a collection, otherwise false. pub fn cass_value_is_collection(value: *const CassValue) -> cass_bool_t; - pub fn cass_value_item_count(collection: *const CassValue) -> size_t; - pub fn cass_value_primary_sub_type(collection: *const CassValue) - -> CassValueType; - pub fn cass_value_secondary_sub_type(collection: *const CassValue) - -> CassValueType; +} +extern "C" { + + /// Get the number of items in a collection. Works for all collection types. + /// + /// @public @memberof CassValue + /// + /// @param[in] collection + /// @return Count of items in a collection. 0 if not a collection. + pub fn cass_value_item_count(collection: *const CassValue) -> usize; +} +extern "C" { + + /// Get the primary sub-type for a collection. This returns the sub-type for a + /// list or set and the key type for a map. + /// + /// @public @memberof CassValue + /// + /// @param[in] collection + /// @return The type of the primary sub-type. CASS_VALUE_TYPE_UNKNOWN + /// returned if not a collection. + pub fn cass_value_primary_sub_type(collection: *const CassValue) -> CassValueType; +} +extern "C" { + + /// Get the secondary sub-type for a collection. This returns the value type for a + /// map. + /// + /// @public @memberof CassValue + /// + /// @param[in] collection + /// @return The type of the primary sub-type. CASS_VALUE_TYPE_UNKNOWN + /// returned if not a collection or not a map. + pub fn cass_value_secondary_sub_type(collection: *const CassValue) -> CassValueType; +} +extern "C" { + + /// Creates a new UUID generator. + /// + /// Note: This object is thread-safe. It is best practice to create and reuse + /// a single object per application. + /// + /// Note: If unique node information (IP address) is unable to be determined + /// then random node information will be generated. + /// + /// @public @memberof CassUuidGen + /// + /// @return Returns a UUID generator that must be freed. + /// + /// @see cass_uuid_gen_free() + /// @see cass_uuid_gen_new_with_node() pub fn cass_uuid_gen_new() -> *mut CassUuidGen; - pub fn cass_uuid_gen_new_with_node(node: cass_uint64_t) - -> *mut CassUuidGen; +} +extern "C" { + + /// Creates a new UUID generator with custom node information. + /// + /// Note: This object is thread-safe. It is best practice to create and reuse + /// a single object per application. + /// + /// @public @memberof CassUuidGen + /// + /// @return Returns a UUID generator that must be freed. + /// + /// @see cass_uuid_gen_free() + pub fn cass_uuid_gen_new_with_node(node: cass_uint64_t) -> *mut CassUuidGen; +} +extern "C" { + + /// Frees a UUID generator instance. + /// + /// @public @memberof CassUuidGen + /// + /// @param[in] uuid_gen pub fn cass_uuid_gen_free(uuid_gen: *mut CassUuidGen); - pub fn cass_uuid_gen_time(uuid_gen: *mut CassUuidGen, - output: *mut CassUuid); - pub fn cass_uuid_gen_random(uuid_gen: *mut CassUuidGen, - output: *mut CassUuid); - pub fn cass_uuid_gen_from_time(uuid_gen: *mut CassUuidGen, - timestamp: cass_uint64_t, - output: *mut CassUuid); - pub fn cass_uuid_min_from_time(time: cass_uint64_t, - output: *mut CassUuid); - pub fn cass_uuid_max_from_time(time: cass_uint64_t, - output: *mut CassUuid); +} +extern "C" { + + /// Generates a V1 (time) UUID. + /// + /// Note: This method is thread-safe + /// + /// @public @memberof CassUuidGen + /// + /// @param[in] uuid_gen + /// @param[out] output A V1 UUID for the current time. + pub fn cass_uuid_gen_time(uuid_gen: *mut CassUuidGen, output: *mut CassUuid); +} +extern "C" { + + /// Generates a new V4 (random) UUID + /// + /// Note:: This method is thread-safe + /// + /// @public @memberof CassUuidGen + /// + /// @param[in] uuid_gen + /// @param output A randomly generated V4 UUID. + pub fn cass_uuid_gen_random(uuid_gen: *mut CassUuidGen, output: *mut CassUuid); +} +extern "C" { + + /// Generates a V1 (time) UUID for the specified time. + /// + /// Note:: This method is thread-safe + /// + /// @public @memberof CassUuidGen + /// + /// @param[in] uuid_gen + /// @param[in] timestamp + /// @param[out] output A V1 UUID for the specified time. + pub fn cass_uuid_gen_from_time(uuid_gen: *mut CassUuidGen, timestamp: cass_uint64_t, output: *mut CassUuid); +} +extern "C" { + + /// Sets the UUID to the minimum V1 (time) value for the specified time. + /// + /// @public @memberof CassUuid + /// + /// @param[in] time + /// @param[out] output A minimum V1 UUID for the specified time. + pub fn cass_uuid_min_from_time(time: cass_uint64_t, output: *mut CassUuid); +} +extern "C" { + + /// Sets the UUID to the maximum V1 (time) value for the specified time. + /// + /// @public @memberof CassUuid + /// + /// @param[in] time + /// @param[out] output A maximum V1 UUID for the specified time. + pub fn cass_uuid_max_from_time(time: cass_uint64_t, output: *mut CassUuid); +} +extern "C" { + + /// Gets the timestamp for a V1 UUID + /// + /// @public @memberof CassUuid + /// + /// @param[in] uuid + /// @return The timestamp in milliseconds since the Epoch + /// (00:00:00 UTC on 1 January 1970). 0 returned if the UUID + /// is not V1. pub fn cass_uuid_timestamp(uuid: CassUuid) -> cass_uint64_t; +} +extern "C" { + + /// Gets the version for a UUID + /// + /// @public @memberof CassUuid + /// + /// @param[in] uuid + /// @return The version of the UUID (1 or 4) pub fn cass_uuid_version(uuid: CassUuid) -> cass_uint8_t; - pub fn cass_uuid_string(uuid: CassUuid, - output: *mut ::std::os::raw::c_char); - pub fn cass_uuid_from_string(str: *const ::std::os::raw::c_char, - output: *mut CassUuid) -> CassError; - pub fn cass_uuid_from_string_n(str: *const ::std::os::raw::c_char, - str_length: size_t, output: *mut CassUuid) - -> CassError; +} +extern "C" { + + /// Returns a null-terminated string for the specified UUID. + /// + /// @public @memberof CassUuid + /// + /// @param[in] uuid + /// @param[out] output A null-terminated string of length CASS_UUID_STRING_LENGTH. + pub fn cass_uuid_string(uuid: CassUuid, output: *mut ::std::os::raw::c_char); +} +extern "C" { + + /// Returns a UUID for the specified string. + /// + /// Example: "550e8400-e29b-41d4-a716-446655440000" + /// + /// @public @memberof CassUuid + /// + /// @param[in] str + /// @param[out] output + pub fn cass_uuid_from_string(str: *const ::std::os::raw::c_char, output: *mut CassUuid) -> CassError; +} +extern "C" { + + /// Same as cass_uuid_from_string(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassUuid + /// + /// @param[in] str + /// @param[in] str_length + /// @param[out] output + /// @return same as cass_uuid_from_string() + /// + /// @see cass_uuid_from_string() + pub fn cass_uuid_from_string_n(str: *const ::std::os::raw::c_char, str_length: usize, output: *mut CassUuid) + -> CassError; +} +extern "C" { + + /// Creates a new server-side timestamp generator. This generator allows Cassandra + /// to assign timestamps server-side. + /// + /// Note: This is the default timestamp generator. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTimestampGen + /// + /// @return Returns a timestamp generator that must be freed. + /// + /// @see cass_timestamp_gen_free() pub fn cass_timestamp_gen_server_side_new() -> *mut CassTimestampGen; +} +extern "C" { + + /// Creates a new monotonically increasing timestamp generator. This generates + /// microsecond timestamps with the sub-millisecond part generated using a counter. + /// The implementation guarantees that no more than 1000 timestamps will be generated + /// for a given clock tick even if shared by multiple session objects. If that rate is + /// exceeded then a warning is logged and timestamps stop incrementing until the next + /// clock tick. + /// + /// Note: This generator is thread-safe and can be shared by multiple sessions. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTimestampGen + /// + /// @return Returns a timestamp generator that must be freed. + /// + /// @see cass_timestamp_gen_free() pub fn cass_timestamp_gen_monotonic_new() -> *mut CassTimestampGen; +} +extern "C" { + + /// Frees a timestamp generator instance. + /// + /// @cassandra{2.1+} + /// + /// @public @memberof CassTimestampGen + /// + /// @param[in] timestamp_gen pub fn cass_timestamp_gen_free(timestamp_gen: *mut CassTimestampGen); +} +extern "C" { + + /// Creates a new default retry policy. + /// + /// This policy retries queries in the following cases: + ///
    + ///
  • On a read timeout, if enough replicas replied but data was not received.
  • + ///
  • On a write timeout, if a timeout occurs while writing the distributed batch log
  • + ///
  • On unavailable, it will move to the next host
  • + ///
+ /// + /// In all other cases the error will be returned. + /// + /// This policy always uses the query's original consistency level. + /// + /// @public @memberof CassRetryPolicy + /// + /// @return Returns a retry policy that must be freed. + /// + /// @see cass_retry_policy_free() pub fn cass_retry_policy_default_new() -> *mut CassRetryPolicy; - pub fn cass_retry_policy_downgrading_consistency_new() - -> *mut CassRetryPolicy; +} +extern "C" { + + /// Creates a new downgrading consistency retry policy. + /// + /// Important: This policy may attempt to retry requests with a lower + /// consistency level. Using this policy can break consistency guarantees. + /// + /// This policy will retry in the same scenarios as the default policy, but + /// it will also retry in the following cases: + ///
    + ///
  • On a read timeout, if some replicas responded but is lower than + /// required by the current consistency level then retry with a lower + /// consistency level.
  • + ///
  • On a write timeout, Retry unlogged batches at a lower consistency level + /// if at least one replica responded. For single queries and batch if any + /// replicas responded then consider the request successful and swallow the + /// error.
  • + ///
  • On unavailable, retry at a lower consistency if at lease one replica + /// responded.
  • + ///
+ /// + /// This goal of this policy is to attempt to save a request if there's any + /// chance of success. A writes succeeds as long as there's a single copy + /// persisted and a read will succeed if there's some data available even + /// if it increases the risk of reading stale data. + /// + /// @public @memberof CassRetryPolicy + /// + /// @return Returns a retry policy that must be freed. + /// + /// @see cass_retry_policy_free() + pub fn cass_retry_policy_downgrading_consistency_new() -> *mut CassRetryPolicy; +} +extern "C" { + + /// Creates a new fallthrough retry policy. + /// + /// This policy never retries or ignores a server-side failure. The error + /// is always returned. + /// + /// @public @memberof CassRetryPolicy + /// + /// @return Returns a retry policy that must be freed. + /// + /// @see cass_retry_policy_free() pub fn cass_retry_policy_fallthrough_new() -> *mut CassRetryPolicy; - pub fn cass_retry_policy_logging_new(child_retry_policy: - *mut CassRetryPolicy) - -> *mut CassRetryPolicy; +} +extern "C" { + + /// Creates a new logging retry policy. + /// + /// This policy logs the retry decision of its child policy. Logging is + /// done using CASS_LOG_INFO. + /// + /// @public @memberof CassRetryPolicy + /// + /// @param[in] child_retry_policy + /// @return Returns a retry policy that must be freed. NULL is returned if + /// the child_policy is a logging retry policy. + /// + /// @see cass_retry_policy_free() + pub fn cass_retry_policy_logging_new(child_retry_policy: *mut CassRetryPolicy) -> *mut CassRetryPolicy; +} +extern "C" { + + /// Frees a retry policy instance. + /// + /// @public @memberof CassRetryPolicy + /// + /// @param[in] policy pub fn cass_retry_policy_free(policy: *mut CassRetryPolicy); +} +extern "C" { + + /// Creates a new custom payload. + /// + /// @public @memberof CassCustomPayload + /// + /// @cassandra{2.2+} + /// + /// @return Returns a custom payload that must be freed. + /// + /// @see cass_custom_payload_free() pub fn cass_custom_payload_new() -> *mut CassCustomPayload; +} +extern "C" { + + /// Frees a custom payload instance. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassCustomPayload + /// + /// @param[in] payload pub fn cass_custom_payload_free(payload: *mut CassCustomPayload); - pub fn cass_custom_payload_set(payload: *mut CassCustomPayload, - name: *const ::std::os::raw::c_char, - value: *const cass_byte_t, - value_size: size_t); - pub fn cass_custom_payload_set_n(payload: *mut CassCustomPayload, - name: *const ::std::os::raw::c_char, - name_length: size_t, - value: *const cass_byte_t, - value_size: size_t); - pub fn cass_custom_payload_remove(payload: *mut CassCustomPayload, - name: *const ::std::os::raw::c_char); - pub fn cass_custom_payload_remove_n(payload: *mut CassCustomPayload, - name: *const ::std::os::raw::c_char, - name_length: size_t); - pub fn cass_consistency_string(consistency: CassConsistency) - -> *const ::std::os::raw::c_char; - pub fn cass_write_type_string(write_type: CassWriteType) - -> *const ::std::os::raw::c_char; +} +extern "C" { + + /// Sets an item to the custom payload. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassCustomPayload + /// + /// @param[in] payload + /// @param[in] name + /// @param[in] value + /// @param[in] value_size + pub fn cass_custom_payload_set(payload: *mut CassCustomPayload, name: *const ::std::os::raw::c_char, + value: *const cass_byte_t, value_size: usize); +} +extern "C" { + + /// Same as cass_custom_payload_set(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassCustomPayload + /// + /// @param[in] payload + /// @param[in] name + /// @param[in] name_length + /// @param[in] value + /// @param[in] value_size + pub fn cass_custom_payload_set_n(payload: *mut CassCustomPayload, name: *const ::std::os::raw::c_char, + name_length: usize, value: *const cass_byte_t, value_size: usize); +} +extern "C" { + + /// Removes an item from the custom payload. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassCustomPayload + /// + /// @param[in] payload + /// @param[in] name + pub fn cass_custom_payload_remove(payload: *mut CassCustomPayload, name: *const ::std::os::raw::c_char); +} +extern "C" { + + /// Same as cass_custom_payload_set(), but with lengths for string + /// parameters. + /// + /// @cassandra{2.2+} + /// + /// @public @memberof CassCustomPayload + /// + /// @param[in] payload + /// @param[in] name + /// @param[in] name_length + pub fn cass_custom_payload_remove_n(payload: *mut CassCustomPayload, name: *const ::std::os::raw::c_char, + name_length: usize); +} +extern "C" { + + /// Gets the string for a consistency. + /// + /// @param[in] consistency + /// @return A null-terminated string for the consistency. + /// Example: "ALL", "ONE", "QUORUM", etc. + pub fn cass_consistency_string(consistency: CassConsistency) -> *const ::std::os::raw::c_char; +} +extern "C" { + + /// Write type + /// + /// / + /// /** + /// Gets the string for a write type. + /// + /// @param[in] write_type + /// @return A null-terminated string for the write type. + /// Example: "BATCH", "SIMPLE", "COUNTER", etc. + pub fn cass_write_type_string(write_type: CassWriteType) -> *const ::std::os::raw::c_char; +} +extern "C" { + + /// Gets a description for an error code. + /// + /// @param[in] error + /// @return A null-terminated string describing the error. pub fn cass_error_desc(error: CassError) -> *const ::std::os::raw::c_char; +} +extern "C" { pub fn cass_log_cleanup(); +} +extern "C" { + + /// Sets the log level. + /// + /// Note: This needs to be done before any call that might log, such as + /// any of the cass_cluster_*() or cass_ssl_*() functions. + /// + /// Default: CASS_LOG_WARN + /// + /// @param[in] log_level pub fn cass_log_set_level(log_level: CassLogLevel); - pub fn cass_log_set_callback(callback: CassLogCallback, - data: *mut ::std::os::raw::c_void); - pub fn cass_log_set_queue_size(queue_size: size_t); - pub fn cass_log_level_string(log_level: CassLogLevel) - -> *const ::std::os::raw::c_char; +} +extern "C" { + + /// Sets a callback for handling logging events. + /// + /// Note: This needs to be done before any call that might log, such as + /// any of the cass_cluster_*() or cass_ssl_*() functions. + /// + /// Default: An internal callback that prints to stderr + /// + /// @param[in] data An opaque data object passed to the callback. + /// @param[in] callback A callback that handles logging events. This is + /// called in a separate thread so access to shared data must be synchronized. + pub fn cass_log_set_callback(callback: CassLogCallback, data: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn cass_log_set_queue_size(queue_size: usize); +} +extern "C" { + + /// Gets the string for a log level. + /// + /// @param[in] log_level + /// @return A null-terminated string for the log level. + /// Example: "ERROR", "WARN", "INFO", etc. + pub fn cass_log_level_string(log_level: CassLogLevel) -> *const ::std::os::raw::c_char; +} +extern "C" { + + /// Constructs an inet v4 object. + /// + /// @public @memberof CassInet + /// + /// @param[in] address An address of size CASS_INET_V4_LENGTH + /// @return An inet object. pub fn cass_inet_init_v4(address: *const cass_uint8_t) -> CassInet; +} +extern "C" { + + /// Constructs an inet v6 object. + /// + /// @public @memberof CassInet + /// + /// @param[in] address An address of size CASS_INET_V6_LENGTH + /// @return An inet object. pub fn cass_inet_init_v6(address: *const cass_uint8_t) -> CassInet; - pub fn cass_inet_string(inet: CassInet, - output: *mut ::std::os::raw::c_char); - pub fn cass_inet_from_string(str: *const ::std::os::raw::c_char, - output: *mut CassInet) -> CassError; - pub fn cass_inet_from_string_n(str: *const ::std::os::raw::c_char, - str_length: size_t, output: *mut CassInet) - -> CassError; +} +extern "C" { + + /// Returns a null-terminated string for the specified inet. + /// + /// @public @memberof CassInet + /// + /// @param[in] inet + /// @param[out] output A null-terminated string of length CASS_INET_STRING_LENGTH. + pub fn cass_inet_string(inet: CassInet, output: *mut ::std::os::raw::c_char); +} +extern "C" { + + /// Returns an inet for the specified string. + /// + /// Examples: "127.0.0.1" or "::1" + /// + /// @public @memberof CassInet + /// + /// @param[in] str + /// @param[out] output + pub fn cass_inet_from_string(str: *const ::std::os::raw::c_char, output: *mut CassInet) -> CassError; +} +extern "C" { + + /// Same as cass_inet_from_string(), but with lengths for string + /// parameters. + /// + /// @public @memberof CassInet + /// + /// @param[in] str + /// @param[in] str_length + /// @param[out] output + /// @return same as cass_inet_from_string() + /// + /// @see cass_inet_from_string() + pub fn cass_inet_from_string_n(str: *const ::std::os::raw::c_char, str_length: usize, output: *mut CassInet) + -> CassError; +} +extern "C" { + + /// Converts a unix timestamp (in seconds) to the Cassandra "date" type. The "date" type + /// represents the number of days since the Epoch (1970-01-01) with the Epoch centered at + /// the value 2^31. + /// + /// @cassandra{2.2+} + /// + /// @param[in] epoch_secs + /// @return the number of days since the date -5877641-06-23 pub fn cass_date_from_epoch(epoch_secs: cass_int64_t) -> cass_uint32_t; +} +extern "C" { + + /// Converts a unix timestamp (in seconds) to the Cassandra "time" type. The "time" type + /// represents the number of nanoseconds since midnight (range 0 to 86399999999999). + /// + /// @cassandra{2.2+} + /// + /// @param[in] epoch_secs + /// @return nanoseconds since midnight pub fn cass_time_from_epoch(epoch_secs: cass_int64_t) -> cass_int64_t; - pub fn cass_date_time_to_epoch(date: cass_uint32_t, time: cass_int64_t) - -> cass_int64_t; +} +extern "C" { + + /// Combines the Cassandra "date" and "time" types to Epoch time in seconds. + /// + /// @cassandra{2.2+} + /// + /// @param[in] date + /// @param[in] time + /// @return Epoch time in seconds. Negative times are possible if the date + /// occurs before the Epoch (1970-1-1). + pub fn cass_date_time_to_epoch(date: cass_uint32_t, time: cass_int64_t) -> cass_int64_t; } diff --git a/src/ffi_util.rs b/src/ffi_util.rs index 585166b..f8dbc20 100644 --- a/src/ffi_util.rs +++ b/src/ffi_util.rs @@ -1,7 +1,6 @@ use std::slice; use std::str; use cassandra::cass_bool_t; -use cassandra::CassValueType_; use std::str::Utf8Error; @@ -10,19 +9,6 @@ pub unsafe fn raw2utf8(data: *const i8, length: usize) -> Result bool { - let s: bool = self.clone().into(); - s == other.clone().into() - } -} - -impl PartialEq for CassValueType_ { - fn eq(&self, other: &CassValueType_) -> bool { - self == other - } -} - impl Into for cass_bool_t { fn into(self) -> bool { match self {