Dan Sugalski wrote:
Yep, though that's a big part of it. postgres.pasm is generated from postgres.declarations, FWIW--there's a script in the library somewhere.

Is /parrot/build_tools/build_nativecall.pl the script in question and if so whats its usage.

I have done postgres.declarations, please see below. I have made
guesses based on /parrot/build_tools/build_nativecall.pl where I was
unsure as to the type to be used. Where I was not sure of the type I
have included the declaration from libpq-fe.h as a comment just above the entry in the new postgres.declarations. All new entries from the 7.4 file have been included in the file as follows


#### New In 7.4
New function
####

The entries appear in the order they where encountered in libpq-fe.h
which differs considerably from the 7.3 version.

If anyone is interested the following URL will take you to the Postgres web interface for libpq-fe.h.

http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/interfaces/libpq/libpq-fe.h

Revision 1.100

As for the OO wrapper. Are you after a pasm library that takes advantage of objects and hides the details of libpq-fe.h? I think I could start something if no one else has already started anything.


Yep, that's what I was thinking of. If you take a look, there are parts of the interface that are somewhat awkward to use from a higher level -- the record fetching code is definitely skewed down to the bottom end of things. Certainly fine enough, but it'd be nice to be able to get back an array or hash for a record rather than having to query individual fields. :)

I will probably need a bit of help with this. To coin a phrase I am still very much slipping on the parrot guts. You guys seem to be producing material at a fair pace :-)


If there is already any material, docs, examples or a wrapper already written for another library please point me at it.

Harry

########################################
[package]
PostgreSQL

[lib]
libpq

[defs]
# From libpq-fe.h Revision 1.100
p PQconnectStart t
i PQconnectPoll p
p PQconnectdb t
p PQsetdbLogin t t t t t t t
v PQfinish p
p PQconndefaults
v PQconninfoFree p
i PQresetStart p
i PQresetPoll p

#extern void PQreset(PGconn *conn);
# This was set to "c PQreset p" was this correct.
v PQreset p

i PQrequestCancel p
t PQdb p
t PQuser p
t PQpass p
t PQhost p
t PQport p
t PQtty p
t PQoptions p
i PQstatus p

##### New In 7.4
i PQtransactionStatus p
t PQparameterStatus p t
i PQprotocolVersion p
#####

t PQerrorMessage p
i PQsocket p
i PQbackendPID p
i PQclientEncoding p
i PQsetClientEncoding p t

##### New In 7.4
i PQsetErrorVerbosity p i
#####

v PQtrace p p
v PQuntrace p

# Need function pointers. Can't do that yet
##### New IN 7.4
#i PQsetNoticeReceiver p p
#####
# i PQsetNoticeProcessor p p

p PQexec p t

##### New In 7.4
#extern PGresult *PQexecParams(PGconn *conn,
#                         const char *command,
#                         int nParams,
#                         const Oid *paramTypes,
#                         const char *const * paramValues,
#                         const int *paramLengths,
#                         const int *paramFormats,
#                         int resultFormat);
p PQexecParams p t i i 3 3 i


#extern PGresult *PQexecPrepared(PGconn *conn, # const char *stmtName, # int nParams, # const char *const * paramValues, # const int *paramLengths, # const int *paramFormats, # int resultFormat); p PQexecPrepared p t i t 3 3 i #####

i PQsendQuery p t

##### New In 7.4
#extern int PQsendQueryParams(PGconn *conn,
#                                  const char *command,
#                                  int nParams,
#                                  const Oid *paramTypes,
#                                  const char *const * paramValues,
#                                  const int *paramLengths,
#                                  const int *paramFormats,
#                                  int resultFormat);
i PQsendQueryParams p t i i t 3 3 i

#extern int PQsendQueryPrepared(PGconn *conn,
#                                  const char *stmtName,
#                                  int nParams,
#                                  const char *const * paramValues,
#                                  const int *paramLengths,
#                                  const int *paramFormats,
#                                  int resultFormat);
i PQsendQueryPrepared p t i t 3 3 i
#####

p PQgetResult p

i PQisBusy p
i PQconsumeInput p

p PQnotifies p

##### New In 7.4
#extern int PQputCopyData(PGconn *conn, const char *buffer, int nbytes);
i PQputCopyData p t i


#extern int      PQputCopyEnd(PGconn *conn, const char *errormsg);
i PQputCopyEnd p t

#extern int      PQgetCopyData(PGconn *conn, char **buffer, int async);
i PQgetCopyData p t i
#####

i PQgetline p t i
i PQputline p t
i PQgetlineAsync p t i
i PQputnbytes p t i
i PQendcopy p
i PQsetnonblocking p i
i PQisnonblocking p
i PQflush p

p PQfn p i 3 3 i p i
i PQresultStatus p
t PQresStatus i
t PQresultErrorMessage p

##### New In 7.4
#extern char *PQresultErrorField(const PGresult *res, int fieldcode);
c PQresultErrorField p i
#####

i PQntuples p
i PQnfields p
i PQbinaryTuples p
t PQfname p i
i PQfnumber p t

##### New In 7.4
#extern Oid      PQftable(const PGresult *res, int field_num);
i PQftable p i
#extern int      PQftablecol(const PGresult *res, int field_num);
i PQftablecol p i
#extern int      PQfformat(const PGresult *res, int field_num);
i PQfformat p i
#####

i PQftype p i
i PQfsize p i
i PQfmod p i
t PQcmdStatus p
t PQoidStatus p
i PQoidValue p
t PQcmdTuples p
t PQgetvalue p i i
i PQgetlength p i i
i PQgetisnull p i i
v PQclear p

##### New In 7.4
#extern void PQfreemem(void *ptr);
v PQfreemem p
#####


# First arg's a neturned char pointer. Can't do that yet # i PQescapeString t t i

t PQescapeBytea t l 4
t PQunescapeBytea t 4

p PQmakeEmptyPGresult p i

# The following functions are missing from the original 7.3 version
# so I am leaving these as well. I am including the declarations here
# to let people know the ommission was deliberate. Not 100% why
# though ;-)

#extern void PQprint(FILE *fout,
#                     const PGresult *res,
#                     const PQprintOpt *ps);
#extern void PQdisplayTuples(const PGresult *res,
#                            FILE *fp,
#                            int fillAlign,
#                            const char *fieldSep,
#                            int printHeader,
#                            int quiet);
#extern void PQprintTuples(const PGresult *res,
#                          FILE *fout,
#                          int printAttName,
#                          int terseOutput,
#                          int width);

i lo_open p i i
i lo_close p i
i lo_read p i t l
i lo_write p i t l
i lo_lseek p i i i
i lo_creat p i
i lo_tell p i
i lo_unlink p i
i lo_import p t
i lo_export p i t

i PQmblen t i
i PQenv2encoding v



Reply via email to