include
EXEC SQL include sqlca;
void main()
{
EXEC SQL begin declare section;
char dbname[19];
char total[32];
char free[32];
char dname[32];
EXEC SQL end declare section;
printf("Enter name of database:");
gets(dbname);
EXEC SQL connect to:dbname;
if(SQLCODE == 0)
{
printf("Database %s is now open.\n",dbname);
EXEC SQL select d.name, sum(c.chksize*c.pagesize)::dec(10,0) as total,
sum(c.nfree*c.pagesize)::dec(10,0) as free,
sum((c.chksize*c.pagesize - c.nfree*c.pagesize) /1024/1024)::dec(10,0) as use
from sysmaster:syschunks c, sysmaster:sysdbspaces d where c.dbsnum = d.dbsnum group by d.name;
printf("%s\n",dname);
printf("%s\n",total);
printf("%s\n",free);
}
else
printf("Error %ld opening database\n",SQLCODE);
exit(0);
}
이렇게 작성을 했는데...db접속은 잘됩니다....그 다음에 db의 사용률을 가져오는 쿼리를 날리는데.. 아무것도 안나오네요...ㅠㅠ
뭐가 틀렸는지 알려 주세요..
|