Re: Using variables from c to be passed into PQexec

Поиск
Список
Период
Сортировка
От Carl van Tast
Тема Re: Using variables from c to be passed into PQexec
Дата
Msg-id 5oip6u070tgt09ts3t9kvipva46j6i1n1a@4ax.com
обсуждение исходный текст
Список pgsql-general
On 14 Feb 2002 21:55:00 -0800, vikashb@mweb.co.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Samik Raychaudhuri
Дата:
Сообщение: Re: Installing DBD::Pg module without Pg Database server
Следующее
От: Josh Rovero
Дата:
Сообщение: Re: Postal code radius searches