pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedGetting user created tables from SQL
2+ messages / 2 participants
[nested] [flat]
* Getting user created tables from SQL
@ 2005-10-02 13:30 Cenk KIZILDAG <cenk1536@yahoo.com>
2005-10-05 08:32 ` Re: Getting user created tables from SQL Richard Huxton <dev@archonet.com>
0 siblings, 1 reply; 2+ messages in thread
From: Cenk KIZILDAG @ 2005-10-02 13:30 UTC (permalink / raw)
To: 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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Getting user created tables from SQL
2005-10-02 13:30 Getting user created tables from SQL Cenk KIZILDAG <cenk1536@yahoo.com>
@ 2005-10-05 08:32 ` Richard Huxton <dev@archonet.com>
0 siblings, 0 replies; 2+ messages in thread
From: Richard Huxton @ 2005-10-05 08:32 UTC (permalink / raw)
To: Cenk KIZILDAG <cenk1536@yahoo.com>; +Cc: pgsql-sql
Cenk KIZILDAG wrote:
> TableQuery->SQL->Add ("SELECT TABLE_NAME AS TNAME FROM
> INFORMATION_SCHEMA.TABLES WHERE (TABLE_TYPE = 'BASE TABLE')");
> CTableArr[f] = TableQuery->FieldByName ("TNAME")->AsString;
> 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 don't suppose this could be an identifer case issue? In the first
query TNAME will be case-folded to 'tname' (because that's how PG does
case-insensitive identifiers).
Try looking up FieldByName("tname") and see if that comes up with anything.
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-10-05 08:32 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-02 13:30 Getting user created tables from SQL Cenk KIZILDAG <cenk1536@yahoo.com>
2005-10-05 08:32 ` Richard Huxton <dev@archonet.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox