Example #1
0
wxString pgOperator::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Operator: ") + GetQuotedFullIdentifier() + wxT("(") + GetOperands() + wxT(")\n\n")
		      + wxT("-- DROP OPERATOR ") + GetQuotedFullIdentifier()
		      + wxT("(") + GetOperands() + wxT(");\n\n")
		      wxT("CREATE OPERATOR ") + GetQuotedFullIdentifier()
		      + wxT("(\n  PROCEDURE = ") + GetOperatorFunction();
		AppendIfFilled(sql, wxT(",\n  LEFTARG = "), qtTypeIdent(GetLeftType()));
		AppendIfFilled(sql, wxT(",\n  RIGHTARG = "), qtTypeIdent(GetRightType()));
		AppendIfFilled(sql, wxT(",\n  COMMUTATOR = "), GetCommutator());
		AppendIfFilled(sql, wxT(",\n  RESTRICT = "), GetRestrictFunction());
		AppendIfFilled(sql, wxT(",\n  JOIN = "), GetJoinFunction());
		if (GetHashJoins()) sql += wxT(",\n  HASHES");
		if (GetMergeJoins()) sql += wxT(",\n  MERGES");

		if (!GetDatabase()->BackendMinimumVersion(8, 3))
		{
			AppendIfFilled(sql, wxT(",\n  SORT1 = "), GetLeftSortOperator());
			AppendIfFilled(sql, wxT(",\n  SORT2 = "), GetRightSortOperator());
			AppendIfFilled(sql, wxT(",\n  LTCMP = "), GetLessOperator());
			AppendIfFilled(sql, wxT(",\n  GTCMP = "), GetGreaterOperator());
		}

		sql += wxT(");\n");

		if (!GetComment().IsNull())
			sql += wxT("COMMENT ON OPERATOR ") + GetQuotedFullIdentifier()
			       + wxT("(") + GetOperands() + wxT(") IS ")
			       + qtDbString(GetComment()) + wxT(";\n");
	}

	return sql;
}
Example #2
0
bool loadXMLFile (TiXmlDocument &pXMLDoc, std::string XMLFilename, std::map<int,
                  std::string> * pMapXmlStrings, bool isSourceFile)
{
  if (!pXMLDoc.LoadFile(XMLFilename.c_str()))
  {
    printf ("%s %s\n", pXMLDoc.ErrorDesc(), XMLFilename.c_str());
    return false;
  }
  if (isSourceFile) GetEncoding(&pXMLDoc, sourceXMLEncoding);
    else GetEncoding(&pXMLDoc, foreignXMLEncoding);

  TiXmlElement* pRootElement = pXMLDoc.RootElement();
  if (!pRootElement || pRootElement->NoChildren() || pRootElement->ValueTStr()!="strings")
  {
    printf ("error: No root element called: \"strings\" or no child found in input XML file: %s\n",
            XMLFilename.c_str());
    return false;
  }

  if (isSourceFile) GetComment(pRootElement->FirstChild(), -1);

  const TiXmlElement *pChildElement = pRootElement->FirstChildElement("string");
  const char* pAttrId = NULL;
  const char* pValue = NULL;
  std::string valueString;
  int id;

  while (pChildElement)
  {
    pAttrId=pChildElement->Attribute("id");
    if (pAttrId && !pChildElement->NoChildren())
    {
      id = atoi(pAttrId);
      if (pMapXmlStrings->find(id) == pMapXmlStrings->end())
      {
        pValue = pChildElement->FirstChild()->Value();
        valueString = EscapeLF(pValue);
        if (isSourceFile)
          multimapSourceXmlStrings.insert(std::pair<std::string,int>( valueString,id));

        (*pMapXmlStrings)[id] = valueString;

        if (pChildElement && isSourceFile) GetComment(pChildElement->NextSibling(), id);
      }
    }
    pChildElement = pChildElement->NextSiblingElement("string");
  }
  // Free up the allocated memory for the XML file
  pXMLDoc.Clear();
  return true;
}
Example #3
0
	QStandardItem* QuarkManager::MakeItem (const QString& id) const
	{
		auto item = Finder_->FindItem (id);
		if (!item)
		{
			qWarning () << Q_FUNC_INFO
					<< "item not found"
					<< id;
			return 0;
		}

		ImageProv_->AddItem (item);

		auto modelItem = new QStandardItem;
		modelItem->setData (item->GetPermanentID (), LaunchModel::Roles::PermanentID);

		const auto& curLang = Util::GetLanguage ().toLower ();

		auto descr = item->GetComment (curLang);
		if (descr.isEmpty ())
			descr = item->GetGenericName (curLang);

		auto name = item->GetName (curLang);
		if (!descr.isEmpty ())
			name += " (" + descr + ")";
		modelItem->setData (name, LaunchModel::Roles::AppName);

		return modelItem;
	}
Example #4
0
void ForwardLabel (unsigned Offs)
/* If necessary, output a forward label, one that is within the next few
 * bytes and is therefore output as "label = * + x".
 */
{
    /* Calculate the actual address */
    unsigned long Addr = PC + Offs;

    /* Get the type of the label */
    attr_t A = GetLabelAttr (Addr);

    /* If there is no label, or just a dependent one, bail out */
    if (A == atNoLabel || (A & atDepLabel) != 0) {
        return;
    }

    /* An unnamed label cannot be output as a forward declaration, so this is
     * an error.
     */
    if (A == atUnnamedLabel) {
        Error ("Cannot define unnamed label at address $%04lX", Addr);
    }

    /* Output the label */
    DefForward (GetLabelName (Addr), GetComment (Addr), Offs);
}
Example #5
0
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));
				}
			}
		}
	}
}
Example #6
0
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));
				}
			}
		}
	}
}
Example #7
0
void pgOperator::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(_("Kind"), GetKind());
		if (!leftType.IsNull())
			properties->AppendItem(_("Left type"), GetLeftType());
		if (!rightType.IsNull())
			properties->AppendItem(_("Right type"), GetRightType());
		properties->AppendItem(_("Result type"), GetResultType());
		properties->AppendItem(_("Operator function"), GetOperatorFunction());
		properties->AppendItem(_("Commutator"), GetCommutator());
		properties->AppendItem(_("Negator"), GetNegator());
		properties->AppendItem(_("Join function"), GetJoinFunction());
		properties->AppendItem(_("Restrict function"), GetRestrictFunction());

		if (!GetDatabase()->BackendMinimumVersion(8, 3))
		{
			properties->AppendItem(_("Left Sort operator"), GetLeftSortOperator());
			properties->AppendItem(_("Right Sort operator"), GetRightSortOperator());
			properties->AppendItem(_("Less Than operator"), GetLessOperator());
			properties->AppendItem(_("Greater than operator"), GetGreaterOperator());
		}

		properties->AppendYesNoItem(_("Supports hash?"), GetHashJoins());
		properties->AppendYesNoItem(_("Supports merge?"), GetMergeJoins());
		properties->AppendYesNoItem(_("System operator?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
Example #8
0
void xlw::XlfFuncDesc::DoMamlDocs(std::ostream& ostr) const
{
    ostr << "<introduction>" << std::endl;
    XlfArgDescList& arguments = impl_->arguments_;
    ostr << "<para>" << GetComment() << "</para>" << std::endl;

    std::string argnames;

    XlfArgDescList::const_iterator it = arguments.begin();
    while (it != arguments.end())
    {
        argnames += (*it).GetName();
        ++it;
        if (it != arguments.end())
            argnames+=", ";
    }

    ostr << "<code>=" << GetAlias() << "(" << argnames << ")</code>" << std::endl;
    ostr << "</introduction>" << std::endl;

    ostr << "<section>" << std::endl;
    ostr << "  <title>Parameters</title>" << std::endl;
    ostr << "  <content>" << std::endl;


    for (it = arguments.begin(); it != arguments.end(); ++it)
    {
        ostr << "    <para>";
        ostr << (*it).GetName() << ": " << (*it).GetComment();
        ostr << "</para>" << std::endl;
    }
    ostr << "  </content>" << std::endl;
    ostr << "</section>" << std::endl;
}
Example #9
0
int XlfCmdDesc::AddToMenuBar(const std::string& menu, const std::string& text)
{
	XLOPER xMenu;
	LPXLOPER pxMenu;
	LPXLOPER px;

	menu_ = menu;
	text_ = text;

	// This is a small trick to allocate an array 5 XlfOper
	// One must first allocate the array with XLOPER
//	px = pxMenu = (LPXLOPER)new XLOPER[5];
	px = pxMenu = new XLOPER[5];
	// and then assign the XLOPER to XlfOper specifying false
	// to tell the Framework that the data is not owned by
	// Excel and that it should not call xlFree when destroyed
	XlfOper(px++).Set(text_.c_str());
	XlfOper(px++).Set(GetAlias().c_str());
	XlfOper(px++).Set("");
	XlfOper(px++).Set(GetComment().c_str());
	XlfOper(px++).Set("");

	xMenu.xltype = xltypeMulti;
	xMenu.val.array.lparray = pxMenu;
	xMenu.val.array.rows = 1;
	xMenu.val.array.columns = 5;

	int err = XlfExcel::Instance().Call(xlfAddCommand, 0, 3, (LPXLOPER)XlfOper(1.0), (LPXLOPER)XlfOper(menu_.c_str()), (LPXLOPER)&xMenu);
	if (err != xlretSuccess)
    std::cerr << XLW__HERE__ << "Add command " << GetName().c_str() << " to " << menu_.c_str() << " failed" << std::endl;
	delete[] pxMenu;
	return err;
}
Example #10
0
BOOL CWedDoc::OnOpenDocument(LPCTSTR lpszPathName)

{
	BOOL retval = FALSE;

	if(GetNumOfDocs() > MAX_DOC_LIMIT)
		{
		AfxMessageBox("Too many open documents");
		return FALSE;
		}

	// For originial document properties
	_stat(lpszPathName, &docstat);  docstat2 = docstat;

	// Load as usual
	retval = CDocument::OnOpenDocument(lpszPathName);

  	//P2N("Opened document %s\r\n", lpszPathName);

	// Get the undo/redo
	LoadUndo(lpszPathName); LoadRedo(lpszPathName);

	// Used by IsDocModified()
	undoorig = undo.GetCount();
	//P2N("Undo orig = %d\r\n", undoorig);

	SaveBackup(lpszPathName);

	// Assign comment file
	GetComment(lpszPathName);

  	return(retval);
}
Example #11
0
void pgaStep::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids)
	{
		expandedKids = true;
	}

	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("ID"), GetRecId());
		properties->AppendYesNoItem(_("Enabled"), GetEnabled());
		properties->AppendItem(_("Kind"), GetKind());
		if (GetConnStr().IsEmpty())
			properties->AppendItem(_("Database"), GetDbname());
		else
			properties->AppendItem(_("Connection String"), GetConnStr());
		properties->AppendItem(_("Code"), GetCode());
		properties->AppendItem(_("On error"), GetOnError());

		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
Example #12
0
void pgaSchedule::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
    if (!expandedKids)
    {
        expandedKids = true;
    }

    if (properties)
    {
        CreateListColumns(properties);

        properties->AppendItem(_("Name"), GetName());
        properties->AppendItem(_("ID"), GetRecId());
        properties->AppendYesNoItem(_("Enabled"), GetEnabled());

        properties->AppendItem(_("Start date"), GetStart());
        properties->AppendItem(_("End date"), GetEnd());
        properties->AppendItem(_("Minutes"), GetMinutesString());
        properties->AppendItem(_("Hours"), GetHoursString());
        properties->AppendItem(_("Weekdays"), GetWeekdaysString());
        properties->AppendItem(_("Monthdays"), GetMonthdaysString());
        properties->AppendItem(_("Months"), GetMonthsString());
        properties->AppendItem(_("Exceptions"), GetExceptionsString());

        properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
    }
}
Example #13
0
void pgRule::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (properties)
	{
		CreateListColumns(properties);
		wxString def = GetFormattedDefinition();
		if (!def.IsEmpty())
		{
			int doPos = def.Find(wxT(" DO INSTEAD "));
			if (doPos > 0)
				def = def.Mid(doPos + 12).Strip(wxString::both);
			else
			{
				doPos = def.Find(wxT(" DO "));
				if (doPos > 0)
					def = def.Mid(doPos + 4).Strip(wxString::both);
			}
		}

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		properties->AppendItem(_("Event"), GetEvent());
		properties->AppendItem(_("Condition"), GetCondition());
		properties->AppendYesNoItem(_("Do instead?"), GetDoInstead());
		properties->AppendItem(_("Definition"), firstLineOnly(def));
		if (this->GetDatabase()->connection()->BackendMinimumVersion(8, 3))
			properties->AppendYesNoItem(_("Enabled?"), GetEnabled());
		properties->AppendYesNoItem(_("System rule?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
Example #14
0
void edbPackage::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
    if (!expandedKids)
    {
        expandedKids=true;

        browser->RemoveDummyChild(this);

        // Log
        wxLogInfo(wxT("Adding child object to package %s"), GetIdentifier().c_str());

        browser->AppendCollection(this, packageFunctionFactory);
        browser->AppendCollection(this, packageProcedureFactory);
        browser->AppendCollection(this, packageVariableFactory);
    }


    if (properties)
    {
        CreateListColumns(properties);

        properties->AppendItem(_("Name"), GetName());
        properties->AppendItem(_("OID"), GetOid());
        properties->AppendItem(_("Owner"), GetOwner());
        properties->AppendItem(_("Header"), firstLineOnly(GetHeader()));
        properties->AppendItem(_("Body"), firstLineOnly(GetBody()));
        properties->AppendItem(_("ACL"), GetAcl());
        properties->AppendItem(_("System package?"), GetSystemObject());
		if (GetConnection()->EdbMinimumVersion(8, 2))
            properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
    }
}
Example #15
0
wxString pgForeignKey::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Foreign Key: ") + GetQuotedFullIdentifier() + wxT("\n\n")
		      + wxT("-- ALTER TABLE ") + GetQuotedSchemaPrefix(fkSchema) + qtIdent(fkTable)
		      + wxT(" DROP CONSTRAINT ") + GetQuotedIdentifier() + wxT(";")
		      + wxT("\n\nALTER TABLE ") + GetQuotedSchemaPrefix(fkSchema) + qtIdent(fkTable)
		      + wxT("\n  ADD CONSTRAINT ") + GetConstraint()
		      + wxT(";\n");
		if (!GetComment().IsEmpty())
			sql += wxT("COMMENT ON CONSTRAINT ") + GetQuotedIdentifier() + wxT(" ON ") + GetQuotedSchemaPrefix(fkSchema) + qtIdent(fkTable)
			       +  wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n");
	}

	return sql;
}
Example #16
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());
		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));
				}
			}
		}
	}
}
Example #17
0
void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
    throw( IO_ERROR )
{
    // Don't write the title block information if there is nothing to write.
    bool isempty = true;
    for( unsigned idx = 0; idx < m_tbTexts.GetCount(); idx++ )
    {
        if( ! m_tbTexts[idx].IsEmpty() )
        {
            isempty = false;
            break;
        }
    }

    if( !isempty  )
    {
        aFormatter->Print( aNestLevel, "(title_block\n" );

        if( !GetTitle().IsEmpty() )
            aFormatter->Print( aNestLevel+1, "(title %s)\n",
                               aFormatter->Quotew( GetTitle() ).c_str() );

        if( !GetDate().IsEmpty() )
            aFormatter->Print( aNestLevel+1, "(date %s)\n",
                               aFormatter->Quotew( GetDate() ).c_str() );

        if( !GetRevision().IsEmpty() )
            aFormatter->Print( aNestLevel+1, "(rev %s)\n",
                               aFormatter->Quotew( GetRevision() ).c_str() );

        if( !GetCompany().IsEmpty() )
            aFormatter->Print( aNestLevel+1, "(company %s)\n",
                               aFormatter->Quotew( GetCompany() ).c_str() );

        for( int ii = 0; ii < 4; ii++ )
        {
            if( !GetComment(ii).IsEmpty() )
                aFormatter->Print( aNestLevel+1, "(comment %d %s)\n", ii+1,
                                  aFormatter->Quotew( GetComment(ii) ).c_str() );
        }

        aFormatter->Print( aNestLevel, ")\n\n" );
    }
}
Example #18
0
wxString pgCheck::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Check: ") + GetQuotedFullIdentifier() + wxT("\n\n")
		      + wxT("-- ALTER ") + objectKind + wxT(" ") + GetQuotedSchemaPrefix(objectSchema) + qtIdent(objectName)
		      + wxT(" DROP CONSTRAINT ") + GetQuotedIdentifier()
		      + wxT(";\n\nALTER ") + objectKind + wxT(" ") + GetQuotedSchemaPrefix(objectSchema) + qtIdent(objectName)
		      + wxT("\n  ADD CONSTRAINT ") + GetConstraint()
		      + wxT(";\n");

		if (!GetComment().IsNull())
		{
			sql += wxT("COMMENT ON CONSTRAINT ") + GetQuotedIdentifier()
			       + wxT(" ON ") + GetQuotedSchemaPrefix(objectSchema) + qtIdent(objectName)
			       + wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n");
		}
	}

	return sql;
}
Example #19
0
wxString pgTextSearchDictionary::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Text Search Dictionary: ") + GetFullIdentifier() + wxT("\n\n")
		      + wxT("-- DROP TEXT SEARCH DICTIONARY ") + GetFullIdentifier() + wxT("\n\n")
		      + wxT("CREATE TEXT SEARCH DICTIONARY ") + GetFullIdentifier() + wxT(" (")
		      + wxT("\n   TEMPLATE = ") + qtTypeIdent(GetTemplate());

		if (options.Length() > 0)
			sql += wxT(",\n   ") + options;

		sql += wxT("\n);\n");

		if (!GetComment().IsNull())
			sql += wxT("COMMENT ON TEXT SEARCH DICTIONARY ") + GetFullIdentifier()
			       + wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n");
	}

	return sql;
}
Example #20
0
wxString pgRule::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Rule: ") + GetQuotedIdentifier() + wxT(" ON ") + GetQuotedFullTable() + wxT("\n\n")
		      + wxT("-- DROP RULE ") + GetQuotedIdentifier() + wxT(" ON ") + GetQuotedFullTable() + wxT(";\n\n")
		      + wxT("CREATE OR REPLACE") + GetFormattedDefinition().Mid(6) // the backend pg_get_ruledef gives CREATE only
		      + wxT("\n");

		if (!GetEnabled())
		{
			sql += wxT("ALTER TABLE ") + GetQuotedFullTable() + wxT(" ")
			       +  wxT("DISABLE RULE ") + GetQuotedIdentifier() + wxT(";\n");
		}

		if (!GetComment().IsEmpty())
			sql += wxT("COMMENT ON RULE ") + GetQuotedIdentifier() + wxT(" ON ") + GetQuotedFullTable()
			       +  wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n");
	}
	return sql;
}
Example #21
0
wxString slSequence::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Register sequence ") + GetName() + wxT(" for replication.\n\n")
		      wxT("SELECT ") + GetCluster()->GetSchemaPrefix() + wxT("setaddsequence(")
		      + NumToStr(GetSet()->GetSlId()) + wxT(", ")
		      + NumToStr(GetSlId()) + wxT(", ")
		      + qtDbString(GetName()) + wxT(", ")
		      + qtDbString(GetComment()) + wxT(");\n");
	}
	return sql;
}
Example #22
0
wxString pgProcedure::GetSql(ctlTree *browser)
{
	if (!GetConnection()->EdbMinimumVersion(8, 0))
		return pgFunction::GetSql(browser);

	if (sql.IsNull())
	{
		wxString qtName, qtSig;

		if (GetArgListWithNames().IsEmpty())
		{
			qtName = GetQuotedFullIdentifier();
			qtSig = GetQuotedFullIdentifier();
		}
		else
		{
			qtName = GetQuotedFullIdentifier() + wxT("(") + GetArgListWithNames() + wxT(")");
			qtSig = GetQuotedFullIdentifier()  + wxT("(") + GetArgSigList() + wxT(")");
		}

		sql = wxT("-- Procedure: ") + qtSig + wxT("\n\n")
		      + wxT("-- DROP PROCEDURE ") + qtSig + wxT(";")
		      + wxT("\n\nCREATE OR REPLACE PROCEDURE ") + qtName;


		sql += wxT(" AS")
		       + GetSource()
		       + wxT("\n\n")
		       + GetGrant(wxT("X"), wxT("PROCEDURE ") + qtSig);

		if (!GetComment().IsNull())
		{
			sql += wxT("COMMENT ON PROCEDURE ") + GetQuotedFullIdentifier()
			       + wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n");
		}
	}

	return sql;
}
void pgTextSearchConfiguration::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(_("Parser"), GetParser());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
Example #24
0
wxString pgTextSearchParser::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Text Search Parser: ") + GetFullIdentifier() + wxT("\n\n")
		      + wxT("-- DROP TEXT SEARCH PARSER ") + GetFullIdentifier() + wxT("\n\n")
		      + wxT("CREATE TEXT SEARCH PARSER ") + GetFullIdentifier() + wxT(" (")
		      + wxT("\n  START = ") + qtTypeIdent(GetStart())
		      + wxT(",\n  GETTOKEN = ") + qtTypeIdent(GetGettoken())
		      + wxT(",\n  END = ") + qtTypeIdent(GetEnd())
		      + wxT(",\n  LEXTYPES = ") + qtTypeIdent(GetLextypes());

		AppendIfFilled(sql, wxT(",\n  HEADLINE = "), GetHeadline());

		sql += wxT("\n);\n");

		if (!GetComment().IsNull())
			sql += wxT("COMMENT ON TEXT SEARCH PARSER ") + GetFullIdentifier()
			       + wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n");
	}

	return sql;
}
Example #25
0
void pgOperatorFamily::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(_("Access method"), GetAccessMethod());
        properties->AppendItem(_("System operator family?"), GetSystemObject());
        properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
    }
}
Example #26
0
ATOME GetLeftLex(int skipEOL) {
  int identKeyword = 0;

  curChar=fgetc(inputStream) ;
  while (isspace(curChar) || GetComment()) {
    if (curChar == '\n') {
      lineNo++ ;
      if (!skipEOL)
	return LINEN ;
    }
    curChar=fgetc(inputStream) ;
  }
  switch (curChar) {
  case ':':
    DEBUG_PRINTF("%s",":") ;
    return COLUMN ;
  case ',':
    DEBUG_PRINTF("%s",",") ;
    return COMMA ;
  case '*':
    DEBUG_PRINTF("%s","*") ;
    return STAR ;
  case EOF:
    DEBUG_PRINTF("%s","<EOF>") ;
    return FILEN ;
  case '{': 
    DEBUG_PRINTF("%s","{") ;
    return OPENACC;
  case '}': 
    DEBUG_PRINTF("%s","}") ;
    return CLOSACC;
  case '.':
    DEBUG_PRINTF("%s",".") ;
    curChar=fgetc(inputStream) ;
    identKeyword = 1;
    break ;
  }
  if (IsIdent ()) {
    if (identKeyword)
      return IdentKeyWord() ;
    return IDNTER;
  }
	
  if (isdigit(curChar)) {
    GetNumString() ;
    return NUMVAL ;
  }
  utilsPrintError(GENSYN_ERROR_INVALIDIDF,curChar);
  return LEXERR;	
}
wxString pgTextSearchConfiguration::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Text Search Configuration: ") + GetFullIdentifier() + wxT("\n\n")
		      + wxT("-- DROP TEXT SEARCH CONFIGURATION ") + GetFullIdentifier() + wxT("\n\n")
		      + wxT("CREATE TEXT SEARCH CONFIGURATION ") + GetFullIdentifier() + wxT(" (")
		      + wxT("\n  PARSER = ") + qtTypeIdent(GetParser())
		      + wxT("\n);\n");

		for (size_t i = 0 ; i < tokens.GetCount() ; i++)
			sql += wxT("ALTER TEXT SEARCH CONFIGURATION ") + GetQuotedFullIdentifier()
			       +  wxT(" ADD MAPPING FOR ") + tokens.Item(i).BeforeFirst('/')
			       +  wxT(" WITH ") + tokens.Item(i).AfterFirst('/')
			       +  wxT(";\n");

		if (!GetComment().IsNull())
			sql += wxT("COMMENT ON TEXT SEARCH CONFIGURATION ") + GetFullIdentifier()
			       + wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n");
	}

	return sql;
}
Example #28
0
void gpResQueue::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids)
	{
		expandedKids = true;
		wxString queuesquery;

		queuesquery = wxT("SELECT rolname,\n")
		              wxT(" pg_catalog.shobj_description(r.oid, 'pg_authid') AS description\n");

		queuesquery += wxT("  FROM pg_roles r\n")
		               wxT("  JOIN pg_resqueue q ON  rolresqueue=q.oid\n")
		               wxT(" WHERE  rolresqueue=") + GetOidStr() + wxT("\n")
		               wxT(" ORDER BY rolname");

		pgSetIterator queues(GetConnection(), queuesquery);

		while (queues.RowsLeft())
		{
			wxString queue = queues.GetVal(wxT("rolname"));

			queuesIn.Add(queue);
		}
	}
	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		properties->AppendItem(_("Active threshold"), GetCountLimit());
		properties->AppendItem(_("Cost threshold"), GetCostLimit());
		properties->AppendItem(_("Ignore threshold"), GetIgnoreCostLimit());
		properties->AppendItem(_("Over commit?"), BoolToYesNo(GetOvercommit()));

		wxString roleList;

		size_t index;
		for (index = 0 ; index < queuesIn.GetCount() ; index++)
		{
			if (!roleList.IsEmpty())
				roleList += wxT(", ");
			roleList += queuesIn.Item(index);
		}
		properties->AppendItem(_("Roles using this"), roleList);
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));

	}
}
Example #29
0
void pgExtension::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(_("Schema"), GetSchemaStr());
		properties->AppendYesNoItem(_("Relocatable?"), GetIsRelocatable());
		properties->AppendItem(_("Version"), GetVersion());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
Example #30
0
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;
}