2020-02-02 14:39:57 +03:00
|
|
|
module mysql
|
|
|
|
|
2021-01-09 11:40:21 +03:00
|
|
|
// get_error_msg - returns error message from MySQL instance.
|
2020-05-04 15:58:24 +03:00
|
|
|
fn get_error_msg(conn &C.MYSQL) string {
|
2021-01-09 11:40:21 +03:00
|
|
|
return unsafe { C.mysql_error(conn).vstring() }
|
2020-02-02 14:39:57 +03:00
|
|
|
}
|
|
|
|
|
2021-01-09 11:40:21 +03:00
|
|
|
// get_errno - returns error number from MySQL instance.
|
2020-05-04 15:58:24 +03:00
|
|
|
fn get_errno(conn &C.MYSQL) int {
|
|
|
|
return C.mysql_errno(conn)
|
2020-02-02 14:39:57 +03:00
|
|
|
}
|
|
|
|
|
2021-01-09 11:40:21 +03:00
|
|
|
// resolve_nil_str - returns an empty string if passed value is a nil pointer.
|
2021-05-08 13:32:29 +03:00
|
|
|
fn resolve_nil_str(ptr &byte) string {
|
2020-10-19 21:11:04 +03:00
|
|
|
if isnil(ptr) {
|
|
|
|
return ''
|
|
|
|
}
|
2021-01-09 11:40:21 +03:00
|
|
|
return unsafe { ptr.vstring() }
|
2020-08-10 19:05:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
[inline]
|
2021-05-08 13:32:29 +03:00
|
|
|
fn mystring(b &byte) string {
|
2020-08-10 19:05:26 +03:00
|
|
|
unsafe {
|
|
|
|
return b.vstring()
|
|
|
|
}
|
2020-02-02 14:39:57 +03:00
|
|
|
}
|