/ Initializes the table table list. */ /
| 229 | /* Initializes the table table list. */ |
| 230 | /***********************************************************************/ |
| 231 | bool TDBTBL::InitTableList(PGLOBAL g) |
| 232 | { |
| 233 | const char *scs; |
| 234 | PTABLE tp, tabp; |
| 235 | PCOL colp; |
| 236 | PTBLDEF tdp = (PTBLDEF)To_Def; |
| 237 | PCATLG cat = To_Def->GetCat(); |
| 238 | PHC hc = ((MYCAT*)cat)->GetHandler(); |
| 239 | |
| 240 | scs = hc->option_struct->connect; |
| 241 | // PlugSetPath(filename, Tdbp->GetFile(g), Tdbp->GetPath()); |
| 242 | |
| 243 | for (tp = tdp->Tablep; tp; tp = tp->GetNext()) { |
| 244 | if (TestFil(g, To_CondFil, tp)) { |
| 245 | tabp = new(g) XTAB(tp); |
| 246 | |
| 247 | if (tabp->GetSrc()) { |
| 248 | // Table list is a list of connections |
| 249 | hc->option_struct->connect= (char*)tabp->GetName(); |
| 250 | } // endif Src |
| 251 | |
| 252 | // Get the table description block of this table |
| 253 | if (!(Tdbp = GetSubTable(g, tabp))) { |
| 254 | if (++Nbc > Maxerr) |
| 255 | return TRUE; // Error return |
| 256 | else |
| 257 | continue; // Skip this table |
| 258 | |
| 259 | } else |
| 260 | RemoveNext(tabp); // To avoid looping |
| 261 | |
| 262 | // We must allocate subtable columns before GetMaxSize is called |
| 263 | // because some (PLG, ODBC?) need to have their columns attached. |
| 264 | // Real initialization will be done later. |
| 265 | for (colp = Columns; colp; colp = colp->GetNext()) |
| 266 | if (!colp->IsSpecial()) |
| 267 | if (((PPRXCOL)colp)->Init(g, NULL) && !Accept) |
| 268 | return TRUE; |
| 269 | |
| 270 | if (Tablist) |
| 271 | Tablist->Link(tabp); |
| 272 | else |
| 273 | Tablist = tabp; |
| 274 | |
| 275 | } // endif filp |
| 276 | |
| 277 | } // endfor tp |
| 278 | |
| 279 | hc->option_struct->connect = (char*)scs; |
| 280 | |
| 281 | //NumTables = n; |
| 282 | To_CondFil = NULL; // To avoid doing it several times |
| 283 | return FALSE; |
| 284 | } // end of InitTableList |
| 285 | |
| 286 | /***********************************************************************/ |
| 287 | /* Test the tablename against the pseudo "local" filter. */ |