/ Allocate OCCUR column description block for a view. */ /
| 379 | /* Allocate OCCUR column description block for a view. */ |
| 380 | /***********************************************************************/ |
| 381 | bool TDBOCCUR::ViewColumnList(PGLOBAL g) |
| 382 | { |
| 383 | char *pn; |
| 384 | int i; |
| 385 | PCOL colp, cp; |
| 386 | PTDBMY tdbp; |
| 387 | |
| 388 | if (!Tdbp->IsView()) |
| 389 | return false; |
| 390 | |
| 391 | if (Tdbp->GetAmType() != TYPE_AM_MYSQL) { |
| 392 | strcpy(g->Message, "View is not MySQL"); |
| 393 | return true; |
| 394 | } else |
| 395 | tdbp = (PTDBMY)Tdbp; |
| 396 | |
| 397 | for (cp = Columns; cp; cp = cp->GetNext()) |
| 398 | if (cp->GetAmType() == TYPE_AM_PRX) { |
| 399 | if ((colp = tdbp->MakeFieldColumn(g, cp->GetName()))) { |
| 400 | ((PPRXCOL)cp)->Colp = colp; |
| 401 | ((PPRXCOL)cp)->To_Val = colp->GetValue(); |
| 402 | } else |
| 403 | return true; |
| 404 | |
| 405 | } // endif Type |
| 406 | |
| 407 | Col = (PCOL*)PlugSubAlloc(g, NULL, Mult * sizeof(PCOL)); |
| 408 | |
| 409 | for (i = 0, pn = Colist; i < Mult; i++, pn += (strlen(pn) + 1)) |
| 410 | if (!(Col[i] = tdbp->MakeFieldColumn(g, pn))) { |
| 411 | // Column not found in table |
| 412 | snprintf(g->Message, sizeof(g->Message), MSG(COL_ISNOT_TABLE), pn, Tabname); |
| 413 | return true; |
| 414 | } // endif Col |
| 415 | |
| 416 | return false; |
| 417 | } // end of ViewColumnList |
| 418 | |
| 419 | /***********************************************************************/ |
| 420 | /* OCCUR GetMaxSize: returns the maximum number of rows in the table. */ |
nothing calls this directly
no test coverage detected