2023-01-13 18:02:32 +03:00
|
|
|
module mysql
|
|
|
|
|
2023-05-25 03:50:15 +03:00
|
|
|
// get_error_msg returns error message from MySQL instance.
|
2023-01-13 18:02:32 +03:00
|
|
|
fn get_error_msg(conn &C.MYSQL) string {
|
|
|
|
return unsafe { C.mysql_error(conn).vstring() }
|
|
|
|
}
|
|
|
|
|
2023-05-25 03:50:15 +03:00
|
|
|
// get_errno returns error number from MySQL instance.
|
2023-01-13 18:02:32 +03:00
|
|
|
fn get_errno(conn &C.MYSQL) int {
|
|
|
|
return C.mysql_errno(conn)
|
|
|
|
}
|
|
|
|
|
2023-05-25 03:50:15 +03:00
|
|
|
// resolve_nil_str returns an empty string if passed value is a nil pointer.
|
2023-01-13 18:02:32 +03:00
|
|
|
fn resolve_nil_str(ptr &u8) string {
|
|
|
|
if isnil(ptr) {
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
return unsafe { ptr.vstring() }
|
|
|
|
}
|
|
|
|
|
|
|
|
[inline]
|
|
|
|
fn mystring(b &u8) string {
|
|
|
|
unsafe {
|
|
|
|
return b.vstring()
|
|
|
|
}
|
|
|
|
}
|