Пример #1
0
wxArrayString Postgres::GetTables()
  {
  if(!IsConnected())
    throw wx::Exception(wxT("Postgres::GetTables() Database not connected."));

  wxString sqryTables = wxT("                 \
SELECT                                        \
  relname                                     \
FROM                                          \
  pg_class cl                                 \
INNER JOIN                                    \
  pg_namespace ns                             \
ON                                            \
  cl.relnamespace = ns.oid                    \
WHERE                                         \
  ns.nspname = 'public'                       \
AND                                           \
  cl.reltype <> 0                             \
AND                                           \
  cl.relkind = 'r';                           \
");

  ArrayRecordArray ara;
  stc.CacheExecute
    (
    wxT("Postgres::GetTables"),
    sqryTables,
    ArrayRecord(),
    ara
    );

  ArrayRecord ar;
  for(ArrayRecordArray::iterator it = ara.begin(); it != ara.end(); it++)
    ar.push_back(it->at(0));

  return ar.GetArrayString();
  }