sql + C - Mailing list pgsql-sql

From Esteban Gutierrez Abarzua
Subject sql + C
Date
Msg-id Pine.LNX.4.21.0110051531410.8484-100000@sauce.chillan.ubiobio.cl
Whole thread Raw
Responses Re: sql + C  (Haller Christoph <ch@rodos.fzk.de>)
List pgsql-sql
hi.
who  knows about C embebed (postgres + C)?I have the program:

#include<string.h>
EXEC SQL BEGIN DECLARE SECTION;       VARCHAR base[50];
EXEC SQL END DECLARE SECTION;
EXEC SQL INCLUDE sqlca;
EXEC SQL DECLARE C77 CURSOR FOR select datname from  pg_user,pg_database
where usename= :user and datdba=usesysid;
main ()
{  EXEC SQL CONNECT TO mybase; if(sqlca.sqlcode < 0) {    printf(" error");   exit(1); }
// now I want to get results EXEC SQL OPEN C77;EXEC SQL FETCH IN C77 INTO :base; // here, it's the problem, I can't to
get the result on the base variable. I think that can be the variable
type.  then how should be the data type for ":base" variable? ........
.......
.......
.....
...
.
.
.
.
pg_database has the  attributes as follow:

mybase=> \d pg_database     Table "pg_database"Attribute |  Type   | Modifier
-----------+---------+----------datname   | name    |         --->I can't to get the "datname"......why?datdba    |
integer|encoding  | integer |datpath   | text    |
 

I hope than you understand!

bye   and thanks!



pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Why the weak key is created as unique
Next
From: Tomasz Myrta
Date:
Subject: Re: temporary views