Re: Using variables from c to be passed into PQexec

From: Carl van Tast <vanTast(at)Pivot(dot)at>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Using variables from c to be passed into PQexec
Date: 2002-02-15 08:57:35
Message-ID: 5oip6u070tgt09ts3t9kvipva46j6i1n1a@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 14 Feb 2002 21:55:00 -0800, vikashb(at)mweb(dot)co(dot)za (Vikash Badal)
wrote:

>strcat(querystr,"\"DECLARE mycursor CURSOR FOR select * from currpass
>where sitename = \'tvl\'\");

Vikash,
double quotes tell the C compiler, where a string literal starts and
ends. Otherwise DECLARE would be interpreted as a name of a variable
and the next word wolud be a syntax error. Your querystr should not
*contain* the double quotes. So

strcat(querystr,"DECLARE mycursor CURSOR FOR select * from currpass
where sitename = 'tvl'");

should do the trick. BTW, are you sure you want strcat and not
strcpy?

Kind regards,
Carl van Tast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josh Rovero 2002-02-15 10:13:41 Re: Postal code radius searches
Previous Message Hans-Juergen Schoenig 2002-02-15 07:50:30 Re: Postgresql/linux speed + reliability