#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
pub const true_: u32 = 1;
pub const false_: u32 = 0;
pub const __bool_true_false_are_defined: u32 = 1;
#[repr(C)]
#[non_exhaustive]
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum Item_result {
INVALID_RESULT = -1,
STRING_RESULT = 0,
REAL_RESULT = 1,
INT_RESULT = 2,
ROW_RESULT = 3,
DECIMAL_RESULT = 4,
}
impl TryFrom<i32> for Item_result {
type Error = String;
fn try_from(value: i32) -> Result<Self, Self::Error> {
match value {
x if x == Self::INVALID_RESULT as i32 => Ok(Self::INVALID_RESULT),
x if x == Self::STRING_RESULT as i32 => Ok(Self::STRING_RESULT),
x if x == Self::REAL_RESULT as i32 => Ok(Self::REAL_RESULT),
x if x == Self::INT_RESULT as i32 => Ok(Self::INT_RESULT),
x if x == Self::ROW_RESULT as i32 => Ok(Self::ROW_RESULT),
x if x == Self::DECIMAL_RESULT as i32 => Ok(Self::DECIMAL_RESULT),
_ => Err(format!("invalid arg type {value} received")),
}
}
}
#[repr(C)]
#[derive(Debug, Clone)]
pub struct UDF_ARGS {
pub arg_count: ::std::ffi::c_uint,
pub arg_types: *mut Item_result,
pub args: *const *const ::std::ffi::c_char,
pub lengths: *const ::std::ffi::c_ulong,
pub maybe_null: *const ::std::ffi::c_char,
pub attributes: *const *const ::std::ffi::c_char,
pub attribute_lengths: *const ::std::ffi::c_ulong,
pub extension: *const ::std::ffi::c_void,
}
#[repr(C)]
#[derive(Debug, Clone)]
pub struct UDF_INIT {
pub maybe_null: bool,
pub decimals: ::std::ffi::c_uint,
pub max_length: ::std::ffi::c_ulong,
pub ptr: *mut ::std::ffi::c_char,
pub const_item: bool,
pub extension: *mut ::std::ffi::c_void,
}
#[repr(u32)]
#[non_exhaustive]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub enum Item_udftype {
UDFTYPE_FUNCTION = 1,
UDFTYPE_AGGREGATE = 2,
}
pub type Udf_func_init = Option<
unsafe extern "C" fn(
initid: *mut UDF_INIT,
args: *mut UDF_ARGS,
message: *mut ::std::ffi::c_char,
) -> bool,
>;
pub type Udf_func_deinit = Option<unsafe extern "C" fn(arg1: *mut UDF_INIT)>;
pub type Udf_func_add = Option<
unsafe extern "C" fn(
initid: *mut UDF_INIT,
args: *const UDF_ARGS,
is_null: *mut ::std::ffi::c_uchar,
error: *mut ::std::ffi::c_uchar,
),
>;
pub type Udf_func_clear = Option<
unsafe extern "C" fn(
initid: *mut UDF_INIT,
is_null: *mut ::std::ffi::c_uchar,
error: *mut ::std::ffi::c_uchar,
),
>;
pub type Udf_func_double = Option<
unsafe extern "C" fn(
initid: *mut UDF_INIT,
args: *const UDF_ARGS,
is_null: *mut ::std::ffi::c_uchar,
error: *mut ::std::ffi::c_uchar,
) -> ::std::ffi::c_double,
>;
pub type Udf_func_longlong = Option<
unsafe extern "C" fn(
initid: *mut UDF_INIT,
args: *const UDF_ARGS,
is_null: *mut ::std::ffi::c_uchar,
error: *mut ::std::ffi::c_uchar,
) -> ::std::ffi::c_longlong,
>;
pub type Udf_func_string = Option<
unsafe extern "C" fn(
initid: *mut UDF_INIT,
args: *const UDF_ARGS,
result: *mut ::std::ffi::c_char,
length: *mut ::std::ffi::c_ulong,
is_null: *mut ::std::ffi::c_uchar,
error: *mut ::std::ffi::c_uchar,
) -> *mut ::std::ffi::c_char,
>;
pub type Udf_func_any = Option<unsafe extern "C" fn()>;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn bindgen_test_layout_UDF_ARGS() {
assert_eq!(
::std::mem::size_of::<UDF_ARGS>(),
64usize,
concat!("Size of: ", stringify!(UDF_ARGS))
);
assert_eq!(
::std::mem::align_of::<UDF_ARGS>(),
8usize,
concat!("Alignment of ", stringify!(UDF_ARGS))
);
fn test_field_arg_count() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_ARGS>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).arg_count) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(UDF_ARGS),
"::",
stringify!(arg_count)
)
);
}
test_field_arg_count();
fn test_field_arg_type() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_ARGS>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).arg_types) as usize - ptr as usize
},
8usize,
concat!(
"Offset of field: ",
stringify!(UDF_ARGS),
"::",
stringify!(arg_type)
)
);
}
test_field_arg_type();
fn test_field_args() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_ARGS>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).args) as usize - ptr as usize
},
16usize,
concat!(
"Offset of field: ",
stringify!(UDF_ARGS),
"::",
stringify!(args)
)
);
}
test_field_args();
fn test_field_lengths() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_ARGS>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).lengths) as usize - ptr as usize
},
24usize,
concat!(
"Offset of field: ",
stringify!(UDF_ARGS),
"::",
stringify!(lengths)
)
);
}
test_field_lengths();
fn test_field_maybe_null() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_ARGS>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).maybe_null) as usize - ptr as usize
},
32usize,
concat!(
"Offset of field: ",
stringify!(UDF_ARGS),
"::",
stringify!(maybe_null)
)
);
}
test_field_maybe_null();
fn test_field_attributes() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_ARGS>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).attributes) as usize - ptr as usize
},
40usize,
concat!(
"Offset of field: ",
stringify!(UDF_ARGS),
"::",
stringify!(attributes)
)
);
}
test_field_attributes();
fn test_field_attribute_lengths() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_ARGS>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).attribute_lengths) as usize - ptr as usize
},
48usize,
concat!(
"Offset of field: ",
stringify!(UDF_ARGS),
"::",
stringify!(attribute_lengths)
)
);
}
test_field_attribute_lengths();
fn test_field_extension() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_ARGS>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).extension) as usize - ptr as usize
},
56usize,
concat!(
"Offset of field: ",
stringify!(UDF_ARGS),
"::",
stringify!(extension)
)
);
}
test_field_extension();
}
#[test]
fn bindgen_test_layout_UDF_INIT() {
assert_eq!(
::std::mem::size_of::<UDF_INIT>(),
40usize,
concat!("Size of: ", stringify!(UDF_INIT))
);
assert_eq!(
::std::mem::align_of::<UDF_INIT>(),
8usize,
concat!("Alignment of ", stringify!(UDF_INIT))
);
fn test_field_maybe_null() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_INIT>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).maybe_null) as usize - ptr as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(UDF_INIT),
"::",
stringify!(maybe_null)
)
);
}
test_field_maybe_null();
fn test_field_decimals() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_INIT>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).decimals) as usize - ptr as usize
},
4usize,
concat!(
"Offset of field: ",
stringify!(UDF_INIT),
"::",
stringify!(decimals)
)
);
}
test_field_decimals();
fn test_field_max_length() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_INIT>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).max_length) as usize - ptr as usize
},
8usize,
concat!(
"Offset of field: ",
stringify!(UDF_INIT),
"::",
stringify!(max_length)
)
);
}
test_field_max_length();
fn test_field_ptr() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_INIT>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).ptr) as usize - ptr as usize
},
16usize,
concat!(
"Offset of field: ",
stringify!(UDF_INIT),
"::",
stringify!(ptr)
)
);
}
test_field_ptr();
fn test_field_const_item() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_INIT>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).const_item) as usize - ptr as usize
},
24usize,
concat!(
"Offset of field: ",
stringify!(UDF_INIT),
"::",
stringify!(const_item)
)
);
}
test_field_const_item();
fn test_field_extension() {
assert_eq!(
unsafe {
let uninit = ::std::mem::MaybeUninit::<UDF_INIT>::uninit();
let ptr = uninit.as_ptr();
::std::ptr::addr_of!((*ptr).extension) as usize - ptr as usize
},
32usize,
concat!(
"Offset of field: ",
stringify!(UDF_INIT),
"::",
stringify!(extension)
)
);
}
test_field_extension();
}
}