Commit 891f2674 authored by Giovanne Marcelo's avatar Giovanne Marcelo

add find by id function

parent 973fbdb1
......@@ -13,6 +13,7 @@
PGconn* db_connect();
PGresult* db_select(char *columns, char *table, char *where);
PGresult* db_find_by_id(int id, char *table);
void db_disconnect(PGconn *conn);
void read_conf(const char *path, char * conninfo);
......@@ -92,6 +92,12 @@ PGresult* db_select( char *columns, char *table, char *where) {
return result;
PGresult* db_find_by_id(int id, char *table) {
char query[QUERY_LEN];
sprintf(query,"id=%d", id);
return db_select("*", table, query);
void db_disconnect(PGconn *conn) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment