Skip to content

Commit

Permalink
fmt: implement wrapping function's super long arguments (fix #15545, fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 authored Jul 2, 2024
1 parent 36e31d6 commit 209063f
Show file tree
Hide file tree
Showing 65 changed files with 260 additions and 129 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/v_apps_and_modules_compile_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,18 @@ jobs:
echo "Build v-analyzer release"
v build.vsh release
- name: Format vlang/v-analyzer
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: |
cd /tmp/v-analyzer
set +e
v fmt -c .
exit_code=$?
if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then
# Don't fail if there are only internal errors (exit code 5).
v fmt -diff .
exit 1
fi
# - name: Format vlang/v-analyzer
# if: ${{ !cancelled() && steps.build.outcome == 'success' }}
# run: |
# cd /tmp/v-analyzer
# set +e
# v fmt -c .
# exit_code=$?
# if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then
# # Don't fail if there are only internal errors (exit code 5).
# v fmt -diff .
# exit 1
# fi

- name: Build vlang/go2v
if: ${{ !cancelled() && steps.build.outcome == 'success' && matrix.os != 'macos-14' }}
Expand Down
3 changes: 2 additions & 1 deletion cmd/tools/check_os_api_parity.v
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ fn gen_api_for_module_in_os(mod_name string, os_ pref.OS) string {
if s is ast.FnDecl && s.is_pub {
fn_mod := s.modname()
if fn_mod == mod_name {
fn_signature := b.table.stringify_fn_decl(&s, mod_name, map[string]string{})
fn_signature := b.table.stringify_fn_decl(&s, mod_name, map[string]string{},
false)
fline := '${fn_mod}: ${fn_signature}'
res << fline
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/tools/vdoc/markdown.v
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ fn (vd VDoc) gen_markdown(d doc.Doc, with_toc bool) string {
return hw.str() + '\n' + cw.str()
}

fn (vd VDoc) write_markdown_content(contents []doc.DocNode, mut cw strings.Builder, mut hw strings.Builder, indent int, with_toc bool) {
fn (vd VDoc) write_markdown_content(contents []doc.DocNode, mut cw strings.Builder, mut hw strings.Builder,
indent int, with_toc bool) {
cfg := vd.cfg
for cn in contents {
if with_toc && cn.name != '' {
Expand Down
3 changes: 2 additions & 1 deletion examples/c_interop_wkhtmltopdf.v
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ fn C.wkhtmltopdf_create_converter(global_settings &C.wkhtmltopdf_global_settings

fn C.wkhtmltopdf_destroy_converter(converter &C.wkhtmltopdf_converter)

fn C.wkhtmltopdf_add_object(converter &C.wkhtmltopdf_converter, object_settings &C.wkhtmltopdf_object_settings, data &char)
fn C.wkhtmltopdf_add_object(converter &C.wkhtmltopdf_converter, object_settings &C.wkhtmltopdf_object_settings,
data &char)

fn C.wkhtmltopdf_convert(converter &C.wkhtmltopdf_converter) bool

Expand Down
3 changes: 2 additions & 1 deletion examples/graphs/dfs2.v
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ pub mut:
pattern [][]string
}

fn (mut s Solution) find_pattern(adj map[string][]string, mut visited map[string]bool, node string, target string, mut path []string) {
fn (mut s Solution) find_pattern(adj map[string][]string, mut visited map[string]bool, node string, target string,
mut path []string) {
path << node
visited[node] = true
if node == target {
Expand Down
3 changes: 2 additions & 1 deletion vlib/benchmark/benchmark.v
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ pub:
}

// step_message_with_label_and_duration returns a string describing the current step.
pub fn (b &Benchmark) step_message_with_label_and_duration(label string, msg string, sduration time.Duration, opts MessageOptions) string {
pub fn (b &Benchmark) step_message_with_label_and_duration(label string, msg string, sduration time.Duration,
opts MessageOptions) string {
timed_line := b.tdiff_in_ms(msg, sduration.microseconds())
if b.nexpected_steps > 1 {
mut sprogress := ''
Expand Down
3 changes: 2 additions & 1 deletion vlib/builtin/builtin_d_gcboehm.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ pub fn gc_check_leaks() {
}
}

fn C.GC_get_heap_usage_safe(pheap_size &usize, pfree_bytes &usize, punmapped_bytes &usize, pbytes_since_gc &usize, ptotal_bytes &usize)
fn C.GC_get_heap_usage_safe(pheap_size &usize, pfree_bytes &usize, punmapped_bytes &usize, pbytes_since_gc &usize,
ptotal_bytes &usize)
fn C.GC_get_memory_use() usize

pub struct C.GC_stack_base {
Expand Down
3 changes: 2 additions & 1 deletion vlib/builtin/builtin_d_use_libbacktrace.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ type BacktraceErrorCallback = fn (data voidptr, msg &char, errnum int) voidptr
type BacktraceFullCallback = fn (data voidptr, pc voidptr, filename &char, lineno int, func &char) &int

fn C.backtrace_create_state(filename &char, threaded int, error_callback BacktraceErrorCallback, data voidptr) &C.backtrace_state
fn C.backtrace_full(state &C.backtrace_state, skip int, cb BacktraceFullCallback, err_cb BacktraceErrorCallback, data voidptr) int
fn C.backtrace_full(state &C.backtrace_state, skip int, cb BacktraceFullCallback, err_cb BacktraceErrorCallback,
data voidptr) int

__global bt_state = init_bt_state()

Expand Down
3 changes: 2 additions & 1 deletion vlib/builtin/builtin_notd_gcboehm.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ fn C.GC_REALLOC(ptr voidptr, n usize) voidptr

fn C.GC_FREE(ptr voidptr)

fn C.GC_get_heap_usage_safe(pheap_size &usize, pfree_bytes &usize, punmapped_bytes &usize, pbytes_since_gc &usize, ptotal_bytes &usize)
fn C.GC_get_heap_usage_safe(pheap_size &usize, pfree_bytes &usize, punmapped_bytes &usize, pbytes_since_gc &usize,
ptotal_bytes &usize)

fn C.GC_get_memory_use() usize

Expand Down
22 changes: 15 additions & 7 deletions vlib/builtin/cfns.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,11 @@ fn C.GetModuleFileName(hModule voidptr, lpFilename &u16, nSize u32) u32

fn C.GetModuleFileNameW(hModule voidptr, lpFilename &u16, nSize u32) u32

fn C.CreateFile(lpFilename &u16, dwDesiredAccess u32, dwShareMode u32, lpSecurityAttributes &u16, dwCreationDisposition u32, dwFlagsAndAttributes u32, hTemplateFile voidptr) voidptr
fn C.CreateFile(lpFilename &u16, dwDesiredAccess u32, dwShareMode u32, lpSecurityAttributes &u16, dwCreationDisposition u32,
dwFlagsAndAttributes u32, hTemplateFile voidptr) voidptr

fn C.CreateFileW(lpFilename &u16, dwDesiredAccess u32, dwShareMode u32, lpSecurityAttributes &u16, dwCreationDisposition u32, dwFlagsAndAttributes u32, hTemplateFile voidptr) voidptr
fn C.CreateFileW(lpFilename &u16, dwDesiredAccess u32, dwShareMode u32, lpSecurityAttributes &u16, dwCreationDisposition u32,
dwFlagsAndAttributes u32, hTemplateFile voidptr) voidptr

fn C.GetFinalPathNameByHandleW(hFile voidptr, lpFilePath &u16, nSize u32, dwFlags u32) u32

Expand All @@ -258,7 +260,9 @@ fn C.SendMessageTimeout() isize

fn C.SendMessageTimeoutW(hWnd voidptr, msg u32, wParam &u16, lParam &u32, fuFlags u32, uTimeout u32, lpdwResult &u64) isize

fn C.CreateProcessW(lpApplicationName &u16, lpCommandLine &u16, lpProcessAttributes voidptr, lpThreadAttributes voidptr, bInheritHandles bool, dwCreationFlags u32, lpEnvironment voidptr, lpCurrentDirectory &u16, lpStartupInfo voidptr, lpProcessInformation voidptr) bool
fn C.CreateProcessW(lpApplicationName &u16, lpCommandLine &u16, lpProcessAttributes voidptr, lpThreadAttributes voidptr,
bInheritHandles bool, dwCreationFlags u32, lpEnvironment voidptr, lpCurrentDirectory &u16, lpStartupInfo voidptr,
lpProcessInformation voidptr) bool

fn C.ReadFile(hFile voidptr, lpBuffer voidptr, nNumberOfBytesToRead u32, lpNumberOfBytesRead &u32, lpOverlapped voidptr) bool

Expand Down Expand Up @@ -298,11 +302,13 @@ fn C.setbuf(voidptr, &char)

fn C.SymCleanup(hProcess voidptr)

fn C.MultiByteToWideChar(codePage u32, dwFlags u32, lpMultiMyteStr &char, cbMultiByte int, lpWideCharStr &u16, cchWideChar int) int
fn C.MultiByteToWideChar(codePage u32, dwFlags u32, lpMultiMyteStr &char, cbMultiByte int, lpWideCharStr &u16,
cchWideChar int) int

fn C.wcslen(str voidptr) usize

fn C.WideCharToMultiByte(codePage u32, dwFlags u32, lpWideCharStr &u16, cchWideChar int, lpMultiByteStr &char, cbMultiByte int, lpDefaultChar &char, lpUsedDefaultChar &int) int
fn C.WideCharToMultiByte(codePage u32, dwFlags u32, lpWideCharStr &u16, cchWideChar int, lpMultiByteStr &char,
cbMultiByte int, lpDefaultChar &char, lpUsedDefaultChar &int) int

fn C._wstat(path &u16, buffer &C._stat) int

Expand All @@ -324,7 +330,8 @@ fn C._waccess(path &u16, mode int) int

fn C._wremove(path &u16) int

fn C.ReadConsole(in_input_handle voidptr, out_buffer voidptr, in_chars_to_read u32, out_read_chars &u32, in_input_control voidptr) bool
fn C.ReadConsole(in_input_handle voidptr, out_buffer voidptr, in_chars_to_read u32, out_read_chars &u32,
in_input_control voidptr) bool

fn C.WriteConsole() voidptr

Expand Down Expand Up @@ -354,7 +361,8 @@ fn C.FindClose(hFindFile voidptr)
// macro
fn C.MAKELANGID(lgid voidptr, srtid voidptr) int

fn C.FormatMessageW(dwFlags u32, lpSource voidptr, dwMessageId u32, dwLanguageId u32, lpBuffer voidptr, nSize u32, arguments ...voidptr) u32
fn C.FormatMessageW(dwFlags u32, lpSource voidptr, dwMessageId u32, dwLanguageId u32, lpBuffer voidptr,
nSize u32, arguments ...voidptr) u32

fn C.CloseHandle(voidptr) int

Expand Down
3 changes: 2 additions & 1 deletion vlib/builtin/map.v
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ fn new_map(key_bytes int, value_bytes int, hash_fn MapHashFn, key_eq_fn MapEqFn,
}
}

fn new_map_init(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn, n int, key_bytes int, value_bytes int, keys voidptr, values voidptr) map {
fn new_map_init(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn, n int, key_bytes int,
value_bytes int, keys voidptr, values voidptr) map {
mut out := new_map(key_bytes, value_bytes, hash_fn, key_eq_fn, clone_fn, free_fn)
// TODO: pre-allocate n slots
mut pkey := &u8(keys)
Expand Down
18 changes: 12 additions & 6 deletions vlib/builtin/map_d_gcboehm_opt.v
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ fn new_dense_array_noscan(key_bytes int, key_noscan bool, value_bytes int, value
}
}

fn new_map_noscan_key(key_bytes int, value_bytes int, hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn) map {
fn new_map_noscan_key(key_bytes int, value_bytes int, hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn,
free_fn MapFreeFn) map {
metasize := int(sizeof(u32) * (init_capicity + extra_metas_inc))
// for now assume anything bigger than a pointer is a string
has_string_keys := key_bytes > sizeof(voidptr)
Expand All @@ -51,7 +52,8 @@ fn new_map_noscan_key(key_bytes int, value_bytes int, hash_fn MapHashFn, key_eq_
}
}

fn new_map_noscan_value(key_bytes int, value_bytes int, hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn) map {
fn new_map_noscan_value(key_bytes int, value_bytes int, hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn,
free_fn MapFreeFn) map {
metasize := int(sizeof(u32) * (init_capicity + extra_metas_inc))
// for now assume anything bigger than a pointer is a string
has_string_keys := key_bytes > sizeof(voidptr)
Expand All @@ -73,7 +75,8 @@ fn new_map_noscan_value(key_bytes int, value_bytes int, hash_fn MapHashFn, key_e
}
}

fn new_map_noscan_key_value(key_bytes int, value_bytes int, hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn) map {
fn new_map_noscan_key_value(key_bytes int, value_bytes int, hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn,
free_fn MapFreeFn) map {
metasize := int(sizeof(u32) * (init_capicity + extra_metas_inc))
// for now assume anything bigger than a pointer is a string
has_string_keys := key_bytes > sizeof(voidptr)
Expand All @@ -95,7 +98,8 @@ fn new_map_noscan_key_value(key_bytes int, value_bytes int, hash_fn MapHashFn, k
}
}

fn new_map_init_noscan_key(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn, n int, key_bytes int, value_bytes int, keys voidptr, values voidptr) map {
fn new_map_init_noscan_key(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn,
n int, key_bytes int, value_bytes int, keys voidptr, values voidptr) map {
mut out := new_map_noscan_key(key_bytes, value_bytes, hash_fn, key_eq_fn, clone_fn,
free_fn)
// TODO: pre-allocate n slots
Expand All @@ -111,7 +115,8 @@ fn new_map_init_noscan_key(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapClo
return out
}

fn new_map_init_noscan_value(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn, n int, key_bytes int, value_bytes int, keys voidptr, values voidptr) map {
fn new_map_init_noscan_value(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn,
n int, key_bytes int, value_bytes int, keys voidptr, values voidptr) map {
mut out := new_map_noscan_value(key_bytes, value_bytes, hash_fn, key_eq_fn, clone_fn,
free_fn)
// TODO: pre-allocate n slots
Expand All @@ -127,7 +132,8 @@ fn new_map_init_noscan_value(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapC
return out
}

fn new_map_init_noscan_key_value(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn, n int, key_bytes int, value_bytes int, keys voidptr, values voidptr) map {
fn new_map_init_noscan_key_value(hash_fn MapHashFn, key_eq_fn MapEqFn, clone_fn MapCloneFn, free_fn MapFreeFn,
n int, key_bytes int, value_bytes int, keys voidptr, values voidptr) map {
mut out := new_map_noscan_key_value(key_bytes, value_bytes, hash_fn, key_eq_fn, clone_fn,
free_fn)
// TODO: pre-allocate n slots
Expand Down
6 changes: 4 additions & 2 deletions vlib/builtin/string_interpolation.v
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ fn abs64(x i64) u64 {
//---------------------------------------

// convert from data format to compact u64
pub fn get_str_intp_u64_format(fmt_type StrIntpType, in_width int, in_precision int, in_tail_zeros bool, in_sign bool, in_pad_ch u8, in_base int, in_upper_case bool) u64 {
pub fn get_str_intp_u64_format(fmt_type StrIntpType, in_width int, in_precision int, in_tail_zeros bool,
in_sign bool, in_pad_ch u8, in_base int, in_upper_case bool) u64 {
width := if in_width != 0 { abs64(in_width) } else { u64(0) }
align := if in_width > 0 { u64(1 << 5) } else { u64(0) } // two bit 0 .left 1 .right, for now we use only one
upper_case := if in_upper_case { u64(1 << 7) } else { u64(0) }
Expand All @@ -134,7 +135,8 @@ pub fn get_str_intp_u64_format(fmt_type StrIntpType, in_width int, in_precision
}

// convert from data format to compact u32
pub fn get_str_intp_u32_format(fmt_type StrIntpType, in_width int, in_precision int, in_tail_zeros bool, in_sign bool, in_pad_ch u8, in_base int, in_upper_case bool) u32 {
pub fn get_str_intp_u32_format(fmt_type StrIntpType, in_width int, in_precision int, in_tail_zeros bool,
in_sign bool, in_pad_ch u8, in_base int, in_upper_case bool) u32 {
width := if in_width != 0 { abs64(in_width) } else { u32(0) }
align := if in_width > 0 { u32(1 << 5) } else { u32(0) } // two bit 0 .left 1 .right, for now we use only one
upper_case := if in_upper_case { u32(1 << 7) } else { u32(0) }
Expand Down
3 changes: 2 additions & 1 deletion vlib/clipboard/clipboard_windows.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ fn C.RegisterClassEx(class &WndClassEx) int

fn C.GetClipboardOwner() C.HWND

fn C.CreateWindowEx(dwExStyle i64, lpClassName &u16, lpWindowName &u16, dwStyle i64, x int, y int, nWidth int, nHeight int, hWndParent i64, hMenu voidptr, h_instance voidptr, lpParam voidptr) C.HWND
fn C.CreateWindowEx(dwExStyle i64, lpClassName &u16, lpWindowName &u16, dwStyle i64, x int, y int, nWidth int,
nHeight int, hWndParent i64, hMenu voidptr, h_instance voidptr, lpParam voidptr) C.HWND

// fn C.MultiByteToWideChar(CodePage u32, dw_flags u16, lpMultiByteStr byteptr, cbMultiByte int, lpWideCharStr u16, cchWideChar int) int
fn C.EmptyClipboard()
Expand Down
9 changes: 6 additions & 3 deletions vlib/clipboard/x11/clipboard.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,24 @@ fn C.XSetSelectionOwner(d &C.Display, a Atom, w Window, time int)

fn C.XGetSelectionOwner(d &C.Display, a Atom) Window

fn C.XChangeProperty(d &C.Display, requestor Window, property Atom, typ Atom, format int, mode int, data voidptr, nelements int) int
fn C.XChangeProperty(d &C.Display, requestor Window, property Atom, typ Atom, format int, mode int, data voidptr,
nelements int) int

fn C.XSendEvent(d &C.Display, requestor Window, propagate int, mask i64, event &C.XEvent)

fn C.XInternAtom(d &C.Display, typ &u8, only_if_exists int) Atom

fn C.XCreateSimpleWindow(d &C.Display, root Window, x int, y int, width u32, height u32, border_width u32, border u64, background u64) Window
fn C.XCreateSimpleWindow(d &C.Display, root Window, x int, y int, width u32, height u32, border_width u32,
border u64, background u64) Window

fn C.XOpenDisplay(name &u8) &C.Display

fn C.XConvertSelection(d &C.Display, selection Atom, target Atom, property Atom, requestor Window, time int) int

fn C.XSync(d &C.Display, discard int) int

fn C.XGetWindowProperty(d &C.Display, w Window, property Atom, offset i64, length i64, delete int, req_type Atom, actual_type_return &Atom, actual_format_return &int, nitems &u64, bytes_after_return &u64, prop_return &&u8) int
fn C.XGetWindowProperty(d &C.Display, w Window, property Atom, offset i64, length i64, delete int, req_type Atom,
actual_type_return &Atom, actual_format_return &int, nitems &u64, bytes_after_return &u64, prop_return &&u8) int

fn C.XDeleteProperty(d &C.Display, w Window, property Atom) int

Expand Down
12 changes: 8 additions & 4 deletions vlib/db/mssql/_cdefs.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,28 @@ fn C.SQLAllocHandle(handle_type C.SQLSMALLINT, input_handle C.SQLHANDLE, output_

fn C.SQLSetEnvAttr(environment_handle C.SQLHENV, attribute C.SQLINTEGER, value C.SQLPOINTER, string_length C.SQLINTEGER) C.SQLRETURN

fn C.SQLGetDiagRec(handle_type C.SQLSMALLINT, handle C.SQLHANDLE, rec_number C.SQLSMALLINT, sql_state &C.SQLCHAR, native_error &C.SQLINTEGER, message_text &C.SQLCHAR, buffer_length C.SQLSMALLINT, text_length &C.SQLSMALLINT) C.SQLRETURN
fn C.SQLGetDiagRec(handle_type C.SQLSMALLINT, handle C.SQLHANDLE, rec_number C.SQLSMALLINT, sql_state &C.SQLCHAR,
native_error &C.SQLINTEGER, message_text &C.SQLCHAR, buffer_length C.SQLSMALLINT, text_length &C.SQLSMALLINT) C.SQLRETURN

fn C.SQLSetConnectAttr(connection_handle C.SQLHDBC, attribute C.SQLINTEGER, value C.SQLPOINTER, string_length C.SQLINTEGER) C.SQLRETURN

fn C.SQLDriverConnect(hdbc C.SQLHDBC, hwnd C.SQLHWND, sz_conn_str_in &C.SQLCHAR, cb_conn_str_in C.SQLSMALLINT, sz_conn_str_out &C.SQLCHAR, cb_conn_str_out_max C.SQLSMALLINT, pcb_conn_str_out &C.SQLSMALLINT, f_driver_completion C.SQLUSMALLINT) C.SQLRETURN
fn C.SQLDriverConnect(hdbc C.SQLHDBC, hwnd C.SQLHWND, sz_conn_str_in &C.SQLCHAR, cb_conn_str_in C.SQLSMALLINT,
sz_conn_str_out &C.SQLCHAR, cb_conn_str_out_max C.SQLSMALLINT, pcb_conn_str_out &C.SQLSMALLINT, f_driver_completion C.SQLUSMALLINT) C.SQLRETURN

fn C.SQLDisconnect(connection_handle C.SQLHDBC) C.SQLRETURN

fn C.SQLExecDirect(statement_handle C.SQLHSTMT, statement_text &C.SQLCHAR, text_length C.SQLINTEGER) C.SQLRETURN

fn C.SQLBindCol(statement_handle C.SQLHSTMT, column_number C.SQLUSMALLINT, target_type C.SQLSMALLINT, target_value C.SQLPOINTER, buffer_length C.SQLLEN, str_len_or_ind &C.SQLLEN) C.SQLRETURN
fn C.SQLBindCol(statement_handle C.SQLHSTMT, column_number C.SQLUSMALLINT, target_type C.SQLSMALLINT, target_value C.SQLPOINTER,
buffer_length C.SQLLEN, str_len_or_ind &C.SQLLEN) C.SQLRETURN

fn C.SQLFetch(statement_handle C.SQLHSTMT) C.SQLRETURN

fn C.SQLFreeHandle(handle_type C.SQLSMALLINT, handle C.SQLHANDLE) C.SQLRETURN

fn C.SQLNumResultCols(statement_handle C.SQLHSTMT, column_count &C.SQLSMALLINT) C.SQLRETURN

fn C.SQLColAttribute(statement_handle C.SQLHSTMT, column_number C.SQLUSMALLINT, field_identifier C.SQLUSMALLINT, character_attribute C.SQLPOINTER, buffer_length C.SQLSMALLINT, string_length C.SQLSMALLINT, numeric_attribute &C.SQLLEN) C.SQLRETURN
fn C.SQLColAttribute(statement_handle C.SQLHSTMT, column_number C.SQLUSMALLINT, field_identifier C.SQLUSMALLINT,
character_attribute C.SQLPOINTER, buffer_length C.SQLSMALLINT, string_length C.SQLSMALLINT, numeric_attribute &C.SQLLEN) C.SQLRETURN

fn C.SQLRowCount(statement_handle C.SQLHSTMT, row_count &C.SQLLEN) C.SQLRETURN
3 changes: 2 additions & 1 deletion vlib/db/mysql/_cdefs.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ pub struct C.MYSQL_FIELD {
fn C.mysql_init(mysql &C.MYSQL) &C.MYSQL

// C.mysql_real_connect attempts to establish a connection to a MySQL server running on `host`.
fn C.mysql_real_connect(mysql &C.MYSQL, host &char, user &char, passwd &char, db &char, port u32, unix_socket &char, client_flag ConnectionFlag) &C.MYSQL
fn C.mysql_real_connect(mysql &C.MYSQL, host &char, user &char, passwd &char, db &char, port u32, unix_socket &char,
client_flag ConnectionFlag) &C.MYSQL

// C.mysql_query executes the SQL statement pointed to by the null-terminated string `stmt_str`.
fn C.mysql_query(mysql &C.MYSQL, q &u8) int
Expand Down
3 changes: 2 additions & 1 deletion vlib/db/pg/pg.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ fn C.PQnfields(const_res &C.PGresult) int
// const char *const *paramValues
// const int *paramLengths
// const int *paramFormats
fn C.PQexecParams(conn &C.PGconn, const_command &char, nParams int, const_paramTypes &int, const_paramValues &char, const_paramLengths &int, const_paramFormats &int, resultFormat int) &C.PGresult
fn C.PQexecParams(conn &C.PGconn, const_command &char, nParams int, const_paramTypes &int, const_paramValues &char,
const_paramLengths &int, const_paramFormats &int, resultFormat int) &C.PGresult

fn C.PQputCopyData(conn &C.PGconn, const_buffer &char, nbytes int) int

Expand Down
Loading

0 comments on commit 209063f

Please sign in to comment.