wxString slNode::GetSql(ctlTree *browser) { if (sql.IsNull()) { sql = wxT("-- Create replication node ") + GetName() + wxT(".\n\n") wxT("SELECT ") + GetCluster()->GetSchemaPrefix() + wxT("storenode(") + NumToStr(GetSlId()) + wxT(", ") + qtDbString(GetComment()); if (GetCluster()->ClusterMinimumVersion(1, 1) && !GetCluster()->ClusterMinimumVersion(2, 0)) sql += wxT(", ") + BoolToStr(GetSpool()); sql += wxT(");\n"); } return sql; }
void slNode::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { wxString pidcol = wxEmptyString; pgConn *conn = GetCluster()->GetNodeConn(form, GetSlId(), pid < 0); if (!expandedKids) { expandedKids = true; browser->RemoveDummyChild(this); // Log wxLogInfo(wxT("Adding child object to node %s"), GetIdentifier().c_str()); browser->AppendCollection(this, pathFactory); browser->AppendCollection(this, listenFactory); } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("ID"), GetSlId()); if (GetCluster()->GetLocalNodeID() == GetSlId()) properties->AppendYesNoItem(_("Local node"), true); properties->AppendYesNoItem(_("Active"), GetActive()); if (GetCluster()->ClusterMinimumVersion(1, 1)) properties->AppendYesNoItem(_("Log spooler"), GetSpool()); properties->AppendYesNoItem(_("Connected"), conn != NULL); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (conn && pid < 0) { if (conn->BackendMinimumVersion(9, 0)) { if (conn->BackendMinimumVersion(9, 2)) pidcol = wxT("pid"); else pidcol = wxT("procpid"); pid = StrToLong(conn->ExecuteScalar( wxT("SELECT nl_backendpid FROM ") + qtIdent(wxT("_") + GetCluster()->GetName()) + wxT(".sl_nodelock nl, ") wxT("pg_stat_activity sa WHERE nl.nl_backendpid = sa.") + pidcol + wxT(" AND nl_nodeid = ") + NumToStr(GetCluster()->GetLocalNodeID()))); } else { pid = StrToLong(conn->ExecuteScalar( wxT("SELECT listenerpid FROM pg_listener WHERE relname=") + qtDbString(wxT("_") + GetCluster()->GetName() + wxT("_Restart")))); } } if (conn) { if (GetPid()) properties->AppendItem(_("Running PID"), GetPid()); else properties->AppendItem(_("Running PID"), _("not running")); } else { if (GetSlId() != GetCluster()->GetAdminNodeID()) properties->AppendItem(_("Running PID"), _("administrative node")); } } }
int main(int ac, char **av) { int LoadArticle = 0; int DumpFeeds = 0; int SpoolMatch = 0; if (ac < 1) Usage(av[0]); LoadDiabloConfig(ac, av); /* * Options */ { int i; for (i = 1; i < ac; ++i) { char *ptr = av[i]; if (*ptr != '-') continue; ptr += 2; switch(ptr[-1]) { case 'a': LoadArticle = 1; break; case 'C': if (*ptr == 0) ++i; break; case 'D': if (*ptr == 0) { ++i; ptr = av[i]; } Dist = ptr; break; case 'd': if (isdigit((int)(unsigned char)*ptr)) { DebugOpt = strtol(ptr, NULL, 0); } else { --ptr; while (*ptr == 'd') { ++DebugOpt; ++ptr; } } FeedDebug = 1; break; case 'F': DumpFeeds = 1; break; case 'h': HeadOnly = 1; break; case 'l': if (*ptr == 0) { ++i; ptr = av[i]; } Label = ptr; break; case 'M': if (*ptr == 0) { ++i; ptr = av[i]; } MessageId = ptr; break; case 'N': if (*ptr == 0) { ++i; ptr = av[i]; } DNewsfeedsPat = ptr; break; case 'n': if (*ptr == 0) { ++i; ptr = av[i]; } Newsgroups = ptr; break; case 'p': if (*ptr == 0) { ++i; ptr = av[i]; } NumPath = ptr; break; case 'S': Spam = 1; break; case 's': if (*ptr == 0) { ++i; ptr = av[i]; } Size = ptr; break; case 't': if (*ptr == 0) { ++i; ptr = av[i]; } ArtType = ArtTypeConv(ptr); break; case 'V': PrintVersion(); break; case 'X': SpoolMatch = 1; break; default: Usage(av[0]); } } } LoadNewsFeed(0, 1, Label); if (LoadArticle) LoadArt(); if (DumpFeeds) { if (Label == NULL) DumpAllFeedInfo(stdout); else DumpFeedInfo(stdout, Label); exit(0); } if (Newsgroups == NULL) { printf("Missing Newsgroups\n\n"); Usage(av[0]); } { char artType[32]; char offSize[64]; sprintf(artType, "%06x", ArtType); sprintf(offSize, "0,%s", Size); printf("Matching:\n"); printf("\tNewsgroups: %s\n", Newsgroups); printf("\tDistribution: %s\n", Dist); printf("\tSize: %s\n", Size); printf("\tMessage-ID: %s\n", MessageId != NULL ? MessageId : "NONE"); printf("\tNumPath: %s\n", NumPath); printf("\tArtType: %s\n", artType); printf("\tHeadOnly: %s\n", HeadOnly ? "Yes" : "No"); printf("\tSpam: %s\n", Spam ? "Yes" : "No"); if (SpoolMatch) { uint16 Spool; LoadSpoolCtl(0, 1); AllocateSpools(0); Spool = GetSpool(MessageId, Newsgroups, atoi(Size), ArtType, Label, NULL, NULL); printf("\nMatched spool: "); if (Spool == (uint16)-3) printf("DontStore\n"); else if (Spool == (uint16)-2) printf("RejectArt\n"); else if (Spool == (uint16)-1) printf("NoSpool\n"); else printf("%02d\n", Spool); exit(0); } FeedWrite(0, fwCallBack, "", "", offSize, Newsgroups, NumPath, Dist, HeadOnly ? "1" : "0", artType, Spam, 0); } exit(0); }