agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Casey Claiborne <mskc@io.com>
To: postgres@postgres.Berkeley.EDU
Subject: NCSA and postgres dont like each other
Date: Mon, 10 Jul 1995 23:06:12 -0500
Message-ID: <199507110406.XAA24519@tristero.io.com> (raw)

Hello everyone-
	I am currently using a postgres database with a NCSA httpd server.
I thought that everything was OK until I ran this piece of code below.
What is happening is as follows:

1) HTML form is displayed
2) press "submit" button on HTML form
3) cgi-srcipt takes data fromt the form
4) data from the form is sent to routine listed below for placement
	into database.
5) at the point when either 'PQexec("end")' or 'PQfinish()' are executed,
	the NCSA server screen is displayed with an error code of 500.


Problem is:
	This database routine works just fine by itself - if I take the
code below, place it into a C routine, compile and run it, I have no
problems at all. Everything happens as it should - information goes into the db.
After some troubleshooting, I have found that the error occurs when either
of the following are executed: PQexec("end") OR PQfinish()

Question is:
	Why is this happening? My goal is to take data from an HTML form
and place it into the postgres database. I would like to accomplish
this from C code. Below is the way that I have approaced the problem.
Is there a better way to do this because obviously, the approch below
does not work.

Does anyone have any suggestions?

Casey => mskc@io.com

....

sprintf(final,  "append (ccnamelast = \"%s\", ccnamemiddle = \'%c\', 
ccnamefirstp = \"%s\" ",
	  customerinfo -> ccnamelast,
          customerinfo -> ccnamemiddle,
          customerinfo -> ccnamefirstp);

PQsetdb("DB");
PQexec("begin");
res = PQexec(final);
if (*res == 'I' )
	{
	printf("non-fatal error occurred ");
	PQexec("end"); <= causes an error with NCSA server
	return FATAL_ERROR;
	}
if (*res == 'E' )
	{
	printf("fatal error occurred");
	PQexec("end"); <= causes an error with NCSA server
	return NON_FATAL_ERROR;
	}
PQexec("end"); <= causes error with NCSA server
PQfinish();
return SUCCESS;
}
Casey Claiborne mskc@io.com

One must note the importance of setting reasonable and achievable goals for
                    "If you aim for nothing, you'll hit it every time" 


============================================================================

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: mskc@io.com
  Subject: Re: NCSA and postgres dont like each other
  In-Reply-To: <199507110406.XAA24519@tristero.io.com>

* 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