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!


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to