Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I recently downloaded a source package from a website which mentioned that its compatible with PostgreSQL and MySQL database.

I tried compilation on Linux Debian machine using MySQL and it works fine. However our requirements have changed now and we need to make it work with PostgreSQL.

However when i compile, seems it not compatible. Never tested with PGSQL i guess. No support from the developers also :(

Reasons:

DB_ROW db_fetch_row(DB_RES *);

Now DB_ROW is defined as follows:

#if defined(DB_MYSQL)
#include <mysql.h>
typedef MYSQL DBH;
**typedef MYSQL_ROW DB_ROW;**
typedef MYSQL_RES DB_RES;
#endif

where as its not defined for PGSQL:

#if defined(DB_PGSQL)
#include <libpq-fe.h>
#define PWLEN   13
typedef PGresult DB_RES;
typedef struct {
    Gconn *conn;
    DB_RES *res;
} DBH;
#endif

I tried searching for similar structure in PostgreSQL, but it seems there the implementation is different: http://www.postgresql.org/docs/9.2/static/libpq-single-row-mode.html

I could use this but doing this would make the source code specific to PGSQL.

Is there a similar structure in PGSQL?

Thanks

share|improve this question
    
have I understood this right: You are looking for a structure to get the results of the Queries one row at a time and have found it, but don't know how to incorporate it in your code? –  Angelo Fuchs Jul 10 '13 at 11:47
    
also, could you state what program it is that you have downloaded? It may be that one of the devs is on SO and interested in answering your question :) –  Angelo Fuchs Jul 10 '13 at 11:49
    
Its a tacacs+ source from networkforums.net. –  chingupt Jul 11 '13 at 4:18
    
Yes Angelo. I would have to rewrite the complete function to make it compatible with PGSQL. I was hoping there is something similiar to MYSQL_ROW in pgsql so that there would be minimal change. Not yet found an alternative :( –  chingupt Jul 11 '13 at 4:20
    
Unfortunately I have no idea how to do this, but my experience with SO tells me that if you have not gotten an answer within a day, your chances are dwindling. So, could you edit your question as to what that function should do? (Maybe there is one, but whoever knows it, has no idea how it is called in mysql) Good Luck –  Angelo Fuchs Jul 11 '13 at 14:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.