2020-02-02 12:39:57 +01:00
|
|
|
module mysql
|
|
|
|
|
2020-06-11 10:07:17 +02:00
|
|
|
// get_error_msg returns error message from MySQL instance.
|
2020-05-04 14:58:24 +02:00
|
|
|
fn get_error_msg(conn &C.MYSQL) string {
|
2020-10-19 20:11:04 +02:00
|
|
|
return unsafe {C.mysql_error(conn).vstring()}
|
2020-02-02 12:39:57 +01:00
|
|
|
}
|
|
|
|
|
2020-06-11 10:07:17 +02:00
|
|
|
// get_errno returns error number from MySQL instance.
|
2020-05-04 14:58:24 +02:00
|
|
|
fn get_errno(conn &C.MYSQL) int {
|
|
|
|
return C.mysql_errno(conn)
|
2020-02-02 12:39:57 +01:00
|
|
|
}
|
|
|
|
|
2020-06-11 10:07:17 +02:00
|
|
|
// resolve_nil_str returns empty string if passed value is a nil pointer.
|
2020-02-02 12:39:57 +01:00
|
|
|
fn resolve_nil_str(ptr byteptr) string {
|
2020-10-19 20:11:04 +02:00
|
|
|
if isnil(ptr) {
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
return unsafe {ptr.vstring()}
|
2020-08-10 18:05:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
[inline]
|
|
|
|
fn mystring(b byteptr) string {
|
|
|
|
unsafe {
|
|
|
|
return b.vstring()
|
|
|
|
}
|
2020-02-02 12:39:57 +01:00
|
|
|
}
|