/* automatically generated by rust-bindgen 0.70.1 */
pub const true_: u32 = 1;
pub const false_: u32 = 0;
pub const __bool_true_false_are_defined: u32 = 1;
pub const _STDINT_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const __GLIBC_USE_ISOC2X: u32 = 0;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
pub const __USE_POSIX_IMPLICITLY: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
pub const _POSIX_C_SOURCE: u32 = 200809;
pub const __USE_POSIX: u32 = 1;
pub const __USE_POSIX2: u32 = 1;
pub const __USE_POSIX199309: u32 = 1;
pub const __USE_POSIX199506: u32 = 1;
pub const __USE_XOPEN2K: u32 = 1;
pub const __USE_XOPEN2K8: u32 = 1;
pub const _ATFILE_SOURCE: u32 = 1;
pub const __USE_MISC: u32 = 1;
pub const __USE_ATFILE: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 31;
pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
pub const __SYSCALL_WORDSIZE: u32 = 64;
pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0;
pub const __HAVE_GENERIC_SELECTION: u32 = 1;
pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0;
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
pub const _BITS_TYPES_H: u32 = 1;
pub const __TIMESIZE: u32 = 64;
pub const _BITS_TYPESIZES_H: u32 = 1;
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
pub const __STATFS_MATCHES_STATFS64: u32 = 1;
pub const __FD_SETSIZE: u32 = 1024;
pub const _BITS_TIME64_H: u32 = 1;
pub const _BITS_WCHAR_H: u32 = 1;
pub const _BITS_STDINT_INTN_H: u32 = 1;
pub const _BITS_STDINT_UINTN_H: u32 = 1;
pub const INT8_MIN: i32 = -128;
pub const INT16_MIN: i32 = -32768;
pub const INT32_MIN: i32 = -2147483648;
pub const INT8_MAX: u32 = 127;
pub const INT16_MAX: u32 = 32767;
pub const INT32_MAX: u32 = 2147483647;
pub const UINT8_MAX: u32 = 255;
pub const UINT16_MAX: u32 = 65535;
pub const UINT32_MAX: u32 = 4294967295;
pub const INT_LEAST8_MIN: i32 = -128;
pub const INT_LEAST16_MIN: i32 = -32768;
pub const INT_LEAST32_MIN: i32 = -2147483648;
pub const INT_LEAST8_MAX: u32 = 127;
pub const INT_LEAST16_MAX: u32 = 32767;
pub const INT_LEAST32_MAX: u32 = 2147483647;
pub const UINT_LEAST8_MAX: u32 = 255;
pub const UINT_LEAST16_MAX: u32 = 65535;
pub const UINT_LEAST32_MAX: u32 = 4294967295;
pub const INT_FAST8_MIN: i32 = -128;
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
pub const INT_FAST8_MAX: u32 = 127;
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
pub const UINT_FAST8_MAX: u32 = 255;
pub const UINT_FAST16_MAX: i32 = -1;
pub const UINT_FAST32_MAX: i32 = -1;
pub const INTPTR_MIN: i64 = -9223372036854775808;
pub const INTPTR_MAX: u64 = 9223372036854775807;
pub const UINTPTR_MAX: i32 = -1;
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
pub const SIZE_MAX: i32 = -1;
pub const WINT_MIN: u32 = 0;
pub const WINT_MAX: u32 = 4294967295;
pub type wchar_t = ::std::os::raw::c_int;
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Copy, Clone)]
pub struct max_align_t {
pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
pub __bindgen_padding_0: u64,
pub __clang_max_align_nonce2: u128,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of max_align_t"][::std::mem::size_of::<max_align_t>() - 32usize];
["Alignment of max_align_t"][::std::mem::align_of::<max_align_t>() - 16usize];
["Offset of field: max_align_t::__clang_max_align_nonce1"]
[::std::mem::offset_of!(max_align_t, __clang_max_align_nonce1) - 0usize];
["Offset of field: max_align_t::__clang_max_align_nonce2"]
[::std::mem::offset_of!(max_align_t, __clang_max_align_nonce2) - 16usize];
};
pub type __u_char = ::std::os::raw::c_uchar;
pub type __u_short = ::std::os::raw::c_ushort;
pub type __u_int = ::std::os::raw::c_uint;
pub type __u_long = ::std::os::raw::c_ulong;
pub type __int8_t = ::std::os::raw::c_schar;
pub type __uint8_t = ::std::os::raw::c_uchar;
pub type __int16_t = ::std::os::raw::c_short;
pub type __uint16_t = ::std::os::raw::c_ushort;
pub type __int32_t = ::std::os::raw::c_int;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __int64_t = ::std::os::raw::c_long;
pub type __uint64_t = ::std::os::raw::c_ulong;
pub type __int_least8_t = __int8_t;
pub type __uint_least8_t = __uint8_t;
pub type __int_least16_t = __int16_t;
pub type __uint_least16_t = __uint16_t;
pub type __int_least32_t = __int32_t;
pub type __uint_least32_t = __uint32_t;
pub type __int_least64_t = __int64_t;
pub type __uint_least64_t = __uint64_t;
pub type __quad_t = ::std::os::raw::c_long;
pub type __u_quad_t = ::std::os::raw::c_ulong;
pub type __intmax_t = ::std::os::raw::c_long;
pub type __uintmax_t = ::std::os::raw::c_ulong;
pub type __dev_t = ::std::os::raw::c_ulong;
pub type __uid_t = ::std::os::raw::c_uint;
pub type __gid_t = ::std::os::raw::c_uint;
pub type __ino_t = ::std::os::raw::c_ulong;
pub type __ino64_t = ::std::os::raw::c_ulong;
pub type __mode_t = ::std::os::raw::c_uint;
pub type __nlink_t = ::std::os::raw::c_ulong;
pub type __off_t = ::std::os::raw::c_long;
pub type __off64_t = ::std::os::raw::c_long;
pub type __pid_t = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __fsid_t {
pub __val: [::std::os::raw::c_int; 2usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of __fsid_t"][::std::mem::size_of::<__fsid_t>() - 8usize];
["Alignment of __fsid_t"][::std::mem::align_of::<__fsid_t>() - 4usize];
["Offset of field: __fsid_t::__val"][::std::mem::offset_of!(__fsid_t, __val) - 0usize];
};
pub type __clock_t = ::std::os::raw::c_long;
pub type __rlim_t = ::std::os::raw::c_ulong;
pub type __rlim64_t = ::std::os::raw::c_ulong;
pub type __id_t = ::std::os::raw::c_uint;
pub type __time_t = ::std::os::raw::c_long;
pub type __useconds_t = ::std::os::raw::c_uint;
pub type __suseconds_t = ::std::os::raw::c_long;
pub type __daddr_t = ::std::os::raw::c_int;
pub type __key_t = ::std::os::raw::c_int;
pub type __clockid_t = ::std::os::raw::c_int;
pub type __timer_t = *mut ::std::os::raw::c_void;
pub type __blksize_t = ::std::os::raw::c_long;
pub type __blkcnt_t = ::std::os::raw::c_long;
pub type __blkcnt64_t = ::std::os::raw::c_long;
pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
pub type __fsword_t = ::std::os::raw::c_long;
pub type __ssize_t = ::std::os::raw::c_long;
pub type __syscall_slong_t = ::std::os::raw::c_long;
pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
pub type __loff_t = __off64_t;
pub type __caddr_t = *mut ::std::os::raw::c_char;
pub type __intptr_t = ::std::os::raw::c_long;
pub type __socklen_t = ::std::os::raw::c_uint;
pub type __sig_atomic_t = ::std::os::raw::c_int;
pub type int_least8_t = __int_least8_t;
pub type int_least16_t = __int_least16_t;
pub type int_least32_t = __int_least32_t;
pub type int_least64_t = __int_least64_t;
pub type uint_least8_t = __uint_least8_t;
pub type uint_least16_t = __uint_least16_t;
pub type uint_least32_t = __uint_least32_t;
pub type uint_least64_t = __uint_least64_t;
pub type int_fast8_t = ::std::os::raw::c_schar;
pub type int_fast16_t = ::std::os::raw::c_long;
pub type int_fast32_t = ::std::os::raw::c_long;
pub type int_fast64_t = ::std::os::raw::c_long;
pub type uint_fast8_t = ::std::os::raw::c_uchar;
pub type uint_fast16_t = ::std::os::raw::c_ulong;
pub type uint_fast32_t = ::std::os::raw::c_ulong;
pub type uint_fast64_t = ::std::os::raw::c_ulong;
pub type intmax_t = __intmax_t;
pub type uintmax_t = __uintmax_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct local_result {
pub buf: *mut ::std::os::raw::c_char,
pub len: usize,
pub _vec: *mut ::std::os::raw::c_void,
pub elapsed: f64,
pub rows_read: u64,
pub bytes_read: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of local_result"][::std::mem::size_of::<local_result>() - 48usize];
["Alignment of local_result"][::std::mem::align_of::<local_result>() - 8usize];
["Offset of field: local_result::buf"][::std::mem::offset_of!(local_result, buf) - 0usize];
["Offset of field: local_result::len"][::std::mem::offset_of!(local_result, len) - 8usize];
["Offset of field: local_result::_vec"][::std::mem::offset_of!(local_result, _vec) - 16usize];
["Offset of field: local_result::elapsed"]
[::std::mem::offset_of!(local_result, elapsed) - 24usize];
["Offset of field: local_result::rows_read"]
[::std::mem::offset_of!(local_result, rows_read) - 32usize];
["Offset of field: local_result::bytes_read"]
[::std::mem::offset_of!(local_result, bytes_read) - 40usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct local_result_v2 {
pub buf: *mut ::std::os::raw::c_char,
pub len: usize,
pub _vec: *mut ::std::os::raw::c_void,
pub elapsed: f64,
pub rows_read: u64,
pub bytes_read: u64,
pub error_message: *mut ::std::os::raw::c_char,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of local_result_v2"][::std::mem::size_of::<local_result_v2>() - 56usize];
["Alignment of local_result_v2"][::std::mem::align_of::<local_result_v2>() - 8usize];
["Offset of field: local_result_v2::buf"]
[::std::mem::offset_of!(local_result_v2, buf) - 0usize];
["Offset of field: local_result_v2::len"]
[::std::mem::offset_of!(local_result_v2, len) - 8usize];
["Offset of field: local_result_v2::_vec"]
[::std::mem::offset_of!(local_result_v2, _vec) - 16usize];
["Offset of field: local_result_v2::elapsed"]
[::std::mem::offset_of!(local_result_v2, elapsed) - 24usize];
["Offset of field: local_result_v2::rows_read"]
[::std::mem::offset_of!(local_result_v2, rows_read) - 32usize];
["Offset of field: local_result_v2::bytes_read"]
[::std::mem::offset_of!(local_result_v2, bytes_read) - 40usize];
["Offset of field: local_result_v2::error_message"]
[::std::mem::offset_of!(local_result_v2, error_message) - 48usize];
};
#[doc = " Connection structure for chDB\n Contains server instance, connection state, and query processing queue"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct chdb_conn {
pub server: *mut ::std::os::raw::c_void,
pub connected: bool,
pub queue: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of chdb_conn"][::std::mem::size_of::<chdb_conn>() - 24usize];
["Alignment of chdb_conn"][::std::mem::align_of::<chdb_conn>() - 8usize];
["Offset of field: chdb_conn::server"][::std::mem::offset_of!(chdb_conn, server) - 0usize];
["Offset of field: chdb_conn::connected"]
[::std::mem::offset_of!(chdb_conn, connected) - 8usize];
["Offset of field: chdb_conn::queue"][::std::mem::offset_of!(chdb_conn, queue) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct chdb_streaming_result {
pub internal_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of chdb_streaming_result"][::std::mem::size_of::<chdb_streaming_result>() - 8usize];
["Alignment of chdb_streaming_result"]
[::std::mem::align_of::<chdb_streaming_result>() - 8usize];
["Offset of field: chdb_streaming_result::internal_data"]
[::std::mem::offset_of!(chdb_streaming_result, internal_data) - 0usize];
};
pub const chdb_state_CHDBSuccess: chdb_state = 0;
pub const chdb_state_CHDBError: chdb_state = 1;
pub type chdb_state = ::std::os::raw::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct chdb_result_ {
pub internal_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of chdb_result_"][::std::mem::size_of::<chdb_result_>() - 8usize];
["Alignment of chdb_result_"][::std::mem::align_of::<chdb_result_>() - 8usize];
["Offset of field: chdb_result_::internal_data"]
[::std::mem::offset_of!(chdb_result_, internal_data) - 0usize];
};
pub type chdb_result = chdb_result_;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct chdb_connection_ {
pub internal_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of chdb_connection_"][::std::mem::size_of::<chdb_connection_>() - 8usize];
["Alignment of chdb_connection_"][::std::mem::align_of::<chdb_connection_>() - 8usize];
["Offset of field: chdb_connection_::internal_data"]
[::std::mem::offset_of!(chdb_connection_, internal_data) - 0usize];
};
pub type chdb_connection = *mut chdb_connection_;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct chdb_arrow_stream_ {
pub internal_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of chdb_arrow_stream_"][::std::mem::size_of::<chdb_arrow_stream_>() - 8usize];
["Alignment of chdb_arrow_stream_"][::std::mem::align_of::<chdb_arrow_stream_>() - 8usize];
["Offset of field: chdb_arrow_stream_::internal_data"]
[::std::mem::offset_of!(chdb_arrow_stream_, internal_data) - 0usize];
};
pub type chdb_arrow_stream = *mut chdb_arrow_stream_;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct chdb_arrow_schema_ {
pub internal_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of chdb_arrow_schema_"][::std::mem::size_of::<chdb_arrow_schema_>() - 8usize];
["Alignment of chdb_arrow_schema_"][::std::mem::align_of::<chdb_arrow_schema_>() - 8usize];
["Offset of field: chdb_arrow_schema_::internal_data"]
[::std::mem::offset_of!(chdb_arrow_schema_, internal_data) - 0usize];
};
pub type chdb_arrow_schema = *mut chdb_arrow_schema_;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct chdb_arrow_array_ {
pub internal_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of chdb_arrow_array_"][::std::mem::size_of::<chdb_arrow_array_>() - 8usize];
["Alignment of chdb_arrow_array_"][::std::mem::align_of::<chdb_arrow_array_>() - 8usize];
["Offset of field: chdb_arrow_array_::internal_data"]
[::std::mem::offset_of!(chdb_arrow_array_, internal_data) - 0usize];
};
pub type chdb_arrow_array = *mut chdb_arrow_array_;
extern "C" {
pub fn query_stable(
argc: ::std::os::raw::c_int,
argv: *mut *mut ::std::os::raw::c_char,
) -> *mut local_result;
}
extern "C" {
pub fn free_result(result: *mut local_result);
}
extern "C" {
pub fn query_stable_v2(
argc: ::std::os::raw::c_int,
argv: *mut *mut ::std::os::raw::c_char,
) -> *mut local_result_v2;
}
extern "C" {
pub fn free_result_v2(result: *mut local_result_v2);
}
extern "C" {
#[doc = " Creates a new chDB connection.\n Only one active connection is allowed per process.\n Creating a new connection with different path requires closing existing connection.\n\n @param argc Number of command-line arguments\n @param argv Command-line arguments array (--path=<db_path> to specify database location)\n @return Pointer to connection pointer, or NULL on failure\n @note Default path is \":memory:\" if not specified"]
pub fn connect_chdb(
argc: ::std::os::raw::c_int,
argv: *mut *mut ::std::os::raw::c_char,
) -> *mut *mut chdb_conn;
}
extern "C" {
#[doc = " Closes an existing chDB connection and cleans up resources.\n Thread-safe function that handles connection shutdown and cleanup.\n\n @param conn Pointer to connection pointer to close"]
pub fn close_conn(conn: *mut *mut chdb_conn);
}
extern "C" {
#[doc = " Executes a query on the given connection.\n Thread-safe function that handles query execution in a separate thread.\n\n @param conn Connection to execute query on\n @param query SQL query string to execute\n @param format Output format string (e.g., \"CSV\", default format)\n @return Query result structure containing output or error message\n @note Returns error result if connection is invalid or closed"]
pub fn query_conn(
conn: *mut chdb_conn,
query: *const ::std::os::raw::c_char,
format: *const ::std::os::raw::c_char,
) -> *mut local_result_v2;
}
extern "C" {
#[doc = " Executes a query on the given connection with explicit length parameters.\n @brief Thread-safe query execution with binary-safe string handling\n @param conn Connection to execute query on\n @param query SQL query string to execute (may contain null bytes)\n @param query_len Length of query string in bytes\n @param format Output format string (e.g., \"CSV\", default format)\n @param format_len Length of format string in bytes\n @return Query result structure containing output or error message\n @note Returns error result if connection is invalid or closed\n @note This function is binary-safe and can handle queries containing null bytes"]
pub fn query_conn_n(
conn: *mut chdb_conn,
query: *const ::std::os::raw::c_char,
query_len: usize,
format: *const ::std::os::raw::c_char,
format_len: usize,
) -> *mut local_result_v2;
}
extern "C" {
#[doc = " Executes a streaming query on the given connection.\n @brief Initializes streaming query execution and returns result handle\n @param conn Connection to execute query on\n @param query SQL query string to execute\n @param format Output format string (e.g. \"CSV\", default format)\n @return Streaming result handle containing query state or error message\n @note Returns error result if connection is invalid or closed"]
pub fn query_conn_streaming(
conn: *mut chdb_conn,
query: *const ::std::os::raw::c_char,
format: *const ::std::os::raw::c_char,
) -> *mut chdb_streaming_result;
}
extern "C" {
#[doc = " Executes a streaming query on the given connection with explicit length parameters.\n @brief Initializes streaming query execution with binary-safe string handling\n @param conn Connection to execute query on\n @param query SQL query string to execute (may contain null bytes)\n @param query_len Length of query string in bytes\n @param format Output format string (e.g., \"CSV\", default format)\n @param format_len Length of format string in bytes\n @return Streaming result handle containing query state or error message\n @note Returns error result if connection is invalid or closed\n @note This function is binary-safe and can handle queries containing null bytes\n @note Use chdb_streaming_fetch_result() to retrieve data chunks from the streaming query"]
pub fn query_conn_streaming_n(
conn: *mut chdb_conn,
query: *const ::std::os::raw::c_char,
query_len: usize,
format: *const ::std::os::raw::c_char,
format_len: usize,
) -> *mut chdb_streaming_result;
}
extern "C" {
#[doc = " Retrieves error message from streaming result.\n @brief Gets error message associated with streaming query execution\n @param result Streaming result handle from query_conn_streaming()\n @return Null-terminated error message string, or NULL if no error occurred"]
pub fn chdb_streaming_result_error(
result: *mut chdb_streaming_result,
) -> *const ::std::os::raw::c_char;
}
extern "C" {
#[doc = " Fetches next chunk of streaming results.\n @brief Iterates through streaming query results\n @param conn Active connection handle\n @param result Streaming result handle from query_conn_streaming()\n @return Materialized result chunk with data\n @note Returns empty result when stream ends"]
pub fn chdb_streaming_fetch_result(
conn: *mut chdb_conn,
result: *mut chdb_streaming_result,
) -> *mut local_result_v2;
}
extern "C" {
#[doc = " Cancels ongoing streaming query.\n @brief Aborts streaming query execution and cleans up resources\n @param conn Active connection handle\n @param result Streaming result handle to cancel"]
pub fn chdb_streaming_cancel_query(conn: *mut chdb_conn, result: *mut chdb_streaming_result);
}
extern "C" {
#[doc = " Releases resources associated with streaming result.\n @brief Destroys streaming result handle and frees allocated memory\n @param result Streaming result handle to destroy\n @warning Must be called even if query was finished or canceled"]
pub fn chdb_destroy_result(result: *mut chdb_streaming_result);
}
extern "C" {
#[doc = " Creates a new chDB connection.\n Only one active connection is allowed per process.\n Creating a new connection with different path requires closing existing connection.\n\n @param argc Number of command-line arguments\n @param argv Command-line arguments array (--path=<db_path> to specify database location)\n @return Pointer to connection pointer, or NULL on failure\n @note Default path is \":memory:\" if not specified"]
pub fn chdb_connect(
argc: ::std::os::raw::c_int,
argv: *mut *mut ::std::os::raw::c_char,
) -> *mut chdb_connection;
}
extern "C" {
#[doc = " Closes an existing chDB connection and cleans up resources.\n Thread-safe function that handles connection shutdown and cleanup.\n\n @param conn Pointer to connection pointer to close"]
pub fn chdb_close_conn(conn: *mut chdb_connection);
}
extern "C" {
#[doc = " Executes a query on the given connection.\n Thread-safe function that handles query execution in a separate thread.\n\n @param conn Connection to execute query on\n @param query SQL query string to execute\n @param format Output format string (e.g., \"CSV\", default format)\n @return Query result structure containing output or error message\n @note Returns error result if connection is invalid or closed"]
pub fn chdb_query(
conn: chdb_connection,
query: *const ::std::os::raw::c_char,
format: *const ::std::os::raw::c_char,
) -> *mut chdb_result;
}
extern "C" {
#[doc = " Executes a query on the given connection with explicit length parameters.\n @brief Thread-safe query execution with binary-safe string handling\n @param conn Connection to execute query on\n @param query SQL query string to execute (may contain null bytes)\n @param query_len Length of query string in bytes\n @param format Output format string (e.g., \"CSV\", default format)\n @param format_len Length of format string in bytes\n @return Query result structure containing output or error message\n @note Returns error result if connection is invalid or closed\n @note This function is binary-safe and can handle queries containing null bytes\n @note Use chdb_result_* functions to access result data and metadata"]
pub fn chdb_query_n(
conn: chdb_connection,
query: *const ::std::os::raw::c_char,
query_len: usize,
format: *const ::std::os::raw::c_char,
format_len: usize,
) -> *mut chdb_result;
}
extern "C" {
#[doc = " @brief Execute a query with command-line interface\n @param argc Argument count (same as main()'s argc)\n @param argv Argument vector (same as main()'s argv)\n @return Query result structure containing output or error message"]
pub fn chdb_query_cmdline(
argc: ::std::os::raw::c_int,
argv: *mut *mut ::std::os::raw::c_char,
) -> *mut chdb_result;
}
extern "C" {
#[doc = " Executes a streaming query on the given connection.\n @brief Initializes streaming query execution and returns result handle\n @param conn Connection to execute query on\n @param query SQL query string to execute\n @param format Output format string (e.g. \"CSV\", default format)\n @return Streaming result handle containing query state or error message\n @note Returns error result if connection is invalid or closed"]
pub fn chdb_stream_query(
conn: chdb_connection,
query: *const ::std::os::raw::c_char,
format: *const ::std::os::raw::c_char,
) -> *mut chdb_result;
}
extern "C" {
#[doc = " Executes a streaming query with explicit string lengths (binary-safe).\n @brief Initializes streaming query execution with specified buffer lengths\n @param conn Connection to execute query on\n @param query SQL query buffer (may contain null bytes)\n @param query_len Length of query buffer in bytes\n @param format Output format buffer (may contain null bytes)\n @param format_len Length of format buffer in bytes\n @return Streaming result handle containing query state or error message\n @note Strings do not need to be null-terminated\n @note Use this function when dealing with queries/formats containing null bytes"]
pub fn chdb_stream_query_n(
conn: chdb_connection,
query: *const ::std::os::raw::c_char,
query_len: usize,
format: *const ::std::os::raw::c_char,
format_len: usize,
) -> *mut chdb_result;
}
extern "C" {
#[doc = " Fetches next chunk of streaming results.\n @brief Iterates through streaming query results\n @param conn Active connection handle\n @param result Streaming result handle from query_conn_streaming()\n @return Materialized result chunk with data\n @note Returns empty result when stream ends"]
pub fn chdb_stream_fetch_result(
conn: chdb_connection,
result: *mut chdb_result,
) -> *mut chdb_result;
}
extern "C" {
#[doc = " Cancels ongoing streaming query.\n @brief Aborts streaming query execution and cleans up resources\n @param conn Active connection handle\n @param result Streaming result handle to cancel"]
pub fn chdb_stream_cancel_query(conn: chdb_connection, result: *mut chdb_result);
}
extern "C" {
#[doc = " Destroys a query result and releases all associated resources\n @param result The result handle to destroy"]
pub fn chdb_destroy_query_result(result: *mut chdb_result);
}
extern "C" {
#[doc = " Gets pointer to the result data buffer\n @param result The query result handle\n @return Read-only pointer to the result data"]
pub fn chdb_result_buffer(result: *mut chdb_result) -> *mut ::std::os::raw::c_char;
}
extern "C" {
#[doc = " Gets the length of the result data\n @param result The query result handle\n @return Size of result data in bytes"]
pub fn chdb_result_length(result: *mut chdb_result) -> usize;
}
extern "C" {
#[doc = " Gets query execution time\n @param result The query result handle\n @return Elapsed time in seconds"]
pub fn chdb_result_elapsed(result: *mut chdb_result) -> f64;
}
extern "C" {
#[doc = " Gets total rows in query result\n @param result The query result handle\n @return Number of rows contained in the result set"]
pub fn chdb_result_rows_read(result: *mut chdb_result) -> u64;
}
extern "C" {
#[doc = " Gets the total bytes occupied by the result set in internal binary format\n @param result The query result handle\n @return Number of bytes occupied by the result set in internal binary representation"]
pub fn chdb_result_bytes_read(result: *mut chdb_result) -> u64;
}
extern "C" {
#[doc = " Gets rows read from storage engine\n @param result The query result handle\n @return Number of rows read from storage"]
pub fn chdb_result_storage_rows_read(result: *mut chdb_result) -> u64;
}
extern "C" {
#[doc = " Gets bytes read from storage engine\n @param result The query result handle\n @return Number of bytes read from storage engine"]
pub fn chdb_result_storage_bytes_read(result: *mut chdb_result) -> u64;
}
extern "C" {
#[doc = " Retrieves error message from query execution\n @param result The query result handle\n @return Null-terminated error description, NULL if no error"]
pub fn chdb_result_error(result: *mut chdb_result) -> *const ::std::os::raw::c_char;
}
extern "C" {
#[doc = " Registers an Arrow stream as an arrow stream table function with the given name\n @param conn The connection on which to execute the registration\n @param table_name Name to register for the arrow stream table function\n @param arrow_stream chdb Arrow stream handle\n @return CHDBSuccess on success, CHDBError on failure"]
pub fn chdb_arrow_scan(
conn: chdb_connection,
table_name: *const ::std::os::raw::c_char,
arrow_stream: chdb_arrow_stream,
) -> chdb_state;
}
extern "C" {
#[doc = " Registers an Arrow array as an arrow stream table function with the given name\n @param conn The connection on which to execute the registration\n @param table_name Name to register for the arrow stream table function\n @param arrow_schema chdb Arrow schema handle\n @param arrow_array chdb Arrow array handle\n @return CHDBSuccess on success, CHDBError on failure"]
pub fn chdb_arrow_array_scan(
conn: chdb_connection,
table_name: *const ::std::os::raw::c_char,
arrow_schema: chdb_arrow_schema,
arrow_array: chdb_arrow_array,
) -> chdb_state;
}
extern "C" {
#[doc = " Unregisters an arrow stream table function that was previously registered via chdb_arrow_scan\n @param conn The connection on which to execute the unregister operation\n @param table_name Name of the arrow stream table function to unregister\n @return CHDBSuccess on success, CHDBError on failure"]
pub fn chdb_arrow_unregister_table(
conn: chdb_connection,
table_name: *const ::std::os::raw::c_char,
) -> chdb_state;
}