Logo Search packages:      
Sourcecode: kaya version File versions  Download package

pg_inter.h

#ifndef _PG_INTER_H // -*-C++-*-
#define _PG_INTER_H

// Glue functions for talking to libpq

#include <Heap.h>
#include <Array.h>
#include <libpq-fe.h>

/// These class names are rubbish and confusing!!!!1!!!
00011 class PGCon : public gc
{
public:
    PGconn* con;
    int ok;
};

class PGRes : public gc
{
public:
    Array* res_table;
    int rows;
    int cols;
    PGresult* pgres;
};

extern "C" {
/// Returns a PGCon
    void* pg_connect(char* conninfo);
/// Tests if a connection is ok
    bool pg_ok(void* conn);
/// Returns an error message
    char* pg_getError(void* conn);
/// Returns a PGRes
    void* pg_exec(void* vmptr,void* conn,char* query);
/// Returns a column name
    char* pg_columnname(void* vmptr,void* res, int col);
/// Gets the strings from a PGRes
    Array* pg_getstrs(void* res);
/// Return the number of rows in a result
    int pg_numrows(void* res);
/// Return the number of columns in a result
    int pg_numcols(void* res);
/// Close the connection
    void pg_close(void* conn);
}

#endif

Generated by  Doxygen 1.6.0   Back to index