Getting user created tables from SQL

Поиск
Список
Период
Сортировка
От Cenk KIZILDAG
Тема Getting user created tables from SQL
Дата
Msg-id 20051002133031.305.qmail@web40501.mail.yahoo.com
обсуждение исходный текст
Ответы Re: Getting user created tables from SQL  (Richard Huxton <dev@archonet.com>)
Список 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 по дате отправления:

Предыдущее
От: "Scott cox"
Дата:
Сообщение: creating postgres tables by passing a string to function
Следующее
От: solarsail
Дата:
Сообщение: query tables based on a query