diff --git a/vlib/orm/orm_test.v b/vlib/orm/orm_test.v index c5bd08f9a2..5f78cab702 100644 --- a/vlib/orm/orm_test.v +++ b/vlib/orm/orm_test.v @@ -12,7 +12,7 @@ fn test_orm() { db := pg.connect( dbname:'vpm' user:'alex' - ) + ) or { panic(err) } /* //nr_modules := db.select count from modules //nr_modules := db.select count from Modules where id == 1 diff --git a/vlib/pg/pg.v b/vlib/pg/pg.v index fad45d1ad9..ec9344d079 100644 --- a/vlib/pg/pg.v +++ b/vlib/pg/pg.v @@ -128,7 +128,8 @@ pub fn (db DB) exec_one(query string) ?Row { // free. This prevents warnings and doesn't seem to affect behavior. pub fn (db DB) exec_param_many(query string, params []string) []Row { unsafe { - mut param_vals := &byteptr( malloc( params.len * sizeof(byteptr) ) ) + b := sizeof(byteptr) + mut param_vals := &byteptr(malloc(params.len * 8)) for i in 0..params.len { param_vals[i] = params[i].str }