mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: fix shared_element_lock.vv test (#14960)
This commit is contained in:
parent
59d6ca0c95
commit
bb2223c8b0
@ -188,13 +188,16 @@ pub fn (db DB) exec_one(query string) ?Row {
|
|||||||
|
|
||||||
// exec_param_many executes a query with the provided parameters
|
// exec_param_many executes a query with the provided parameters
|
||||||
pub fn (db DB) exec_param_many(query string, params []string) ?[]Row {
|
pub fn (db DB) exec_param_many(query string, params []string) ?[]Row {
|
||||||
|
unsafe {
|
||||||
mut param_vals := []&char{len: params.len}
|
mut param_vals := []&char{len: params.len}
|
||||||
for i in 0 .. params.len {
|
for i in 0 .. params.len {
|
||||||
param_vals[i] = params[i].str
|
param_vals[i] = params[i].str
|
||||||
}
|
}
|
||||||
|
|
||||||
res := C.PQexecParams(db.conn, query.str, params.len, 0, param_vals.data, 0, 0, 0)
|
res := C.PQexecParams(db.conn, query.str, params.len, 0, param_vals.data, 0, 0,
|
||||||
|
0)
|
||||||
return db.handle_error_or_result(res, 'exec_param_many')
|
return db.handle_error_or_result(res, 'exec_param_many')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (db DB) exec_param2(query string, param string, param2 string) ?[]Row {
|
pub fn (db DB) exec_param2(query string, param string, param2 string) ?[]Row {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
vlib/v/checker/tests/shared_element_lock.vv:43:11: warning: arrays of references need to be initialized right away (unless used inside `unsafe`)
|
vlib/v/checker/tests/shared_element_lock.vv:43:11: warning: arrays of references need to be initialized right away, therefore `len:` cannot be used (unless inside `unsafe`)
|
||||||
41 | shared g := Pro{}
|
41 | shared g := Pro{}
|
||||||
42 | g.pers.age = 42
|
42 | g.pers.age = 42
|
||||||
43 | mut h := []shared Pro{len: 3}
|
43 | mut h := []shared Pro{len: 3}
|
||||||
|
Loading…
Reference in New Issue
Block a user