Using variables from c to be passed into PQexec

Поиск
Список
Период
Сортировка
От vikashb@mweb.co.za (Vikash Badal)
Тема Using variables from c to be passed into PQexec
Дата
Msg-id b42d7fe.0202142154.3707e73c@posting.google.com
обсуждение исходный текст
Ответы Re: Using variables from c to be passed into PQexec
Список pgsql-general
Greetings,

I am a novice programmer and I am now totally lost,
I've been through the web trying to find a solution,
If I've posted on the wrong place please advise.


If I have this line in the code, I get there desired result.
res = PQexec(conn, "DECLARE mycursor CURSOR FOR select * from currpass
where sitename = 'tvl'");
I get :
------------------------------------------------------------------
sitename       password       date           time

tvl            Zb0sj1sds       2002-02-13     12:21:00
------------------------------------------------------------------

If I do this:
strcat(querystr,"\"DECLARE mycursor CURSOR FOR select * from currpass
where sitename = \'tvl\'\");
fprintf(stdout,"%s\n", querystr);
res = PQexec(conn, querystr);

I get
---------------------------------------------------------------------------
Output of fprintf:
"DECLARE mycursor CURSOR FOR select * from currpass where sitename =
'tvl'"

Error Message:
NOTICE:  identifier "DECLARE mycursor CURSOR FOR select * from
currpass where si
tename = 'tvl'" will be truncated to "DECLARE mycursor CURSOR FOR sel"
DECLARE CURSOR command failed

-----------------------------------------------------------------------------

What am I missing ?

Please assist

Vikash

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

Предыдущее
От: "Andre' Blanchard"
Дата:
Сообщение: How to properly build postgresql version 7.2 on Unix Platforms?
Следующее
От: Herbert Liechti
Дата:
Сообщение: Re: Report generation