mirror of
https://github.com/vlang/v.git
synced 2025-09-16 07:52:32 +03:00
pg: hande C calls, move to .c.v files (#19739)
This commit is contained in:
parent
be89cbf26f
commit
24befa0ba6
13 changed files with 18 additions and 17 deletions
26
vlib/db/mysql/utils.c.v
Normal file
26
vlib/db/mysql/utils.c.v
Normal file
|
@ -0,0 +1,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 &u8) string {
|
||||
if isnil(ptr) {
|
||||
return ''
|
||||
}
|
||||
return unsafe { ptr.vstring() }
|
||||
}
|
||||
|
||||
[inline]
|
||||
fn mystring(b &u8) string {
|
||||
unsafe {
|
||||
return b.vstring()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue