Getting user created tables from SQL

From: Cenk KIZILDAG <cenk1536(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Getting user created tables from SQL
Date: 2005-10-02 13:30:31
Message-ID: 20051002133031.305.qmail@web40501.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

hi guys,

i m trying to get the user created tables from SQL by using C++ Builder.Here is the code:

TQuery *TableQuery;
TableQuery= new TQuery (this);
TQuery *TableCountQuery;
TableCountQuery= new TQuery (this);
TableQuery->DatabaseName = "TEMP";
TableCountQuery->DatabaseName = "TEMP";

TableCountQuery->SQL->Add ("SELECT COUNT(TABLE_NAME) AS CTABLE FROM INFORMATION_SCHEMA.TABLES WHERE (TABLE_TYPE = 'BASE TABLE')");
TableCountQuery->Open ();

int counttables = TableCountQuery->FieldByName ("CTABLE")->AsInteger;

TableCountQuery->Close ();
TableCountQuery->Free ();

TableQuery->SQL->Add ("SELECT TABLE_NAME AS TNAME FROM INFORMATION_SCHEMA.TABLES WHERE (TABLE_TYPE = 'BASE TABLE')");
TableQuery->Open ();

DynamicArray <AnsiString> CTableArr;
CTableArr.Length = counttables;
int f = 0;
while (!TableQuery->Eof)
{
CTableArr[f] = TableQuery->FieldByName ("TNAME")->AsString;
TableQuery->Next();
f++;
}
TableQuery->Close ();
TableQuery->Free ();

the first Select statement work correct, counttables variable gets the right value but unfortunately, after the second select statement, in C++ Builders SQL Explorer window, it brings the correct number of rows but without datas in them!!! In Enterprise Manager the second select statement also works correct but how come it aint work in C++ builder?

i would be grateful if you can help me

Thanks
CENK

THE PUBLICENEMY
http://www3.50megs.com/cenk1536/

CHAIRMAN Of Computer Information Systems Technology CLUB

---------------------------------
Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message jan aerts (RI) 2005-10-03 10:21:18 Re: combination of function to simple query makes query slow
Previous Message brett 2005-10-01 22:32:05 BirthDay SQL Issue