aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/mysql/utils.v
blob: 2d6332781b6332f58995a69bf2b9fb5024145bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module mysql

// get_error_msg - returns error message from MySQL instance.
fn get_error_msg(conn &C.MYSQL) string {
	return unsafe { C.mysql_error(conn).vstring() }
}

// get_errno - returns error number from MySQL instance.
fn get_errno(conn &C.MYSQL) int {
	return C.mysql_errno(conn)
}

// resolve_nil_str - returns an empty string if passed value is a nil pointer.
fn resolve_nil_str(ptr &byte) string {
	if isnil(ptr) {
		return ''
	}
	return unsafe { ptr.vstring() }
}

[inline]
fn mystring(b &byte) string {
	unsafe {
		return b.vstring()
	}
}