agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: J.Plewe <joerg.plewe@mpi-dortmund.mpg.de>
To: postgres@postgres.Berkeley.EDU
Subject: Re: PQExec inside a C function?
Date: Tue, 28 Jun 94 13:20:21 +0200
Message-ID: <9406281120.AA10298@dl.mpi-dortmund.mpg.de> (raw)


> bruce@comu11.auckland.ac.nz (Bruce Thomson) writes:
> > I am trying to call a user function from within the monitor that should
> > do some PQExec'd insertions into a table.
> 
> > PQsetdb ("external");
> > PQexec("begin");
>           ^^^^^
> > sprintf(append_line,"append twovals(x1=%d,x2=%d)",x,x*2);
> > PQexec(append_line);
> > PQexec("end");
>           ^^^
> 
> if this is postgres 4.x, x<2, this won't work at all.
> 
> if this is 4.2, you stand some chance but you don't want to use begin/end.
> (all backend "libpq" calls are executed in the same transaction already.)
> you also don't want to link your function with libpq, *ever*, if it's going
> to be used in the backend -- there are equivalent functions in the backend.
> i don't think you need to do PQsetdb since you're already in a backend
> that is attached to a database.

To my opinion, PQsetdb ist *not* defined in the backend, so you cannot even 
use it.

I tried to do a PQexec without PQsetdb, and it worked as expected.


- Joerg


*********************************************************************
Dipl. Phys. Joerg Plewe               joerg.plewe@mpi-dortmund.mpg.de
MPI fuer molekulare Physiologie
Rheinlanddamm 201
44139 Dortmund
Germany                               +49 (0)231 1206 384
*********************************************************************





==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: postgres@postgres.berkeley.edu
  Cc: joerg.plewe@mpi-dortmund.mpg.de
  Subject: Re: PQExec inside a C function?
  In-Reply-To: <9406281120.AA10298@dl.mpi-dortmund.mpg.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox