rem: free_query(_h); commit_transaction(_h); return(0);
add: params = 0; insert = 0;  insert = print_insert(con, keys, n); if (!insert) goto err;  params = new_pg_params(n); if (!params) goto err; if (params_add(params, con, vals, n) < 0) goto err;  do { ret = submit_query(0, con, insert, params); if (ret < 0) goto err;                        if (ret > 0) {                                if (reconnect(con) < 0) goto err;     else continue;                        } } while(ret != 0);  free_pg_params(params); pkg_free(insert); return 0;  err: if (params) free_pg_params(params); if (insert) pkg_free(insert); return -1;
context: int db_insert(db_con_t* _h, db_key_t* _k, db_val_t* _v, int _n){	int off;	off = snprintf(sql_buf, SQL_BUF_LEN, "insert into %s (", CON_TABLE(_h));	off += print_columns(sql_buf + off, SQL_BUF_LEN - off, _k, _n);	off += snprintf(sql_buf + off, SQL_BUF_LEN - off, ") values (");	off += print_values(sql_buf + off, SQL_BUF_LEN - off, _v, _n);	*(sql_buf + off++) = ')';	*(sql_buf + off) = '\0';	if(begin_transaction(_h, sql_buf)) return(-1);	if (submit_query(_h, sql_buf) < 0) {		LOG(L_ERR, "db_insert(): Error while inserting\n");		return -2;	}	free_query(_h);	commit_transaction(_h);	return(0);}