void CollectionLinkItem::Inspect_(std::ostream& os) const { bool good_labels = true; for (auto& lbl : GetLabels()) if (lbl.ptr.offset % sizeof(Entry) != 0 || lbl.ptr.offset / sizeof(Entry) >= entries.size()) { good_labels = false; break; } if (!good_labels) Item::Inspect_(os); size_t i = 0; for (const auto& e : entries) { if (good_labels) { auto x = GetLabels().equal_range(i); for (auto it = x.first; it != x.second; ++it) os << '@' << it->name << ":\n"; i += sizeof(Entry); } os << "collection_link(@" << e.name_0->name << ", @" << e.name_1->name << ")\n"; } }
void pgLanguage::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); if (GetConnection()->BackendMinimumVersion(8, 3)) properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("ACL"), GetAcl()); properties->AppendYesNoItem(_("Trusted?"), GetTrusted()); properties->AppendItem(_("Handler function"), GetHandlerProc()); if (GetConnection()->BackendMinimumVersion(9, 0)) properties->AppendItem(_("Inline function"), GetInlineProc()); properties->AppendItem(_("Validator function"), GetValidatorProc()); properties->AppendYesNoItem(_("System language?"), GetSystemObject()); if (GetConnection()->BackendMinimumVersion(7, 5)) properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }
void pgSequence::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { UpdateValues(); if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("ACL"), GetAcl()); properties->AppendItem(_("Current value"), GetLastValue()); properties->AppendItem(_("Next value"), GetNextValue()); properties->AppendItem(_("Minimum"), GetMinValue()); properties->AppendItem(_("Maximum"), GetMaxValue()); properties->AppendItem(_("Increment"), GetIncrement()); properties->AppendItem(_("Cache"), GetCacheValue()); properties->AppendYesNoItem(_("Cycled?"), GetCycled()); properties->AppendYesNoItem(_("Called?"), GetCalled()); properties->AppendYesNoItem(_("System sequence?"), GetSystemObject()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }
void pgView::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (!expandedKids) { expandedKids = true; browser->RemoveDummyChild(this); browser->AppendCollection(this, columnFactory); pgCollection *collection = browser->AppendCollection(this, ruleFactory); collection->iSetOid(GetOid()); collection->ShowTreeDetail(browser); treeObjectIterator colIt(browser, collection); pgRule *rule; while (!hasInsertRule && !hasUpdateRule && !hasDeleteRule && (rule = (pgRule *)colIt.GetNextObject()) != 0) { if (rule->GetEvent().Find(wxT("INSERT")) >= 0) hasInsertRule = true; if (rule->GetEvent().Find(wxT("UPDATE")) >= 0) hasUpdateRule = true; if (rule->GetEvent().Find(wxT("DELETE")) >= 0) hasDeleteRule = true; } if (GetConnection()->BackendMinimumVersion(9, 1)) browser->AppendCollection(this, triggerFactory); } if (properties) { CreateListColumns(properties); wxString def = GetDefinition().Left(250); def.Replace(wxT("\n"), wxT(" ")); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("ACL"), GetAcl()); properties->AppendItem(_("Definition"), def); properties->AppendYesNoItem(_("System view?"), GetSystemObject()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (GetConnection()->BackendMinimumVersion(9, 2) && GetSecurityBarrier().Length() > 0) properties->AppendItem(_("Security barrier?"), GetSecurityBarrier()); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }
void PlotImages() { gStyle->SetOptStat(0); gStyle->SetPadRightMargin(0.2); string filename[1]; char buffer[100]; char buffertext[100]; for (int seed=55; seed<56; seed++) { int n=sprintf(buffer, "/home/les67/locust_faketrack_waterfall.root"); const char *file = buffer; TFile* f = TFile::Open(file); if (!((!f)||f->IsZombie())) { TH2D* hspectrogram = GetSpectrogram(file); TH2D* hlabels = GetLabels(hspectrogram, 40e-21); // threshold for labeling goes here. // TGraph* grlabels = GetLabelGraph(hlabels); // PrintLabels(grlabels); // print labels to terminal. hspectrogram->GetXaxis()->SetRangeUser(0.,0.02); hspectrogram->GetYaxis()->SetRangeUser(149.e6, 170.e6); TCanvas *c = new TCanvas; n=sprintf(buffertext, "hspectrogram_%d.png", seed); const char *pngname = buffertext; hspectrogram->GetYaxis()->SetTitleOffset(1.25); hspectrogram->DrawCopy("colz"); /* grlabels->SetMarkerColor(2); grlabels->SetMarkerStyle(8); grlabels->SetMarkerSize(0.6); grlabels->SetLineWidth(3.); grlabels->SetLineColor(2); grlabels->Draw("psame"); */ /* TImage *img = TImage::Create(); img->FromPad(c); img->WriteImage(pngname); delete img; delete hspectrogram; delete c; */ f->Close(); } } }
WizAppData::WizAppData() { ico=""; bmp=""; errlevel=256; sig.Printf("%s %s",APP_TITLE,APP_VERSION); title=APP_TITLE; // wxInitAllImageHandlers(); // png fails on cygwin // so instead only init what we need: wxImage::AddHandler(new wxBMPHandler); wxImage::AddHandler(new wxXPMHandler); bitmap=wxBitmap(wizapp_xpm); icon=wxIcon(wxWizApp_xpm); BuildInputEnvironment(); GetLabels(); GetFile(); }
void pgDomain::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (!expandedKids) { expandedKids = true; browser->RemoveDummyChild(this); // Log wxLogInfo(wxT("Adding child object to domain %s"), GetIdentifier().c_str()); if (GetConnection()->BackendMinimumVersion(7, 4)) browser->AppendCollection(this, constraintFactory); } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("Base type"), GetBasetype()); if (GetDimensions()) properties->AppendItem(_("Dimensions"), GetDimensions()); if (GetCollationOid() > 0) properties->AppendItem(_("Collation"), GetQuotedCollation()); properties->AppendItem(_("Default"), GetDefault()); properties->AppendYesNoItem(_("Not NULL?"), GetNotNull()); properties->AppendYesNoItem(_("System domain?"), GetSystemObject()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }
// -------------------------------------------------------------------------------- // void guJamendoLibrary::UpdateAlbumsLabels( const guArrayListItems &labelsets ) { guListItems LaItems; // The ArtistLabels string is the same for all songs so done out of the loop GetLabels( &LaItems, true ); int ItemIndex; int ItemCount = labelsets.Count(); for( ItemIndex = 0; ItemIndex < ItemCount; ItemIndex++ ) { wxArrayInt ItemLabels = labelsets[ ItemIndex ].GetData(); //guLogMessage( wxT( "Artist Labels : '%s'" ), ArtistLabelStr.c_str() ); // Update the Database wxArrayInt ItemIds; ItemIds.Add( labelsets[ ItemIndex ].GetId() ); SetAlbumsLabels( ItemIds, ItemLabels ); } }
void pgTablespace::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (!expandedKids) { expandedKids = true; } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("Location"), GetLocation()); size_t i; for (i = 0 ; i < variables.GetCount() ; i++) { wxString item = variables.Item(i); properties->AppendItem(item.BeforeFirst('='), item.AfterFirst('=')); } properties->AppendItem(_("ACL"), GetAcl()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }
void pgFunction::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("Argument count"), GetArgCount()); properties->AppendItem(_("Arguments"), GetArgListWithNames()); properties->AppendItem(_("Signature arguments"), GetArgSigList()); if (!GetIsProcedure()) properties->AppendItem(_("Return type"), GetReturnType()); properties->AppendItem(_("Language"), GetLanguage()); properties->AppendYesNoItem(_("Returns a set?"), GetReturnAsSet()); if (GetLanguage().IsSameAs(wxT("C"), false)) { properties->AppendItem(_("Object file"), GetBin()); properties->AppendItem(_("Link symbol"), GetSource()); } else properties->AppendItem(_("Source"), firstLineOnly(GetSource())); if (GetConnection()->BackendMinimumVersion(8, 3)) { properties->AppendItem(_("Estimated cost"), GetCost()); if (GetReturnAsSet()) properties->AppendItem(_("Estimated rows"), GetRows()); } properties->AppendItem(_("Volatility"), GetVolatility()); if (GetConnection()->BackendMinimumVersion(9, 2)) properties->AppendYesNoItem(_("Leak proof?"), GetIsLeakProof()); properties->AppendYesNoItem(_("Security of definer?"), GetSecureDefiner()); properties->AppendYesNoItem(_("Strict?"), GetIsStrict()); if (GetConnection()->BackendMinimumVersion(8, 4)) properties->AppendYesNoItem(_("Window?"), GetIsWindow()); size_t i; for (i = 0 ; i < configList.GetCount() ; i++) { wxString item = configList.Item(i); properties->AppendItem(item.BeforeFirst('='), item.AfterFirst('=')); } properties->AppendItem(_("ACL"), GetAcl()); properties->AppendYesNoItem(_("System function?"), GetSystemObject()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }
void pgSchemaBase::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { GetDatabase()->GetServer()->iSetLastDatabase(GetDatabase()->GetName()); GetDatabase()->GetServer()->iSetLastSchema(GetName()); if (!expandedKids) { expandedKids = true; browser->RemoveDummyChild(this); // Log wxLogInfo(wxT("Adding child object to schema %s"), GetIdentifier().c_str()); if (!(GetMetaType() == PGM_CATALOG && (GetFullName() == wxT("dbo") || GetFullName() == wxT("sys") || GetFullName() == wxT("information_schema")))) { if (settings->GetDisplayOption(_("Aggregates"))) browser->AppendCollection(this, aggregateFactory); if (settings->GetDisplayOption(_("Collations")) && GetConnection()->BackendMinimumVersion(9, 1)) browser->AppendCollection(this, collationFactory); if (settings->GetDisplayOption(_("Conversions"))) browser->AppendCollection(this, conversionFactory); if (settings->GetDisplayOption(_("Domains"))) browser->AppendCollection(this, domainFactory); if (settings->GetDisplayOption(_("Foreign Tables")) && GetConnection()->BackendMinimumVersion(9, 1)) browser->AppendCollection(this, foreignTableFactory); if (settings->GetDisplayOption(_("FTS Configurations"))) { if (GetConnection()->BackendMinimumVersion(8, 3)) browser->AppendCollection(this, textSearchConfigurationFactory); } if (settings->GetDisplayOption(_("FTS Dictionaries"))) { if (GetConnection()->BackendMinimumVersion(8, 3)) browser->AppendCollection(this, textSearchDictionaryFactory); } if (settings->GetDisplayOption(_("FTS Parsers"))) { if (GetConnection()->BackendMinimumVersion(8, 3)) browser->AppendCollection(this, textSearchParserFactory); } if (settings->GetDisplayOption(_("FTS Templates"))) { if (GetConnection()->BackendMinimumVersion(8, 3)) browser->AppendCollection(this, textSearchTemplateFactory); } if (settings->GetDisplayOption(_("Functions"))) browser->AppendCollection(this, functionFactory); if (settings->GetDisplayOption(_("Operators"))) browser->AppendCollection(this, operatorFactory); if (settings->GetDisplayOption(_("Operator Classes"))) browser->AppendCollection(this, operatorClassFactory); if (settings->GetDisplayOption(_("Operator Families"))) { if (GetConnection()->BackendMinimumVersion(8, 3)) browser->AppendCollection(this, operatorFamilyFactory); } if (settings->GetDisplayOption(_("Packages")) && GetConnection()->EdbMinimumVersion(8, 1)) browser->AppendCollection(this, packageFactory); if (settings->GetDisplayOption(_("Procedures"))) { if (GetConnection()->EdbMinimumVersion(8, 0)) browser->AppendCollection(this, procedureFactory); } if (settings->GetDisplayOption(_("Sequences"))) browser->AppendCollection(this, sequenceFactory); if (settings->GetDisplayOption(_("Tables"))) browser->AppendCollection(this, tableFactory); if (settings->GetDisplayOption(_("External Tables"))) { if (GetConnection() != 0 && GetConnection()->GetIsGreenplum()) browser->AppendCollection(this, extTableFactory); } if (settings->GetDisplayOption(_("Trigger Functions"))) browser->AppendCollection(this, triggerFunctionFactory); if (settings->GetDisplayOption(_("Types"))) browser->AppendCollection(this, typeFactory); if (settings->GetDisplayOption(_("Views"))) browser->AppendCollection(this, viewFactory); if (settings->GetDisplayOption(_("Synonyms")) && GetConnection()->EdbMinimumVersion(8, 4)) browser->AppendCollection(this, edbPrivFactory); } else browser->AppendCollection(this, catalogObjectFactory); } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("ACL"), GetAcl()); properties->AppendItem(_("Default table ACL"), m_defPrivsOnTables); properties->AppendItem(_("Default sequence ACL"), m_defPrivsOnSeqs); properties->AppendItem(_("Default function ACL"), m_defPrivsOnFuncs); if (GetMetaType() != PGM_CATALOG) properties->AppendYesNoItem(_("System schema?"), GetSystemObject()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }
void pgForeignTable::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { wxString constraint; if (!expandedKids) { expandedKids = true; pgSet *set = ExecuteSet( wxT("SELECT attname, format_type(t.oid,NULL) AS typname, attndims, atttypmod, nspname, attnotnull,\n") wxT(" (SELECT COUNT(1) from pg_type t2 WHERE t2.typname=t.typname) > 1 AS isdup\n") wxT(" FROM pg_attribute att\n") wxT(" JOIN pg_type t ON t.oid=atttypid\n") wxT(" JOIN pg_namespace nsp ON t.typnamespace=nsp.oid\n") wxT(" LEFT OUTER JOIN pg_type b ON t.typelem=b.oid\n") wxT(" WHERE att.attrelid=") + GetOidStr() + wxT("\n") wxT(" AND attnum>0\n") wxT(" ORDER by attnum")); if (set) { int anzvar = 0; while (!set->Eof()) { pgDatatype dt(set->GetVal(wxT("nspname")), set->GetVal(wxT("typname")), set->GetBool(wxT("isdup")), set->GetLong(wxT("attndims")) > 0, set->GetLong(wxT("atttypmod"))); constraint = set->GetBool(wxT("attnotnull")) ? wxT("NOT NULL") : wxT(""); if (anzvar++) { typesList += wxT(", "); quotedTypesList += wxT(",\n "); } typesList += set->GetVal(wxT("attname")) + wxT(" ") + dt.GetSchemaPrefix(GetDatabase()) + dt.FullName() + wxT(" ") + constraint; quotedTypesList += qtIdent(set->GetVal(wxT("attname"))) + wxT(" ") + dt.GetQuotedSchemaPrefix(GetDatabase()) + dt.QuotedFullName() + wxT(" ") + constraint; typesArray.Add(set->GetVal(wxT("attname"))); typesArray.Add(dt.GetSchemaPrefix(GetDatabase()) + dt.FullName()); typesArray.Add(constraint); set->MoveNext(); } delete set; } } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("Server"), GetForeignServer()); properties->AppendItem(_("Columns"), GetQuotedTypesList()); properties->AppendItem(_("Options"), GetOptionsList()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }
void pgDatabase::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (Connect() == PGCONN_OK) { // Set the icon if required UpdateIcon(browser); // Add child nodes if necessary if (browser->GetChildrenCount(GetId(), false) == 0) { wxLogInfo(wxT("Adding child object to database %s"), GetIdentifier().c_str()); if (settings->GetDisplayOption(_("Catalogs"))) browser->AppendCollection(this, catalogFactory); if (settings->GetDisplayOption(_("Casts"))) browser->AppendCollection(this, castFactory); if (settings->GetDisplayOption(_("Extensions")) && GetConnection()->BackendMinimumVersion(9, 1)) browser->AppendCollection(this, extensionFactory); if (settings->GetDisplayOption(_("Foreign Data Wrappers")) && GetConnection()->BackendMinimumVersion(8, 4)) browser->AppendCollection(this, foreignDataWrapperFactory); if (settings->GetDisplayOption(_("Languages"))) browser->AppendCollection(this, languageFactory); if (settings->GetDisplayOption(_("Synonyms")) && connection()->EdbMinimumVersion(8, 0)) if (!GetConnection()->BackendMinimumVersion(8, 4)) browser->AppendCollection(this, synonymFactory); if (settings->GetDisplayOption(_("Schemas"))) browser->AppendCollection(this, schemaFactory); if (settings->GetDisplayOption(_("Slony-I Clusters"))) browser->AppendCollection(this, slClusterFactory); wxString missingFKsql = wxT("SELECT COUNT(*) FROM\n") wxT(" (SELECT tgargs from pg_trigger tr\n") wxT(" LEFT JOIN pg_depend dep ON dep.objid=tr.oid AND deptype = 'i'\n") wxT(" LEFT JOIN pg_constraint co ON refobjid = co.oid AND contype = 'f'\n") wxT(" WHERE \n"); if (connection()->BackendMinimumVersion(9, 0)) missingFKsql += wxT("tgisinternal\n"); else missingFKsql += wxT("tgisconstraint\n"); missingFKsql += wxT(" AND co.oid IS NULL\n") wxT(" GROUP BY tgargs\n") wxT(" HAVING count(1) = 3) AS foo"); missingFKs = StrToLong(connection()->ExecuteScalar(missingFKsql)); } } GetServer()->iSetLastDatabase(GetName()); if (properties) { // Setup listview CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), NumToStr(GetOid())); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("ACL"), GetAcl()); if (!GetPath().IsEmpty()) properties->AppendItem(_("Path"), GetPath()); // We may not actually be connected... if (GetConnection() && GetConnection()->BackendMinimumVersion(8, 0)) { properties->AppendItem(_("Tablespace"), GetTablespace()); properties->AppendItem(_("Default tablespace"), GetDefaultTablespace()); } properties->AppendItem(_("Encoding"), GetEncoding()); if (GetConnection() && GetConnection()->BackendMinimumVersion(8, 4)) { properties->AppendItem(_("Collation"), GetCollate()); properties->AppendItem(_("Character type"), GetCType()); } properties->AppendItem(_("Default schema"), defaultSchema); properties->AppendItem(_("Default table ACL"), m_defPrivsOnTables); properties->AppendItem(_("Default sequence ACL"), m_defPrivsOnSeqs); properties->AppendItem(_("Default function ACL"), m_defPrivsOnFuncs); size_t i; wxString username; wxString varname; wxString varvalue; for (i = 0 ; i < variables.GetCount() ; i++) { wxStringTokenizer tkz(variables.Item(i), wxT("=")); while (tkz.HasMoreTokens()) { username = tkz.GetNextToken(); varname = tkz.GetNextToken(); varvalue = tkz.GetNextToken(); } if (username.Length() == 0) { properties->AppendItem(varname, varvalue); } else { // should we add the parameters for the username? // I don't think so // but if we want this, how will we display that? } } properties->AppendYesNoItem(_("Allow connections?"), GetAllowConnections()); properties->AppendYesNoItem(_("Connected?"), GetConnected()); if (GetConnection() && GetConnection()->BackendMinimumVersion(8, 1)) { wxString strConnLimit; strConnLimit.Printf(wxT("%ld"), GetConnectionLimit()); properties->AppendItem(_("Connection limit"), strConnLimit); } properties->AppendYesNoItem(_("System database?"), GetSystemObject()); if (GetMissingFKs()) properties->AppendItem(_("Old style FKs"), GetMissingFKs()); if (!GetSchemaRestriction().IsEmpty()) properties->AppendItem(_("Schema restriction"), GetSchemaRestriction()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } if (form && GetCanHint() && !hintShown) { ShowHint(form, false); } }
/*------------------------------------------------------------------------*/ int sci_param3d(char * fname, void *pvApiCtx) { SciErr sciErr; int izcol = 0, isfac = 0; static double ebox_def[6] = { 0, 1, 0, 1, 0, 1}; double *ebox = ebox_def; static int iflag_def[3] = {1, 2, 4}; int iflag[3], *ifl = NULL, ix1 = 0, one = 1; double alpha_def = 35.0 , theta_def = 45.0; double *alpha = &alpha_def, *theta = &theta_def; int m1 = 0, n1 = 0, m2 = 0, n2 = 0, m3 = 0, n3 = 0; int m3n = 0, n3n = 0; /* F.Leray 19.03.04*/ static rhs_opts opts[] = { { -1, "alpha", -1, 0, 0, NULL}, { -1, "ebox", -1, 0, 0, NULL}, { -1, "flag", -1, 0, 0, NULL}, { -1, "leg", -1, 0, 0, NULL}, { -1, "theta", -1, 0, 0, NULL}, { -1, NULL, -1, 0, 0, NULL} }; char * labels = NULL; int* piAddr1 = NULL; int* piAddr2 = NULL; int* piAddr3 = NULL; double* l1 = NULL; double* l2 = NULL; double* l3 = NULL; if (nbInputArgument(pvApiCtx) <= 0) { sci_demo(fname, pvApiCtx); return 0; } CheckInputArgument(pvApiCtx, 3, 8); if (getOptionals(pvApiCtx, fname, opts) == 0) { ReturnArguments(pvApiCtx); return 0; } if (FirstOpt(pvApiCtx) < 4) { Scierror(999, _("%s: Misplaced optional argument: #%d must be at position %d.\n"), fname, 1, 4); return(0); } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 1. sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &m1, &n1, &l1); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 1); printError(&sciErr, 0); return 1; } if (m1 * n1 == 0) { AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0; } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &m2, &n2, &l2); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 2); printError(&sciErr, 0); return 1; } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 3. sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &m3, &n3, &l3); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 3); printError(&sciErr, 0); return 1; } //CheckSameDims if (m1 != m2 || n1 != n2) { Scierror(999, _("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"), fname, 1, m1, n1); return 1; } //CheckSameDims if (m2 != m3 || n2 != n3) { Scierror(999, _("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"), fname, 2, m2, n2); return 1; } GetOptionalDoubleArg(pvApiCtx, fname, 4, "theta", &theta, 1, opts); GetOptionalDoubleArg(pvApiCtx, fname, 5, "alpha", &alpha, 1, opts); GetLabels(pvApiCtx, fname, 6, opts, &labels); iflag_def[1] = 8; ifl = &(iflag_def[1]); GetOptionalIntArg(pvApiCtx, fname, 7, "flag", &ifl, 2, opts); iflag[0] = iflag_def[0]; iflag[1] = ifl[0]; iflag[2] = ifl[1]; GetOptionalDoubleArg(pvApiCtx, fname, 8, "ebox", &ebox, 6, opts); getOrCreateDefaultSubwin(); ix1 = m1 * n1; /* NG beg */ isfac = -1; izcol = 0; Objplot3d (fname, &isfac, &izcol, (l1), (l2), (l3), (double *) NULL, &ix1, &one, theta, alpha, labels, iflag, ebox, &m1, &n1, &m2, &n2, &m3, &n3, &m3n, &n3n); /*Adding F.Leray 12.03.04 */ /* NG end */ AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0; }
/*--------------------------------------------------------------------------*/ int sci_param3d1(char *fname, void *pvApiCtx) { SciErr sciErr; int izcol = 0, isfac = 0; double *zcol = NULL; static double ebox_def [6] = { 0, 1, 0, 1, 0, 1}; double *ebox = ebox_def; static int iflag_def[3] = {1, 2, 4}; int iflag[3] , *ifl = NULL; double alpha_def = 35.0 , theta_def = 45.0; double *alpha = &alpha_def, *theta = &theta_def; int m1 = 0, n1 = 0, m2 = 0, n2 = 0, m3 = 0, n3 = 0; int m3n = 0, n3n = 0, m3l = 0; static rhs_opts opts[] = { { -1, "alpha", -1, 0, 0, NULL}, { -1, "ebox", -1, 0, 0, NULL}, { -1, "flag", -1, 0, 0, NULL}, { -1, "leg", -1, 0, 0, NULL}, { -1, "theta", -1, 0, 0, NULL}, { -1, NULL, -1, 0, 0, NULL} }; char * labels = NULL; int* piAddr1 = NULL; int* piAddr2 = NULL; int* piAddr3 = NULL; int* piAddr31 = NULL; int* piAddr32 = NULL; double* l1 = NULL; double* l2 = NULL; double* l3 = NULL; double* l3n = NULL; if (nbInputArgument(pvApiCtx) <= 0) { sci_demo(fname, pvApiCtx); return 0; } CheckInputArgument(pvApiCtx, 3, 8); if (getOptionals(pvApiCtx, fname, opts) == 0) { ReturnArguments(pvApiCtx); return 0; } if (FirstOpt(pvApiCtx) < 4) { Scierror(999, _("%s: Misplaced optional argument: #%d must be at position %d.\n"), fname, 1, 4); return (0); } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 1. sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &m1, &n1, &l1); /* x */ if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 1); printError(&sciErr, 0); return 1; } if (m1 == 1 && n1 > 1) { m1 = n1; n1 = 1; } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &m2, &n2, &l2); /* y */ if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 2); printError(&sciErr, 0); return 1; } if (m2 == 1 && n2 > 1) { m2 = n2; n2 = 1; } if (m1 * n1 == 0) { AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0; } //CheckSameDims if (m1 != m2 || n1 != n2) { Scierror(999, _("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"), fname, 1, m1, n1); return 1; } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } switch (getInputArgumentType(pvApiCtx, 3)) { case 1 : izcol = 0; // Retrieve a matrix of double at position 3. // YOU MUST REMOVE YOUR VARIABLE DECLARATION "int l3". sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &m3, &n3, &l3); /* z */ if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 3); printError(&sciErr, 0); return 1; } break; case 15 : izcol = 1; /* z = list(z,colors) */ sciErr = getListItemNumber(pvApiCtx, piAddr3, &m3l); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 3); printError(&sciErr, 0); return 1; } if (m3l != 2) { Scierror(999, _("%s: Wrong size for input argument #%d: List of size %d expected.\n"), fname, 2, m3l, 2); return 0; } sciErr = getListItemAddress(pvApiCtx, piAddr3, 1, &piAddr31); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } sciErr = getMatrixOfDouble(pvApiCtx, piAddr31, &m3, &n3, &l3); /* z */ if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 3); printError(&sciErr, 0); return 1; } sciErr = getListItemAddress(pvApiCtx, piAddr3, 2, &piAddr32); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } sciErr = getMatrixOfDouble(pvApiCtx, piAddr32, &m3n, &n3n, &l3n); /* z */ if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument #%d: A real expected.\n"), fname, 3); printError(&sciErr, 0); return 1; } zcol = (l3n); if (m3n * n3n != n3) { Scierror(999, _("%s: Wrong size for input argument #%d: %d expected.\n"), fname, 3, n3); return 0; } break; default : OverLoad(3); return 0; } if (m3 == 1 && n3 > 1) { m3 = n3; n3 = 1; } //CheckSameDims if (m1 != m3 || n1 != n3) { Scierror(999, _("%s: Wrong size for input argument #%d: %d-by-%d matrix expected.\n"), fname, 1, m1, n1); return 1; } GetOptionalDoubleArg(pvApiCtx, fname, 4, "theta", &theta, 1, opts); GetOptionalDoubleArg(pvApiCtx, fname, 5, "alpha", &alpha, 1, opts); GetLabels(pvApiCtx, fname, 6, opts, &labels); iflag_def[1] = 8; ifl = &(iflag_def[1]); GetOptionalIntArg(pvApiCtx, fname, 7, "flag", &ifl, 2, opts); iflag[0] = iflag_def[0]; iflag[1] = ifl[0]; iflag[2] = ifl[1]; GetOptionalDoubleArg(pvApiCtx, fname, 8, "ebox", &ebox, 6, opts); if (m1 == 1 && n1 > 1) { m1 = n1; n1 = 1; } getOrCreateDefaultSubwin(); /* NG beg */ isfac = -1; Objplot3d (fname, &isfac, &izcol, (l1), (l2), (l3), zcol, &m1, &n1, theta, alpha, labels, iflag, ebox, &m1, &n1, &m2, &n2, &m3, &n3, &m3n, &n3n); /*Adding F.Leray 12.03.04*/ AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0; }
void pgView::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (!expandedKids) { expandedKids = true; browser->RemoveDummyChild(this); browser->AppendCollection(this, columnFactory); pgCollection *collection = browser->AppendCollection(this, ruleFactory); collection->iSetOid(GetOid()); collection->ShowTreeDetail(browser); treeObjectIterator colIt(browser, collection); pgRule *rule; while (!hasInsertRule && !hasUpdateRule && !hasDeleteRule && (rule = (pgRule *)colIt.GetNextObject()) != 0) { if (rule->GetEvent().Find(wxT("INSERT")) >= 0) hasInsertRule = true; if (rule->GetEvent().Find(wxT("UPDATE")) >= 0) hasUpdateRule = true; if (rule->GetEvent().Find(wxT("DELETE")) >= 0) hasDeleteRule = true; } if (GetConnection()->BackendMinimumVersion(9, 1)) browser->AppendCollection(this, triggerFactory); } if (properties) { CreateListColumns(properties); wxString def = GetDefinition().Left(250); def.Replace(wxT("\n"), wxT(" ")); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("ACL"), GetAcl()); properties->AppendItem(_("Definition"), def); properties->AppendYesNoItem(_("System view?"), GetSystemObject()); if (GetConnection()->BackendMinimumVersion(9, 2) && GetSecurityBarrier().Length() > 0) properties->AppendItem(_("Security barrier?"), GetSecurityBarrier()); if (GetConnection()->BackendMinimumVersion(9, 3)) properties->AppendYesNoItem(_("Materialized view?"), GetMaterializedView()); /* Custom AutoVacuum Settings */ if (GetConnection()->BackendMinimumVersion(9, 3) && GetMaterializedView()) { if (!GetFillFactor().IsEmpty()) properties->AppendItem(_("Fill factor"), GetFillFactor()); if (GetCustomAutoVacuumEnabled()) { if (GetAutoVacuumEnabled() != 2) { properties->AppendItem(_("Table auto-vacuum enabled?"), GetAutoVacuumEnabled() == 1 ? _("Yes") : _("No")); } if (!GetAutoVacuumVacuumThreshold().IsEmpty()) properties->AppendItem(_("Table auto-vacuum VACUUM base threshold"), GetAutoVacuumVacuumThreshold()); if (!GetAutoVacuumVacuumScaleFactor().IsEmpty()) properties->AppendItem(_("Table auto-vacuum VACUUM scale factor"), GetAutoVacuumVacuumScaleFactor()); if (!GetAutoVacuumAnalyzeThreshold().IsEmpty()) properties->AppendItem(_("Table auto-vacuum ANALYZE base threshold"), GetAutoVacuumAnalyzeThreshold()); if (!GetAutoVacuumAnalyzeScaleFactor().IsEmpty()) properties->AppendItem(_("Table auto-vacuum ANALYZE scale factor"), GetAutoVacuumAnalyzeScaleFactor()); if (!GetAutoVacuumVacuumCostDelay().IsEmpty()) properties->AppendItem(_("Table auto-vacuum VACUUM cost delay"), GetAutoVacuumVacuumCostDelay()); if (!GetAutoVacuumVacuumCostLimit().IsEmpty()) properties->AppendItem(_("Table auto-vacuum VACUUM cost limit"), GetAutoVacuumVacuumCostLimit()); if (!GetAutoVacuumFreezeMinAge().IsEmpty()) properties->AppendItem(_("Table auto-vacuum FREEZE minimum age"), GetAutoVacuumFreezeMinAge()); if (!GetAutoVacuumFreezeMaxAge().IsEmpty()) properties->AppendItem(_("Table auto-vacuum FREEZE maximum age"), GetAutoVacuumFreezeMaxAge()); if (!GetAutoVacuumFreezeTableAge().IsEmpty()) properties->AppendItem(_("Table auto-vacuum FREEZE table age"), GetAutoVacuumFreezeTableAge()); } if (GetHasToastTable() && GetToastCustomAutoVacuumEnabled()) { if (GetToastAutoVacuumEnabled() != 2) { properties->AppendItem(_("Toast auto-vacuum enabled?"), GetToastAutoVacuumEnabled() == 1 ? _("Yes") : _("No")); } if (!GetToastAutoVacuumVacuumThreshold().IsEmpty()) properties->AppendItem(_("Toast auto-vacuum VACUUM base threshold"), GetToastAutoVacuumVacuumThreshold()); if (!GetToastAutoVacuumVacuumScaleFactor().IsEmpty()) properties->AppendItem(_("Toast auto-vacuum VACUUM scale factor"), GetToastAutoVacuumVacuumScaleFactor()); if (!GetToastAutoVacuumVacuumCostDelay().IsEmpty()) properties->AppendItem(_("Toast auto-vacuum VACUUM cost delay"), GetToastAutoVacuumVacuumCostDelay()); if (!GetToastAutoVacuumVacuumCostLimit().IsEmpty()) properties->AppendItem(_("Toast auto-vacuum VACUUM cost limit"), GetToastAutoVacuumVacuumCostLimit()); if (!GetToastAutoVacuumFreezeMinAge().IsEmpty()) properties->AppendItem(_("Toast auto-vacuum FREEZE minimum age"), GetToastAutoVacuumFreezeMinAge()); if (!GetToastAutoVacuumFreezeMaxAge().IsEmpty()) properties->AppendItem(_("Toast auto-vacuum FREEZE maximum age"), GetToastAutoVacuumFreezeMaxAge()); if (!GetToastAutoVacuumFreezeTableAge().IsEmpty()) properties->AppendItem(_("Toast auto-vacuum FREEZE table age"), GetToastAutoVacuumFreezeTableAge()); } properties->AppendItem(_("Tablespace"), tablespace); if (GetIsPopulated().Cmp(wxT("t")) == 0) properties->AppendItem(_("With data?"), _("Yes")); else properties->AppendItem(_("With data?"), _("No")); } if (GetConnection()->BackendMinimumVersion(9, 4)) properties->AppendItem(_("Check Option"), GetCheckOption()); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); } }
/*--------------------------------------------------------------------------*/ int sci_plot3d(char * fname, unsigned long fname_len) { SciErr sciErr; static double ebox_def [6] = { 0, 1, 0, 1, 0, 1}; double *ebox = ebox_def; static int iflag_def[3] = {2, 2, 4}; int *iflag = iflag_def; double alpha_def = 35.0 , theta_def = 45.0; double *alpha = &alpha_def, *theta = &theta_def; int m1 = 0, n1 = 0, m2 = 0, n2 = 0, m3 = 0, n3 = 0; int m3n = 0, n3n = 0, m3l = 0; int izcol = 0, isfac = 0; double *zcol = NULL; static rhs_opts opts[] = { { -1, "alpha", -1, 0, 0, NULL}, { -1, "ebox", -1, 0, 0, NULL}, { -1, "flag", -1, 0, 0, NULL}, { -1, "leg", -1, 0, 0, NULL}, { -1, "theta", -1, 0, 0, NULL}, { -1, NULL, -1, 0, 0, NULL} }; char * legend = NULL; int* piAddr1 = NULL; int* piAddr2 = NULL; int* piAddr3 = NULL; int* piAddr31 = NULL; int* piAddr32 = NULL; double* l1 = NULL; double* l2 = NULL; double* l3 = NULL; double* l3n = NULL; /* ** This overload the function to call demo script ** the demo script is called %_<fname> */ if (nbInputArgument(pvApiCtx) <= 0) { sci_demo(fname, fname_len); return 0; } CheckInputArgument(pvApiCtx, 3, 8); if (getOptionals(pvApiCtx, fname, opts) == 0) { ReturnArguments(pvApiCtx); return 0; } if (FirstOpt() < 4) { Scierror(999, _("%s: Misplaced optional argument: #%d must be at position %d.\n"), fname, 1, 4); return -1; } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 1. sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &m1, &n1, &l1); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 1); printError(&sciErr, 0); return 1; } //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 2. sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &m2, &n2, &l2); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 2); printError(&sciErr, 0); return 1; } if (m1 * n1 == 0) { AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0; } if (nbInputArgument(pvApiCtx) >= 3) { /* third argument can be a matrix z or a list list(z,zcol) */ sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } switch (getInputArgumentType(pvApiCtx, 3)) { case sci_matrix : //get variable address sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } // Retrieve a matrix of double at position 3. sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &m3, &n3, &l3); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 3); printError(&sciErr, 0); return 1; } izcol = 0; break; case sci_list : izcol = 1; /* z = list(z,colors) */ sciErr = getListItemNumber(pvApiCtx, piAddr3, &m3l); if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 3); printError(&sciErr, 0); return 1; } if (m3l != 2) { Scierror(999, _("%s: Wrong size for input argument #%d: List of size %d expected.\n"), fname, 2, m3l, 2); return 1; } sciErr = getListItemAddress(pvApiCtx, piAddr3, 1, &piAddr31); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } sciErr = getMatrixOfDouble(pvApiCtx, piAddr31, &m3, &n3, &l3); /* z */ if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 3); printError(&sciErr, 0); return 1; } sciErr = getListItemAddress(pvApiCtx, piAddr3, 2, &piAddr32); if (sciErr.iErr) { printError(&sciErr, 0); return 1; } sciErr = getMatrixOfDouble(pvApiCtx, piAddr32, &m3n, &n3n, &l3n); /* z */ if (sciErr.iErr) { Scierror(202, _("%s: Wrong type for argument %d: A real expected.\n"), fname, 3); printError(&sciErr, 0); return 1; } zcol = (l3n); if (m3n * n3n != n3 && m3n * n3n != m3 * n3) { Scierror(999, _("%s: Wrong size for input argument #%d: %d or %d expected.\n"), fname, 3, n3, m3 * n3); return 1; } /* * Added by E Segre 4/5/2000. In the case where zcol is a * matrix of the same size as z, we set izcol to 2. This * value is later transmitted to the C2F(fac3dg) routine, * which has been modified to do the interpolated shading * (see the file SCI/modules/graphics/src/c/Plo3d.c */ if (m3n * n3n == m3 * n3) { izcol = 2 ; } break; default : OverLoad(3); return 0; } } iflag_def[1] = 8; GetOptionalDoubleArg(pvApiCtx, fname, 4, "theta", &theta, 1, opts); GetOptionalDoubleArg(pvApiCtx, fname, 5, "alpha", &alpha, 1, opts); GetLabels(pvApiCtx, fname, 6, opts, &legend); GetOptionalIntArg(pvApiCtx, fname, 7, "flag", &iflag, 3, opts); GetOptionalDoubleArg(pvApiCtx, fname, 8, "ebox", &ebox, 6, opts); if (m1 * n1 == m3 * n3 && m1 * n1 == m2 * n2 && m1 * n1 != 1) { if (! (m1 == m2 && m2 == m3 && n1 == n2 && n2 == n3)) { Scierror(999, _("%s: Wrong value for input arguments #%d, #%d and #%d: Incompatible length.\n"), fname, 1, 2, 3); return 1; } } else { if (m2 * n2 != n3) { Scierror(999, _("%s: Wrong value for input arguments #%d and #%d: Incompatible length.\n"), fname, 2, 3); return 1; } if (m1 * n1 != m3) { Scierror(999, _("%s: Wrong value for input arguments #%d and #%d: Incompatible length.\n"), fname, 1, 3); return 1; } if (m1 * n1 <= 1 || m2 * n2 <= 1) { Scierror(999, _("%s: Wrong size for input arguments #%d and #%d: %s expected.\n"), fname, 2, 3, ">= 2"); return 1; } } if (m1 * n1 == 0 || m2 * n2 == 0 || m3 * n3 == 0) { AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0; } getOrCreateDefaultSubwin(); /******************** 24/05/2002 ********************/ if (m1 * n1 == m3 * n3 && m1 * n1 == m2 * n2 && m1 * n1 != 1) /* NG beg */ { isfac = 1; } else { isfac = 0; } Objplot3d (fname, &isfac, &izcol, (l1), (l2), (l3), zcol, &m3, &n3, theta, alpha, legend, iflag, ebox, &m1, &n1, &m2, &n2, &m3, &n3, &m3n, &n3n); /*Adding F.Leray 12.03.04 and 19.03.04*/ AssignOutputVariable(pvApiCtx, 1) = 0; ReturnArguments(pvApiCtx); return 0; }
void pgType::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { wxString query; wxString collation; if (!expandedKids) { expandedKids = true; if (GetTypeClass() == TYPE_COMPOSITE) { query = wxT("SELECT attname, format_type(t.oid,NULL) AS typname, attndims, atttypmod, nsp.nspname,\n") wxT(" (SELECT COUNT(1) from pg_type t2 WHERE t2.typname=t.typname) > 1 AS isdup"); if (GetConnection()->BackendMinimumVersion(9, 1)) query += wxT(",\n collname, nspc.nspname as collnspname"); query += wxT("\n FROM pg_attribute att\n") wxT(" JOIN pg_type t ON t.oid=atttypid\n") wxT(" JOIN pg_namespace nsp ON t.typnamespace=nsp.oid\n") wxT(" LEFT OUTER JOIN pg_type b ON t.typelem=b.oid\n"); if (GetConnection()->BackendMinimumVersion(9, 1)) query += wxT(" LEFT OUTER JOIN pg_collation c ON att.attcollation=c.oid\n") wxT(" LEFT OUTER JOIN pg_namespace nspc ON c.collnamespace=nspc.oid\n"); query += wxT(" WHERE att.attrelid=") + NumToStr(relOid) + wxT("\n") wxT(" ORDER by attnum"); pgSet *set = ExecuteSet(query); if (set) { int anzvar = 0; while (!set->Eof()) { wxString element; if (anzvar++) { typesList += wxT(", "); quotedTypesList += wxT(",\n "); } typesList += set->GetVal(wxT("attname")) + wxT(" "); typesArray.Add(set->GetVal(wxT("attname"))); quotedTypesList += qtIdent(set->GetVal(wxT("attname"))) + wxT(" "); pgDatatype dt(set->GetVal(wxT("nspname")), set->GetVal(wxT("typname")), set->GetBool(wxT("isdup")), set->GetLong(wxT("attndims")) > 0, set->GetLong(wxT("atttypmod"))); wxString nspname = set->GetVal(wxT("nspname")); typesList += dt.GetSchemaPrefix(GetDatabase()) + dt.FullName(); typesArray.Add(dt.GetSchemaPrefix(GetDatabase()) + dt.FullName()); quotedTypesList += dt.GetQuotedSchemaPrefix(GetDatabase()) + dt.QuotedFullName(); if (GetConnection()->BackendMinimumVersion(9, 1)) { if (set->GetVal(wxT("collname")).IsEmpty() || (set->GetVal(wxT("collname")) == wxT("default") && set->GetVal(wxT("collnspname")) == wxT("pg_catalog"))) collation = wxEmptyString; else { collation = qtIdent(set->GetVal(wxT("collnspname"))) + wxT(".") + qtIdent(set->GetVal(wxT("collname"))); quotedTypesList += wxT(" COLLATE ") + collation; } collationsArray.Add(collation); } typesArray.Add(collation); set->MoveNext(); } delete set; } } else if (GetTypeClass() == TYPE_ENUM) { query = wxT("SELECT enumlabel\n") wxT(" FROM pg_enum\n") wxT(" WHERE enumtypid=") + GetOidStr() + wxT("\n"); if (GetConnection()->BackendMinimumVersion(9, 1)) query += wxT(" ORDER by enumsortorder"); else query += wxT(" ORDER by oid"); pgSet *set = ExecuteSet(query); if (set) { int anzvar = 0; while (!set->Eof()) { wxString element; if (anzvar++) { labelList += wxT(", "); quotedLabelList += wxT(",\n "); } labelList += set->GetVal(wxT("enumlabel")); labelArray.Add(set->GetVal(wxT("enumlabel"))); quotedLabelList += GetDatabase()->connection()->qtDbString(set->GetVal(wxT("enumlabel"))); set->MoveNext(); } delete set; } } } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("Alias"), GetAlias()); if (GetTypeClass() == TYPE_COMPOSITE) { properties->AppendItem(_("Members"), GetTypesList()); } if (GetTypeClass() == TYPE_ENUM) { properties->AppendItem(_("Labels"), GetLabelList()); } else { properties->AppendItem(_("Alignment"), GetAlignment()); properties->AppendItem(_("Internal length"), GetInternalLength()); properties->AppendItem(_("Default"), GetDefault()); properties->AppendItem(_("Passed by Value?"), BoolToYesNo(GetPassedByValue())); if (!GetElement().IsEmpty()) { properties->AppendItem(_("Element"), GetElement()); properties->AppendItem(_("Delimiter"), GetDelimiter()); } properties->AppendItem(_("Input function"), GetInputFunction()); properties->AppendItem(_("Output function"), GetOutputFunction()); if (GetConnection()->BackendMinimumVersion(7, 4)) { properties->AppendItem(_("Receive function"), GetReceiveFunction()); properties->AppendItem(_("Send function"), GetSendFunction()); } if (GetConnection()->BackendMinimumVersion(8, 3)) { if (GetTypmodinFunction().Length() > 0) properties->AppendItem(_("Typmod in function"), GetTypmodinFunction()); if (GetTypmodoutFunction().Length() > 0) properties->AppendItem(_("Typmod out function"), GetTypmodoutFunction()); } properties->AppendItem(_("Storage"), GetStorage()); if (GetConnection()->BackendMinimumVersion(9, 1)) properties->AppendItem(_("Collatable?"), BoolToYesNo(GetCollatable())); } properties->AppendYesNoItem(_("System type?"), GetSystemObject()); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }
void pgRole::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (!expandedKids) { expandedKids = true; wxString rolesquery; if (GetConnection()->BackendMinimumVersion(8, 2)) rolesquery = wxT("SELECT rolname, admin_option,\n") wxT(" pg_catalog.shobj_description(r.oid, 'pg_authid') AS description\n"); else rolesquery = wxT("SELECT rolname, admin_option\n"); rolesquery += wxT(" FROM pg_roles r\n") wxT(" JOIN pg_auth_members ON r.oid=roleid\n") wxT(" WHERE member=") + GetOidStr() + wxT("\n") wxT(" ORDER BY rolname"); pgSetIterator roles(GetConnection(), rolesquery); while (roles.RowsLeft()) { wxString role = roles.GetVal(wxT("rolname")); if (roles.GetBool(wxT("admin_option"))) role += PGROLE_ADMINOPTION; rolesIn.Add(role); } // Get configuration wxString query; if (GetConnection()->BackendMinimumVersion(9, 0)) { query = wxT("WITH configs AS ") wxT("(SELECT datname, unnest(setconfig) AS config") wxT(" FROM pg_db_role_setting s") wxT(" LEFT JOIN pg_database d ON d.oid=s.setdatabase") wxT(" WHERE s.setrole=") + NumToStr(GetOid()) + wxT(")\n") wxT("SELECT datname, split_part(config, '=', 1) AS variable, replace(config, split_part(config, '=', 1) || '=', '') AS value\n") wxT("FROM configs"); } else { wxString query_myrole = wxT("SELECT rolconfig FROM pg_roles WHERE oid=") + NumToStr(GetOid()); query = wxT("SELECT '' AS datname, split_part(config, '=', 1) AS variable,\n") wxT(" replace(config,split_part(config, '=', 1) || '=', '') AS value\n") wxT("FROM (\n") wxT(" SELECT\n") wxT(" (\n") wxT(" SELECT rolconfig[i]\n") wxT(" FROM pg_roles\n") wxT(" WHERE oid=") + NumToStr(GetOid()) + wxT("\n") wxT(" ) AS config\n") wxT(" FROM generate_series(array_lower((") + query_myrole + wxT("),1), array_upper((") + query_myrole + wxT("),1)) AS i\n") wxT(" ) configs"); } pgSet *configs = GetConnection()->ExecuteSet(query); if (configs) { while (!configs->Eof()) { variables.Add(configs->GetVal(wxT("datname"))); variables.Add(configs->GetVal(wxT("variable"))); variables.Add(configs->GetVal(wxT("value"))); configs->MoveNext(); } delete configs; } } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Account expires"), DateToAnsiStr(GetAccountExpires())); properties->AppendItem(_("Can login?"), BoolToYesNo(GetCanLogin())); properties->AppendItem(_("Superuser?"), BoolToYesNo(GetSuperuser())); properties->AppendItem(_("Create databases?"), BoolToYesNo(GetCreateDatabase())); properties->AppendItem(_("Create roles?"), BoolToYesNo(GetCreateRole())); if (!server->GetConnection()->BackendMinimumVersion(9, 5)) properties->AppendItem(_("Update catalogs?"), BoolToYesNo(GetUpdateCatalog())); properties->AppendItem(_("Inherits?"), BoolToYesNo(GetInherits())); if (server->GetConnection()->BackendMinimumVersion(9, 1)) { properties->AppendItem(_("Replication?"), BoolToYesNo(GetReplication())); } wxString strConnLimit; strConnLimit.Printf(wxT("%ld"), GetConnectionLimit()); properties->AppendItem(_("Connection Limit"), strConnLimit); properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); wxString roleList; size_t index; for (index = 0 ; index < rolesIn.GetCount() ; index++) { if (!roleList.IsEmpty()) roleList += wxT(", "); roleList += rolesIn.Item(index); } properties->AppendItem(_("Member of"), roleList); wxString dbname; wxString parameter; wxString value; for (index = 0; index < variables.GetCount() ; index += 3) { dbname = variables.Item(index); parameter = variables.Item(index + 1); value = variables.Item(index + 2); if (dbname.Length() == 0) { properties->AppendItem(parameter, value); } else { properties->AppendItem(parameter + wxT(" (database ") + dbname + wxT(")"), value); } } if (!GetLabels().IsEmpty()) { wxArrayString seclabels = GetProviderLabelArray(); if (seclabels.GetCount() > 0) { for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2) { properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1)); } } } } }