rem: 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';
add: int ret; char* insert; struct pg_params* params;
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);}