From: | Esteban Gutierrez Abarzua <esgutier(at)sauce(dot)chillan(dot)ubiobio(dot)cl> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | sql + C |
Date: | 2001-10-05 19:45:02 |
Message-ID: | Pine.LNX.4.21.0110051531410.8484-100000@sauce.chillan.ubiobio.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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!
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-10-05 20:31:25 | Re: SQL CONSTRAINTS - Constraining time values from two attributes on a table. |
Previous Message | Stephan Szabo | 2001-10-05 18:49:01 | Re: [SQL] Why the weak key is created as unique |