Getting user created tables from SQL - Mailing list pgsql-sql

From Cenk KIZILDAG
Subject Getting user created tables from SQL
Date
Msg-id 20051002133031.305.qmail@web40501.mail.yahoo.com
Whole thread Raw
Responses Re: Getting user created tables from SQL  (Richard Huxton <dev@archonet.com>)
List 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.

pgsql-sql by date:

Previous
From: "Scott cox"
Date:
Subject: creating postgres tables by passing a string to function
Next
From: solarsail
Date:
Subject: query tables based on a query