1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

orm fixes; glfw: remove C code

This commit is contained in:
Alexander Medvednikov
2019-08-13 14:50:19 +03:00
parent a5af903362
commit dc9cebe26c
7 changed files with 101 additions and 60 deletions

View File

@ -102,14 +102,23 @@ $table_name $tmp;
${obj_gen.str()}
')
p.cgen.resetln(tmp)
}
p.cgen.resetln(tmp)
}
// Array
else {
p.cgen.insert_before('
q += ' order by id'
mut params_gen := ''
params := p.sql_params.split(',')
for i, param in params {
params_gen += 'params[$i] = int_str($param).str;'
}
p.cgen.insert_before('char* params[$p.sql_i];
$params_gen
void* res = PQexecParams(db.conn, "$q", $p.sql_i, 0, params, 0, 0, 0) ;
array_pg__Row rows = pg__res_to_rows(res);
array_pg__Row rows = pg__DB_exec(db, tos2("$q"));
//printf("ROWS LEN=%d\\n", rows.len);
// TODO preallocate
array arr_$tmp = new_array(0, 0, sizeof($table_name));
for (int i = 0; i < rows.len; i++) {