Basic beginner question
От | Rob Brown-Bayliss |
---|---|
Тема | Basic beginner question |
Дата | |
Msg-id | 20000306221747.A9242@ZOOstation.cc обсуждение исходный текст |
Список | pgsql-interfaces |
Could some one tell me why this does not work? The second Cursor_DB() fails. Also, is there a nicer way to output " to strings? The method I have used is ugly! Thanks gint GetSync_DB(void) { gint sync_return=0;char *updatekey; Begin_DB();Cursor_DB("DECLARE mycursor CURSOR FOR select * from sync_key");FetchAll_DB(); /* * The sync_key is a singlefield in a single row. * That is the table has only a single peice of data, the key */sync_return = atol(PQgetvalue(res,0, 0));printf("Sync_Key is %d\n",sync_return); PQclear(res);Commit_DB();sprintf(updatekey,"DECLARE mycursorCURSOR FOR update %csync_key%c set %ckey%c='%i' where oid=20565",34,34,34,34,sync_return+1);printf("%s\n",updatekey);Cursor_DB(updatekey);Commit_DB(); return (sync_return); } void Cursor_DB(char *string) {res = PQexec(conn,string);if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) { fprintf(stderr, "DECLARE CURSOR commandfailed\n"); PQclear(res); exit_nicely(conn); }PQclear(res); } Rob Brown-Bayliss ---====<*>====--- live from ZOOstation http://www.ZOOstation.cc
В списке pgsql-interfaces по дате отправления: