Libpq: Passing a Pgconn* object between console applications ? - Mailing list pgsql-admin

From David.Jacques@CCRS.NRCan.gc.ca
Subject Libpq: Passing a Pgconn* object between console applications ?
Date
Msg-id B7F9814D6850C949947CF8DEA13477810207ABC1@s5-ccr-r2.ccrs.nrcan.gc.ca
Whole thread Raw
List pgsql-admin
 I have a function defined in my own library (.lib) that updates a table of
logged information about
the start and end times, return codes, etc. of etl, backup, and other such
processes.

The function uses an existing connection to the DB and writes a new record
to that log table.

void UpdateLog(char* sTName,char* sTimeStamp,int iProcID,char* sMessage,int
iLogType,int iErrorCode,PGconn* pConn);

The scenario is this:

sched.exe  -- starts
         -- connects to db (Pgconn* pCon1)
           -- queries scheduling table for times to call other processes.
           -- if it is time...
            -calls other process i.e.  process1.exe
            process1.exe
             -starts, makes connection to db Pgconn* pCon2
              -calls function to update log that process1.exe
(with Pgconn* pCon2 as arg) has started at time t1
             -does its work
             -calls function to update log that process1.exe
(with Pgconn* pCon2 as arg) has ended at time t2.
             -ends.
        -- endif
        -- sched.exe ends

I'm wondering whether I can pass an existing, opened db connection (Pgconn*)
as an argument to UpdateLog().

Has anyone done this ?

Thanks


Dave

pgsql-admin by date:

Previous
From: Greg Spiegelberg
Date:
Subject: Re: OID assistance
Next
From: Tom Lane
Date:
Subject: Re: OID assistance