Пример #1
0
bool OCCURDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
  {
  Rcol = GetStringCatInfo(g, "RankCol", "");
  Colist = GetStringCatInfo(g, "Colist", "");
  Xcol = GetStringCatInfo(g, "OccurCol", Colist);
  return PRXDEF::DefineAM(g, am, poff);
  } // end of DefineAM
Пример #2
0
bool PRXDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
  {
  char *pn, *db, *tab, *def = NULL;

  db = GetStringCatInfo(g, "Dbname", "*");
  def = GetStringCatInfo(g, "Srcdef", NULL);

  if (!(tab = GetStringCatInfo(g, "Tabname", NULL))) {
    if (!def) {
      strcpy(g->Message, "Missing object table definition");
      return true;
    } else
      tab = "Noname";

  } else
    // Analyze the table name, it may have the format: [dbname.]tabname
    if ((pn = strchr(tab, '.'))) {
      *pn++ = 0;
      db = tab;
      tab = pn;
      } // endif pn

  Tablep = new(g) XTAB(tab, def);
  Tablep->SetQualifier(db);
  return false;
  } // end of DefineAM
Пример #3
0
bool TBLDEF::DefineAM(PGLOBAL g, LPCSTR, int)
  {
  char   *tablist, *dbname, *def = NULL;

  Desc = "Table list table";
  tablist = GetStringCatInfo(g, "Tablist", "");
  dbname = GetStringCatInfo(g, "Dbname", "*");
  def = GetStringCatInfo(g, "Srcdef", NULL);
  Ntables = 0;

  if (*tablist) {
    char  *p, *pn, *pdb;
    PTABLE tbl;

    for (pdb = tablist; ;) {
      if ((p = strchr(pdb, ',')))
        *p = 0;

      // Analyze the table name, it may have the format:
      // [dbname.]tabname
      if ((pn = strchr(pdb, '.'))) {
        *pn++ = 0;
      } else {
        pn = pdb;
        pdb = dbname;
      } // endif p

      // Allocate the TBLIST block for that table
      tbl = new(g) XTAB(pn, def);
      tbl->SetSchema(pdb);
      
      if (trace)
        htrc("TBL: Name=%s db=%s\n", tbl->GetName(), tbl->GetSchema());

      // Link the blocks
      if (Tablep)
        Tablep->Link(tbl);
      else
        Tablep = tbl;

      Ntables++;

      if (p)
        pdb = pn + strlen(pn) + 1;
      else
        break;

      } // endfor pdb

    Maxerr = GetIntCatInfo("Maxerr", 0);
    Accept = GetBoolCatInfo("Accept", false);
    Thread = GetBoolCatInfo("Thread", false);
    } // endif tablist

  return FALSE;
  } // end of DefineAM
Пример #4
0
bool XCLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
  {
  char buf[8];

  Xcol = GetStringCatInfo(g, "Colname", "");
  GetCharCatInfo("Separator", ",", buf, sizeof(buf));
  Sep = (strlen(buf) == 2 && buf[0] == '\\' && buf[1] == 't') ? '\t' : *buf;
  Mult = GetIntCatInfo("Mult", 10);
  return PRXDEF::DefineAM(g, am, poff);
  } // end of DefineAM
Пример #5
0
bool WMIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
  {
  Nspace = GetStringCatInfo(g, "Namespace", "Root\\CimV2");
  Wclass = GetStringCatInfo(g, "Class",
          (!stricmp(Nspace, "root\\cimv2") ? "ComputerSystemProduct" : 
           !stricmp(Nspace, "root\\cli")   ? "Msft_CliAlias" : ""));

  if (!*Wclass) {
    sprintf(g->Message, "Missing class name for %s", Nspace);
    return true;
  } else if (!strchr(Wclass, '_')) {
    char *p = (char*)PlugSubAlloc(g, NULL, strlen(Wclass) + 7);
    Wclass = strcat(strcpy(p, "Win32_"), Wclass);
  } // endif Wclass

  if (Catfunc == FNC_NO)
    Ems = GetIntCatInfo("Estimate", 100);

  return false;
  } // end of DefineAM
Пример #6
0
bool PIVOTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
  {
  char *p1, *p2;
  PHC    hc = ((MYCAT*)Cat)->GetHandler();

  if (PRXDEF::DefineAM(g, am, poff))
    return TRUE;

  Tabname = (char*)Tablep->GetName();
  DB = (char*)Tablep->GetQualifier();
  Tabsrc = (char*)Tablep->GetSrc();

  Host = GetStringCatInfo(g, "Host", "localhost");
  User = GetStringCatInfo(g, "User", "*");
  Pwd = GetStringCatInfo(g, "Password", NULL);
  Picol = GetStringCatInfo(g, "PivotCol", NULL);
  Fncol = GetStringCatInfo(g, "FncCol", NULL);
  
  // If fncol is like avg(colname), separate Fncol and Function
  if (Fncol && (p1 = strchr(Fncol, '(')) && (p2 = strchr(p1, ')')) &&
      (*Fncol != '"') &&  (!*(p2+1))) {
    *p1++ = '\0'; *p2 = '\0';
    Function = Fncol;
    Fncol = p1;
  } else
    Function = GetStringCatInfo(g, "Function", "SUM");

  GBdone = GetBoolCatInfo("Groupby", false);
  Accept = GetBoolCatInfo("Accept", false);
  Port = GetIntCatInfo("Port", 3306);
  Desc = (Tabsrc) ? Tabsrc : Tabname;
  return FALSE;
  } // end of DefineAM
Пример #7
0
bool INIDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
  {
  char   buf[8];

  Fn = GetStringCatInfo(g, "Filename", NULL);
  GetCharCatInfo("Layout", "C", buf, sizeof(buf));
  Layout = toupper(*buf);

  if (Fn) {
    char   *p = (char*)PlugSubAlloc(g, NULL, _MAX_PATH);

    PlugSetPath(p, Fn, GetPath());
    Fn = p;
  } else {
    strcpy(g->Message, MSG(MISSING_FNAME));
    return true;
  } // endif Fn

  Ln = GetSizeCatInfo("Secsize", "8K");
  Desc = Fn;
  return false;
  } // end of DefineAM