• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NumToStr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NumToStr函数的典型用法代码示例。如果您正苦于以下问题:C++ NumToStr函数的具体用法?C++ NumToStr怎么用?C++ NumToStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NumToStr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: while

int dlgGroup::Go(bool modal)
{
    pgSet *set = connection->ExecuteSet(wxT("SELECT usename FROM pg_user"));
    if (set)
    {
        while (!set->Eof())
        {
            wxString userName = set->GetVal(wxT("usename"));

            if (group && group->GetUsersIn().Index(userName) >= 0)
                lbUsersIn->Append(userName);
            else
                lbUsersNotIn->Append(userName);

            set->MoveNext();
        }
        delete set;
    }

    if (group)
    {
        // Edit Mode
        readOnly = !group->GetServer()->GetSuperUser();

        txtID->SetValue(NumToStr(group->GetGroupId()));
        if (!connection->BackendMinimumVersion(7, 4))
            txtName->Disable();
        txtID->Disable();
        if (readOnly)
        {
            btnAddUser->Disable();
            btnDelUser->Disable();
        }
    }
    else
    {
        txtID->SetValidator(numericValidator);
    }

    return dlgProperty::Go(modal);
}
开发者ID:douglasresende,项目名称:pgadmin3,代码行数:41,代码来源:dlgGroup.cpp


示例2: GetConnection

long slCluster::GetSlonPid()
{
	long slonPid;
	wxString pidcol = GetConnection()->BackendMinimumVersion(9, 2) ? wxT("pid") : wxT("procpid");

	if (GetConnection()->BackendMinimumVersion(9, 0))
	{
		slonPid = StrToLong(GetConnection()->ExecuteScalar(
		                        wxT("SELECT nl_backendpid FROM ") + qtIdent(wxT("_") + GetName()) + wxT(".sl_nodelock nl, ")
		                        wxT("pg_stat_activity sa WHERE nl.nl_backendpid = sa.") + pidcol + wxT(" AND nl_nodeid = ")
		                        + NumToStr(GetLocalNodeID())));
	}
	else
	{
		slonPid = StrToLong(GetConnection()->ExecuteScalar(
		                        wxT("SELECT listenerpid FROM pg_listener WHERE relname = ")
		                        + qtDbString(wxT("_") + GetName() + wxT("_Event"))));
	}

	return slonPid;
}
开发者ID:SokilV,项目名称:pgadmin3,代码行数:21,代码来源:slCluster.cpp


示例3: NumToStr

wxString ctlSQLResult::OnGetItemText(long item, long col) const
{
	if (thread && thread->DataValid())
	{
		if (!rowcountSuppressed)
		{
			if (col)
				col--;
			else
				return NumToStr(item + 1L);
		}
		if (item >= 0)
		{
			thread->DataSet()->Locate(item + 1);
			return thread->DataSet()->GetVal(col);
		}
		else
			return thread->DataSet()->ColName(col);
	}
	return wxEmptyString;
}
开发者ID:ubershmekel,项目名称:pgadmin3,代码行数:21,代码来源:ctlSQLResult.cpp


示例4: NumToStr

VOID LIClass::Render (struct RenderMessage &rmsg)
{
  if(Flags & FLG_Layouted)
  {
    if(!rmsg.TargetObj)
    {
      struct RastPort *rp = rmsg.RPort;
      if(Number)
      {
        char str[64];
        NumToStr(str, rmsg.OL_Type);
        struct TextFont *font = rmsg.Share->Fonts[Font_Normal];
        ULONG len = strlen(str);
        ULONG x = Left - MyTextLength(font, str, len) - rmsg.OffsetX;
        SetAPen(rp, rmsg.Colours[Col_Text]);
        SetFont(rp, font);
        Move(rp, x, Baseline - rmsg.OffsetY);
        Text(rp, str, len);
      }
      else
      {
        if(rmsg.Share->LI_BMp)
        {
          LONG x, y, width = rmsg.Share->LI_Width, height = rmsg.Share->LI_Height;
          x = Left - width - rmsg.OffsetX;
          y = Baseline - rmsg.OffsetY - height + 1;

          ULONG index = 0;
          if(rmsg.UL_Nesting > 1)
            index = width * min(rmsg.UL_Nesting-1, 2);

          if(rmsg.Share->LI_Mask)
              BltMaskRPort(rmsg.Share->LI_BMp, index, 0, rp, x, y, width, height, rmsg.Share->LI_Mask);
          else  BltBitMapRastPort(rmsg.Share->LI_BMp, index, 0, rp, x, y, width, height, 0x0c0);
        }
      }
    }
    TreeClass::Render(rmsg);
  }
}
开发者ID:SamuraiCrow,项目名称:htmlview,代码行数:40,代码来源:LIClass.cpp


示例5: wxT

pgObject *slSlSequenceFactory::CreateObjects(pgCollection *coll, ctlTree *browser, const wxString &restr)
{
	slSetObjCollection *collection = (slSetObjCollection *)coll;
	slSequence *sequence = 0;
	wxString restriction;
	if (restr.IsEmpty())
		restriction = wxT(" WHERE seq_set = ") + NumToStr(collection->GetSlId());
	else
		restriction = restr;

	pgSet *sequences = collection->GetDatabase()->ExecuteSet(
	                       wxT("SELECT seq_id, seq_set, nspname, relname, seq_comment\n")
	                       wxT("  FROM ") + collection->GetCluster()->GetSchemaPrefix() + wxT("sl_sequence\n")
	                       wxT("  JOIN ") + collection->GetCluster()->GetSchemaPrefix() + wxT("sl_set ON set_id=seq_set\n")
	                       wxT("  JOIN pg_class cl ON cl.oid=seq_reloid\n")
	                       wxT("  JOIN pg_namespace nsp ON nsp.oid=relnamespace\n")
	                       + restriction +
	                       wxT(" ORDER BY seq_id"));

	if (sequences)
	{
		while (!sequences->Eof())
		{
			sequence = new slSequence(collection->GetSet(), sequences->GetVal(wxT("nspname")) + wxT(".") + sequences->GetVal(wxT("relname")));
			sequence->iSetSlId(sequences->GetLong(wxT("seq_id")));
			sequence->iSetComment(sequences->GetVal(wxT("seq_comment")));

			if (browser)
			{
				browser->AppendObject(collection, sequence);
				sequences->MoveNext();
			}
			else
				break;
		}

		delete sequences;
	}
	return sequence;
}
开发者ID:Joe-xXx,项目名称:pgadmin3,代码行数:40,代码来源:slSequence.cpp


示例6: wxT

pgObject *slPathFactory::CreateObjects(pgCollection *coll, ctlTree *browser, const wxString &restr)
{
	slNodeObjCollection *collection = (slNodeObjCollection *)coll;
	slPath *path = 0;
	wxString restriction;
	if (restr.IsEmpty())
		restriction = wxT(" WHERE pa_client = ") + NumToStr(collection->GetSlId());
	else
		restriction = restr;

	pgSet *paths = collection->GetDatabase()->ExecuteSet(
	                   wxT("SELECT pa_client, pa_server, pa_conninfo, pa_connretry, no_comment\n")
	                   wxT("  FROM ") + collection->GetCluster()->GetSchemaPrefix() + wxT("sl_path\n")
	                   wxT("  JOIN ") + collection->GetCluster()->GetSchemaPrefix() + wxT("sl_node on no_id=pa_server\n")
	                   + restriction +
	                   wxT(" ORDER BY pa_server"));

	if (paths)
	{
		while (!paths->Eof())
		{
			path = new slPath(collection->GetNode(), paths->GetVal(wxT("no_comment")).BeforeFirst('\n'));
			path->iSetSlId(paths->GetLong(wxT("pa_server")));
			path->iSetConnInfo(paths->GetVal(wxT("pa_conninfo")));
			path->iSetConnRetry(paths->GetLong(wxT("pa_connretry")));

			if (browser)
			{
				browser->AppendObject(collection, path);
				paths->MoveNext();
			}
			else
				break;
		}

		delete paths;
	}
	return path;
}
开发者ID:kleopatra999,项目名称:pgadmin3,代码行数:39,代码来源:slPath.cpp


示例7: wxT

wxString frmBackup::getCmdPart1()
{
	pgServer *server = object->GetDatabase()->GetServer();

	wxString cmd = backupExecutable;

	if (!server->GetName().IsEmpty())
		cmd += wxT(" --host ") + server->GetName();

	cmd +=  wxT(" --port ") + NumToStr((long)server->GetPort())
	        +  wxT(" --username ") + commandLineCleanOption(qtIdent(server->GetUsername()));

	if (!cbRolename->GetValue().IsEmpty())
		cmd += wxT(" --role ") + commandLineCleanOption(qtIdent(cbRolename->GetValue()));

	if (pgAppMinimumVersion(backupExecutable, 8, 4))
		cmd += wxT(" --no-password ");

	if (object->GetConnection()->GetIsGreenplum())
		cmd += wxT(" --gp-syntax ");
	return cmd;
}
开发者ID:AnnaSkawinska,项目名称:pgadmin3,代码行数:22,代码来源:frmBackup.cpp


示例8: wxT

int dlgRepSetMove::Go(bool modal)
{
	txtID->SetValue(IdAndName(set->GetSlId(), set->GetName()));
	txtID->Disable();

	pgSet *nodes = connection->ExecuteSet(
	                   wxT("SELECT no_id, no_comment\n")
	                   wxT("  FROM ") + cluster->GetSchemaPrefix() + wxT("sl_node\n")
	                   wxT("  JOIN ") + cluster->GetSchemaPrefix() + wxT("sl_subscribe ON sub_receiver=no_id\n")
	                   wxT(" WHERE sub_set = ") + NumToStr(set->GetSlId()));

	if (nodes)
	{
		while (!nodes->Eof())
		{
			long id = nodes->GetLong(wxT("no_id"));
			cbTargetNode->Append(IdAndName(id, nodes->GetVal(wxT("no_comment"))), (void *)id);
			nodes->MoveNext();
		}
		delete nodes;
	}
	return dlgProperty::Go(modal);
}
开发者ID:AnnaSkawinska,项目名称:pgadmin3,代码行数:23,代码来源:dlgRepSet.cpp


示例9: Go

int dlgRepSet::Go(bool modal)
{
	txtID->SetValidator(numericValidator);

	if (set)
	{
		// edit mode
		txtID->SetValue(NumToStr(set->GetSlId()));
		txtID->Disable();
		txtOrigin->SetValue(IdAndName(set->GetOriginId(), set->GetOriginNode()));
		txtComment->Disable();
	}
	else
	{
		// create mode
		txtOrigin->SetValue(IdAndName(cluster->GetLocalNodeID(), cluster->GetLocalNodeName()));
		EnableOK(true);
	}

	txtOrigin->Disable();

	return dlgProperty::Go(modal);
}
开发者ID:AnnaSkawinska,项目名称:pgadmin3,代码行数:23,代码来源:dlgRepSet.cpp


示例10: increase

void increase(UCHAR time[])
{
    UCHAR i;
    UINT  quantity;
    bit Carry = 0;            //若发生进位,则Carry为1,否则为0
    for (i=0; i<7; i++)   //i=0~6分别代表秒、分、时、星期、日、月、年
        {
            quantity = StrToNum(i, time);
            if (quantity > 9999)
                {
                    time[0] = 'E';
                    time[1] = 'r';
                    time[2] = 'r';
                    break;
                }
            quantity++;
            Carry    = NumToStr(i, quantity, time);
            if (i == 3)      //若是星期数增加了,则日也要增加
                continue;
            if (Carry == 0)
                break;
        }
}
开发者ID:qqiseeu,项目名称:MCU_Clock,代码行数:23,代码来源:clock_increase.c


示例11: wxT

wxString pgUser::GetSql(ctlTree *browser)
{
    if (sql.IsNull())
    {
        sql = wxT("-- User: ") + GetName() + wxT("\n\n")
              + wxT("-- DROP USER ") + GetQuotedFullIdentifier() + wxT(";")
              + wxT("\n\nCREATE USER ") + GetQuotedIdentifier()
              + wxT("\n  WITH SYSID ") + NumToStr(userId);
        if (GetPassword() != wxT("********"))
            AppendIfFilled(sql, wxT("\n  ENCRYPTED PASSWORD "), qtDbString(GetPassword()));
        sql += wxT("\n ");
        if (GetCreateDatabase())    sql += wxT(" CREATEDB");
        else                        sql += wxT(" NOCREATEDB");
        if (GetUpdateCatalog())     sql += wxT(" CREATEUSER");
        else                        sql += wxT(" NOCREATEUSER");
        if (GetAccountExpires().IsValid())
            AppendIfFilled(sql, wxT(" VALID UNTIL "), qtDbString(DateToAnsiStr(GetAccountExpires())));
        sql += wxT(";\n");

        size_t index;
        for (index = 0 ; index < configList.GetCount() ; index++)
        {
            if (configList.Item(index).BeforeFirst('=') != wxT("search_path") &&
                    configList.Item(index).BeforeFirst('=') != wxT("temp_tablespaces"))
                sql += wxT("ALTER USER ") + GetQuotedIdentifier()
                       + wxT(" SET ") + configList.Item(index).BeforeFirst('=') + wxT("='") + configList.Item(index).AfterFirst('=') + wxT("';\n");
            else
                sql += wxT("ALTER USER ") + GetQuotedIdentifier()
                       + wxT(" SET ") + configList.Item(index).BeforeFirst('=') + wxT("=") + configList.Item(index).AfterFirst('=') + wxT(";\n");
        }
        for (index = 0 ; index < groupsIn.GetCount() ; index++)
            sql += wxT("ALTER GROUP ") + qtIdent(groupsIn.Item(index))
                   +  wxT(" ADD USER ") + GetQuotedIdentifier() + wxT(";\n");

    }
    return sql;
}
开发者ID:zr40,项目名称:pgadmin3-light,代码行数:37,代码来源:pgUser.cpp


示例12: wxT

wxString frmBackupGlobals::getCmdPart1()
{
	pgServer *server;
	if (object->GetMetaType() == PGM_SERVER)
		server = (pgServer *)object;
	else
		server = object->GetDatabase()->GetServer();

	wxString cmd = backupExecutable;

	if (!server->GetName().IsEmpty())
		cmd += wxT(" --host ") + server->GetName();

	cmd +=  wxT(" --port ") + NumToStr((long)server->GetPort())
	        +  wxT(" --username ") + commandLineCleanOption(qtIdent(server->GetUsername()));

	if (!cbRolename->GetValue().IsEmpty())
		cmd += wxT(" --role ") + commandLineCleanOption(qtIdent(cbRolename->GetValue()));

	if (pgAppMinimumVersion(backupExecutable, 8, 4))
		cmd += wxT(" --no-password ");

	return cmd;
}
开发者ID:Joe-xXx,项目名称:pgadmin3,代码行数:24,代码来源:frmBackupGlobals.cpp


示例13: GetName

wxString dlgRole::GetSql()
{
	int pos;
	wxString sql;
	wxString name = GetName();

	wxString passwd = txtPasswd->GetValue();
	bool createDB = chkCreateDB->GetValue(),
	     createRole = chkCreateRole->GetValue(),
	     superuser = chkSuperuser->GetValue(),
	     inherits = chkInherits->GetValue(),
	     canLogin = chkCanLogin->GetValue(),
	     replication = chkReplication->GetValue();

	if (role)
	{
		// Edit Mode

		AppendNameChange(sql, wxT("ROLE ") + role->GetQuotedFullIdentifier());


		wxString options;
		if (canLogin != role->GetCanLogin())
		{
			if (canLogin)
				options = wxT(" LOGIN");
			else
				options = wxT(" NOLOGIN");
		}
		if (canLogin && !passwd.IsEmpty())
			options += wxT(" ENCRYPTED PASSWORD ") + qtDbString(connection->EncryptPassword(name, passwd));

		if (createDB != role->GetCreateDatabase() || createRole != role->GetCreateRole()
		        || superuser != role->GetSuperuser() || inherits != role->GetInherits()
		        || replication != role->GetReplication())
		{
			options += wxT("\n ");

			if (superuser != role->GetSuperuser())
			{
				if (superuser)
					options += wxT(" SUPERUSER");
				else
					options += wxT(" NOSUPERUSER");
			}
			if (inherits != role->GetInherits())
			{
				if (inherits)
					options += wxT(" INHERIT");
				else
					options += wxT(" NOINHERIT");
			}
			if (createDB != role->GetCreateDatabase())
			{
				if (createDB)
					options += wxT(" CREATEDB");
				else
					options += wxT(" NOCREATEDB");
			}
			if (createRole != role->GetCreateRole())
			{
				if (createRole)
					options += wxT(" CREATEROLE");
				else
					options += wxT(" NOCREATEROLE");
			}
			if (connection->BackendMinimumVersion(9, 1))
			{
				if (replication != role->GetReplication())
				{
					if (replication)
						options += wxT(" REPLICATION");
					else
						options += wxT(" NOREPLICATION");
				}
			}
		}
		if (!datValidUntil->GetValue().IsValid() || DateToStr(datValidUntil->GetValue() + timValidUntil->GetValue()) != DateToStr(role->GetAccountExpires()))
		{
			if (datValidUntil->GetValue().IsValid())
				options += wxT("\n   VALID UNTIL ") + qtDbString(DateToAnsiStr(datValidUntil->GetValue() + timValidUntil->GetValue()));
			else if (!role->GetIsValidInfinity() && role->GetAccountExpires().GetValue() != -1)
				options += wxT("\n   VALID UNTIL 'infinity'");
		}

		if (txtConnectionLimit->GetValue().Length() == 0)
		{
			if (role->GetConnectionLimit() != -1)
			{
				options += wxT(" CONNECTION LIMIT -1");
			}
		}
		else
		{
			if (txtConnectionLimit->GetValue() != NumToStr(role->GetConnectionLimit()))
			{
				options += wxT(" CONNECTION LIMIT ") + txtConnectionLimit->GetValue();
			}
		}

//.........这里部分代码省略.........
开发者ID:search5,项目名称:pgadmin3,代码行数:101,代码来源:dlgRole.cpp


示例14: wxCommandEventHandler

int dlgDomain::Go(bool modal)
{
	if (connection->BackendMinimumVersion(9, 1))
	{
		seclabelPage->SetConnection(connection);
		seclabelPage->SetObject(domain);
		this->Connect(EVT_SECLABELPANEL_CHANGE, wxCommandEventHandler(dlgDomain::OnChange));
	}
	else
		seclabelPage->Disable();

	if (domain)
	{
		// edit mode
		cbSchema->Enable(connection->BackendMinimumVersion(8, 1));
		cbDatatype->Append(domain->GetBasetype());
		AddType(wxT(" "), 0, domain->GetBasetype());
		cbDatatype->SetSelection(0);
		if (domain->GetLength() >= 0)
		{
			txtLength->SetValue(NumToStr(domain->GetLength()));
			if (domain->GetPrecision() >= 0)
				txtPrecision->SetValue(NumToStr(domain->GetPrecision()));
		}
		chkNotNull->SetValue(domain->GetNotNull());
		txtDefault->SetValue(domain->GetDefault());

		wxCookieType cookie;
		pgObject *data = 0;
		wxTreeItemId item = mainForm->GetBrowser()->GetFirstChild(domain->GetId(), cookie);
		while (item)
		{
			data = mainForm->GetBrowser()->GetObject(item);
			pgaFactory *factory = data->GetFactory();
			if (factory == checkFactory.GetCollectionFactory())
				constraintsItem = item;
			else if (data->GetMetaType() == PGM_CONSTRAINT)
				constraintsItem = item;

			if (constraintsItem)
				break;

			item = mainForm->GetBrowser()->GetNextChild(domain->GetId(), cookie);
		}

		if (constraintsItem)
		{
			pgCollection *coll = (pgCollection *)mainForm->GetBrowser()->GetObject(constraintsItem);
			// make sure all constraints are appended
			coll->ShowTreeDetail(mainForm->GetBrowser());
			// this is the constraints collection
			item = mainForm->GetBrowser()->GetFirstChild(constraintsItem, cookie);

			// add constraints
			while (item)
			{
				data = mainForm->GetBrowser()->GetObject(item);
				switch (data->GetMetaType())
				{
					case PGM_CHECK:
					{
						pgCheck *obj = (pgCheck *)data;

						lstConstraints->AppendItem(data->GetIconId(), obj->GetName(), obj->GetDefinition());
						constraintsDefinition.Add(obj->GetDefinition());
						previousConstraints.Add(obj->GetQuotedIdentifier()
						                        + wxT(" ") + obj->GetTypeName().Upper() + wxT(" ") + obj->GetDefinition());
						break;
					}
				}

				item = mainForm->GetBrowser()->GetNextChild(constraintsItem, cookie);
			}
		}

		cbDatatype->Disable();

		cbCollation->SetValue(domain->GetQuotedCollation());
		cbCollation->Disable();

		if (!connection->BackendMinimumVersion(7, 4))
		{
			cbOwner->Disable();
			txtDefault->Disable();
			chkNotNull->Disable();
		}
	}
	else
	{
		// create mode
		FillDatatype(cbDatatype, false);

		cbCollation->Enable(connection->BackendMinimumVersion(9, 1));
		if (connection->BackendMinimumVersion(9, 1))
		{
			// fill collation combobox
			cbCollation->Append(wxEmptyString);
			pgSet *set = connection->ExecuteSet(
			                 wxT("SELECT nspname, collname\n")
			                 wxT("  FROM pg_collation c, pg_namespace n\n")
//.........这里部分代码省略.........
开发者ID:intgr,项目名称:pgadmin3,代码行数:101,代码来源:dlgDomain.cpp


示例15: _


//.........这里部分代码省略.........
			{
				/*
				*  currentObject is set using the following command.
				*  i.e. currentObject = browser->GetObject(item);
				*  While fetching this object using this code, somehow it looses its virtual table pointer.
				*  Hence, it is not able to call the GetFullIdentifier - virtual function from the
				*  particular class, but it will always call this functions from pgObject class always.
				*  To rectify this problem, we need to explicitly check the meta data type and call the
				*  function from the particular class.
				*/
				if (data->GetMetaType() == PGM_SERVER)
					text = wxString::Format(_("Are you sure you wish to drop server \"%s\"?"),
					                        ((pgServer *)data)->GetFullIdentifier().c_str());
				else if (data->GetMetaType() == EDB_SYNONYM)
					text = ((edbPrivateSynonym *)data)->GetTranslatedMessage(DROPEXCLUDINGDEPS);
				else
					text = data->GetTranslatedMessage(DROPEXCLUDINGDEPS);
				caption = data->GetTranslatedMessage(DROPTITLE);
			}
			wxMessageDialog msg(this, text, caption, wxYES_NO | wxICON_QUESTION | wxNO_DEFAULT);
			if (msg.ShowModal() != wxID_YES)
			{
				return false;
			}
		}
	}
	bool done = data->DropObject(this, browser, cascaded);

	if (done)
	{
		wxLogInfo(wxT("Dropping %s %s"), data->GetTypeName().c_str(), data->GetIdentifier().c_str());

		wxTreeItemId parentItem = browser->GetItemParent(data->GetId());

		if (updateFinal)
		{
			wxTreeItemId nextItem;
			if (browser->IsVisible(data->GetId()))
				nextItem = browser->GetNextVisible(data->GetId());

			if (nextItem)
			{
				pgObject *nextData = browser->GetObject(nextItem);
				if (!nextData || nextData->GetType() != data->GetType())
					nextItem = browser->GetPrevSibling(data->GetId());
			}
			else
				nextItem = browser->GetPrevSibling(data->GetId());

			if (nextItem)
				browser->SelectItem(nextItem);
		}
		pgaFactory *droppedCollFactory = data->GetFactory()->GetCollectionFactory();

		wxTreeItemId oldgroupitem;
		wxString oldgroupname;
		if (data->IsCreatedBy(serverFactory))
		{
			oldgroupname = ((pgServer *)data)->GetGroup();
			oldgroupitem = browser->GetItemParent(data->GetId());
		}

		browser->Delete(data->GetId());
		// data is invalid now

		if (updateFinal)
		{
			if (!oldgroupname.IsEmpty())
			{
				int total = browser->GetChildrenCount(oldgroupitem, false);
				if (total == 0)
					browser->Delete(oldgroupitem);
				else
				{
					wxString label = oldgroupname + wxT(" (") + NumToStr((long)total) + wxT(")");
					browser->SetItemText(oldgroupitem, label);
				}
			}
			else
			{
				pgCollection *collection = 0;

				while (parentItem)
				{
					collection = (pgCollection *)browser->GetObject(parentItem);
					if (collection && collection->IsCollection() && collection->GetFactory() == droppedCollFactory)
					{
						collection->UpdateChildCount(browser);
						break;
					}
					parentItem = browser->GetItemParent(parentItem);
				}
			}
		}

		// Update the server list, if we dropped a server
		StoreServers();
	}
	return done;
}
开发者ID:search5,项目名称:pgadmin3,代码行数:101,代码来源:events.cpp


示例16: NumToStr

wxWindow *pluginUtilityFactory::StartDialog(frmMain *form, pgObject *obj)
{
	wxString execCmd = command;
	wxArrayString environment = set_env;

	// Remember this as the last plugin used
	form->SetLastPluginUtility(this);

	// Replace all the place holders with appropriate values
	if (HaveDatabase(obj))
	{
		execCmd.Replace(wxT("$$HOSTNAME"), obj->GetConnection()->GetHostName());
		execCmd.Replace(wxT("$$HOSTADDR"), obj->GetConnection()->GetHostName());
		execCmd.Replace(wxT("$$PORT"), NumToStr((long)obj->GetConnection()->GetPort()));
		execCmd.Replace(wxT("$$SSLMODE"), obj->GetConnection()->GetSslModeName());
		execCmd.Replace(wxT("$$DATABASE"), obj->GetConnection()->GetDbname());
		execCmd.Replace(wxT("$$USERNAME"), obj->GetConnection()->GetUser());
		execCmd.Replace(wxT("$$PASSWORD"), obj->GetConnection()->GetPassword());

		// Set the PGPASSWORD variable if required.
		if (set_password && !obj->GetConnection()->GetPassword().IsEmpty())
			wxSetEnv(wxT("PGPASSWORD"), obj->GetConnection()->GetPassword());

		// Pass the SSL settings via the environment
		switch (obj->GetConnection()->GetSslMode())
		{
			case 1:
				wxSetEnv(wxT("PGREQUIRESSL"), wxT("1"));
				break;
			case 2:
				wxSetEnv(wxT("PGREQUIRESSL"), wxT("0"));
				break;
		}

		wxSetEnv(wxT("PGSSLMODE"), obj->GetConnection()->GetSslModeName());
		wxSetEnv(wxT("PGSSLCERT"), obj->GetConnection()->GetSSLCert());
		wxSetEnv(wxT("PGSSLKEY"), obj->GetConnection()->GetSSLKey());
		wxSetEnv(wxT("PGSSLROOTCERT"), obj->GetConnection()->GetSSLRootCert());
		wxSetEnv(wxT("PGSSLCRL"), obj->GetConnection()->GetSSLCrl());
	}
	else
	{
		// Blank the rest
		execCmd.Replace(wxT("$$HOSTNAME"), wxEmptyString);
		execCmd.Replace(wxT("$$HOSTADDR"), wxEmptyString);
		execCmd.Replace(wxT("$$PORT"), wxEmptyString);
		execCmd.Replace(wxT("$$SSLMODE"), wxEmptyString);
		execCmd.Replace(wxT("$$DATABASE"), wxEmptyString);
		execCmd.Replace(wxT("$$USERNAME"), wxEmptyString);
		execCmd.Replace(wxT("$$PASSWORD"), wxEmptyString);
	}

	// Name
	if (obj && obj->IsCollection())
		execCmd.Replace(wxT("$$OBJECTNAME"), wxT("*"));
	else if (obj)
		execCmd.Replace(wxT("$$OBJECTNAME"), obj->GetName());
	else
		execCmd.Replace(wxT("$$OBJECTNAME"), wxEmptyString);

	// Object type
	if (obj && obj->GetFactory())
		execCmd.Replace(wxT("$$OBJECTTYPE"), wxString(obj->GetFactory()->GetTypeName()).Upper());
	else
		execCmd.Replace(wxT("$$OBJECTTYPE"), wxEmptyString);

	// Schema
	if (obj)
	{
		if (obj->GetMetaType() == PGM_SCHEMA)
			execCmd.Replace(wxT("$$SCHEMA"), obj->GetName());
		else if (obj->GetSchema())
			execCmd.Replace(wxT("$$SCHEMA"), obj->GetSchema()->GetName());
	}
	else
		execCmd.Replace(wxT("$$SCHEMA"), wxEmptyString);

	// Table
	if (obj)
	{
		if (obj->GetMetaType() == PGM_TABLE || obj->GetMetaType() == GP_PARTITION)
			execCmd.Replace(wxT("$$TABLE"), obj->GetName());
		else if (obj->GetTable())
			execCmd.Replace(wxT("$$TABLE"), obj->GetTable()->GetName());
	}
	else
		execCmd.Replace(wxT("$$TABLE"), wxEmptyString);

	// Directory substitutions
	execCmd.Replace(wxT("$$BINDIR"), loadPath);
	execCmd.Replace(wxT("$$WORKINGDIR"), wxGetCwd());
	execCmd.Replace(wxT("$$PGBINDIR"), settings->GetPostgresqlPath());
	execCmd.Replace(wxT("$$EDBBINDIR"), settings->GetEnterprisedbPath());
	execCmd.Replace(wxT("$$SLONYBINDIR"), settings->GetSlonyPath());

	// set Environment variable.
	for (size_t i = 0 ; i < environment.GetCount() ; i++)
	{
		wxString str = environment.Item(i);
		wxSetEnv(str.BeforeFirst('='), str.AfterFirst('='));
//.........这里部分代码省略.........
开发者ID:AnnaSkawinska,项目名称:pgadmin3,代码行数:101,代码来源:plugins.cpp


示例17: NumToStr

void pgUser::ShowDependents(frmMain *form, ctlListView *referencedBy, const wxString &where)
{
    form->StartMsg(_(" Retrieving user owned objects"));

    referencedBy->ClearAll();
    referencedBy->AddColumn(_("Type"), 60);
    referencedBy->AddColumn(_("Database"), 80);
    referencedBy->AddColumn(_("Name"), 300);

    wxString uid = NumToStr(GetUserId());
    wxString sysoid = NumToStr(GetConnection()->GetLastSystemOID());

    wxArrayString dblist;

    pgSet *set;
    if (GetConnection()->BackendMinimumVersion(7, 5))
        set = GetConnection()->ExecuteSet(
                  wxT("SELECT 'd' as type, datname, datallowconn, datdba\n")
                  wxT("  FROM pg_database db\n")
                  wxT("UNION\n")
                  wxT("SELECT 'M', spcname, null, null\n")
                  wxT("  FROM pg_tablespace where spcowner=") + uid + wxT("\n")
                  wxT(" ORDER BY 1, 2"));
    else
        set = GetConnection()->ExecuteSet(
                  wxT("SELECT 'd' as type, datname, datallowconn, datdba\n")
                  wxT("  FROM pg_database db"));

    if (set)
    {
        while (!set->Eof())
        {
            wxString name = set->GetVal(wxT("datname"));
            if (set->GetVal(wxT("type")) == wxT("d"))
            {
                if (set->GetBool(wxT("datallowconn")))
                    dblist.Add(name);
                if (GetUserId() == set->GetLong(wxT("datdba")))
                    referencedBy->AppendItem(databaseFactory.GetIconId(), _("Database"), name);
            }
            else
                referencedBy->AppendItem(tablespaceFactory.GetIconId(), _("Tablespace"), wxEmptyString, name);

            set->MoveNext();
        }
        delete set;
    }

    FillOwned(form->GetBrowser(), referencedBy, dblist,
              wxT("SELECT cl.relkind, COALESCE(cin.nspname, cln.nspname) as nspname, COALESCE(ci.relname, cl.relname) as relname, cl.relname as indname\n")
              wxT("  FROM pg_class cl\n")
              wxT("  JOIN pg_namespace cln ON cl.relnamespace=cln.oid\n")
              wxT("  LEFT OUTER JOIN pg_index ind ON ind.indexrelid=cl.oid\n")
              wxT("  LEFT OUTER JOIN pg_class ci ON ind.indrelid=ci.oid\n")
              wxT("  LEFT OUTER JOIN pg_namespace cin ON ci.relnamespace=cin.oid\n")
              wxT(" WHERE cl.relowner = ") + uid + wxT(" AND cl.oid > ") + sysoid + wxT("\n")
              wxT("UNION ALL\n")
              wxT("SELECT 'n', null, nspname, null\n")
              wxT("  FROM pg_namespace nsp WHERE nspowner = ") + uid + wxT(" AND nsp.oid > ") + sysoid + wxT("\n")
              wxT("UNION ALL\n")
              wxT("SELECT CASE WHEN typtype='d' THEN 'd' ELSE 'y' END, null, typname, null\n")
              wxT("  FROM pg_type ty WHERE typowner = ") + uid + wxT(" AND ty.oid > ") + sysoid + wxT("\n")
              wxT("UNION ALL\n")
              wxT("SELECT 'C', null, conname, null\n")
              wxT("  FROM pg_conversion co WHERE conowner = ") + uid + wxT(" AND co.oid > ") + sysoid + wxT("\n")
              wxT("UNION ALL\n")
              wxT("SELECT CASE WHEN prorettype=") + NumToStr(PGOID_TYPE_TRIGGER) + wxT(" THEN 'T' ELSE 'p' END, null, proname, null\n")
              wxT("  FROM pg_proc pr WHERE proowner = ") + uid + wxT(" AND pr.oid > ") + sysoid + wxT("\n")
              wxT("UNION ALL\n")
              wxT("SELECT 'o', null, oprname || '('::text || ")
              wxT("COALESCE(tl.typname, ''::text) || ")
              wxT("CASE WHEN tl.oid IS NOT NULL AND tr.oid IS NOT NULL THEN ','::text END || ")
              wxT("COALESCE(tr.typname, ''::text) || ')'::text, null\n")
              wxT("  FROM pg_operator op\n")
              wxT("  LEFT JOIN pg_type tl ON tl.oid=op.oprleft\n")
              wxT("  LEFT JOIN pg_type tr ON tr.oid=op.oprright\n")
              wxT(" WHERE oprowner = ") + uid + wxT(" AND op.oid > ") + sysoid + wxT("\n")
              wxT(" ORDER BY 1,2,3"));

    form->EndMsg(set != 0);
}
开发者ID:zr40,项目名称:pgadmin3-light,代码行数:81,代码来源:pgUser.cpp


示例18: Go

int dlgServer::Go(bool modal)
{
	chkSSLCompression->Disable();

	cbSSL->Clear();
	cbSSL->Append(wxT(" "));

#ifdef SSL
	cbSSL->Append(_("require"));
	cbSSL->Append(_("prefer"));

	if (pgConn::GetLibpqVersion() > 7.3)
	{
		cbSSL->Append(_("allow"));
		cbSSL->Append(_("disable"));
	}

	if (pgConn::GetLibpqVersion() >= 8.4)
	{
		cbSSL->Append(_("verify-ca"));
		cbSSL->Append(_("verify-full"));
	}

	if (pgConn::GetLibpqVersion() >= 9.2)
	{
		chkSSLCompression->Enable();
	}
#endif

	if (server)
	{
		if (cbDatabase->FindString(server->GetDatabaseName()) < 0)
			cbDatabase->Append(server->GetDatabaseName());
		txtHostAddr->SetValue(server->GetHostAddr());
		txtDescription->SetValue(server->GetDescription());
		txtService->SetValue(server->GetService());
		txtServiceID->SetValue(server->GetServiceID());
		txtPort->SetValue(NumToStr((long)server->GetPort()));
		cbSSL->SetSelection(server->GetSSL());
		cbDatabase->SetValue(server->GetDatabaseName());
		txtUsername->SetValue(server->GetUsername());
		chkStorePwd->SetValue(server->GetStorePwd());
		txtRolename->SetValue(server->GetRolename());
		chkRestore->SetValue(server->GetRestore());
		txtDbRestriction->SetValue(server->GetDbRestriction());
		colourPicker->SetColour(server->GetColour());
		cbGroup->SetValue(server->GetGroup());

		pickerSSLCert->SetPath(server->GetSSLCert());
		pickerSSLKey->SetPath(server->GetSSLKey());
		pickerSSLRootCert->SetPath(server->GetSSLRootCert());
		pickerSSLCrl->SetPath(server->GetSSLCrl());

		chkSSLCompression->SetValue(server->GetSSLCompression());

		stPassword->Disable();
		txtPassword->Disable();
		if (connection)
		{
			txtHostAddr->Disable();
			txtDescription->Disable();
			txtService->Disable();
			txtServiceID->Disable();
			txtName->Disable();
			cbDatabase->Disable();
			txtPort->Disable();
			cbSSL->Disable();
			txtUsername->Disable();
			chkStorePwd->Disable();
			txtRolename->Disable();
			chkRestore->Disable();
			txtDbRestriction->Disable();
			colourPicker->Disable();
			cbGroup->Disable();
			pickerSSLCert->Disable();
			pickerSSLKey->Disable();
			pickerSSLRootCert->Disable();
			pickerSSLCrl->Disable();
			chkSSLCompression->Disable();
			EnableOK(false);
		}
	}
	else
	{
		SetTitle(_("Add server"));
		cbGroup->SetValue(_("Servers"));
		wxString colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).GetAsString(wxC2S_HTML_SYNTAX);
		colourPicker->SetColour(colour);
	}

	return dlgProperty::Go(modal);
}
开发者ID:mintsoft,项目名称:pgadmin3,代码行数:92,代码来源:dlgServer.cpp


示例19: EnableOK


//.........这里部分代码省略.........
		{
			ctlTree *browser = mainForm->GetBrowser();
			wxTreeItemId oldgroupitem, groupitem, serveritem;
			wxTreeItemIdValue groupcookie;
			bool found;
			int total;
			wxString label, oldgroupname;

			// Duplicate server object
			pgServer *newserver = new pgServer(
			    server->GetName(),
			    server->GetHostAddr(),
			    server->GetDescription(),
			    server->GetService(),
			    server->GetDatabaseName(),
			    server->GetUsername(),
			    server->GetPort(),
			    server->GetStorePwd(),
			    server->GetRolename(),
			    server->GetRestore(),
			    server->GetSSL(),
			    server->GetColour(),
			    server->GetGroup());
			newserver->iSetDbRestriction(server->GetDbRestriction().Trim());
			newserver->iSetServiceID(server->GetServiceID().Trim());
			newserver->iSetDiscoveryID(server->GetDiscoveryID().Trim());
			newserver->SetSSLCert(server->GetSSLCert());
			newserver->SetSSLKey(server->GetSSLKey());
			newserver->SetSSLRootCert(server->GetSSLRootCert());
			newserver->SetSSLCrl(server->GetSSLCrl());
			newserver->iSetSSLCompression(server->GetSSLCompression());

			// Drop the old item
			// (will also take care of dropping the pgServer item)
			oldgroupitem = browser->GetItemParent(item);
			oldgroupname = server->GetGroup();
			if (oldgroupname.IsEmpty())
				oldgroupname = _("Servers");
			browser->Delete(item);

			// Move the item
			found = false;
			if (browser->ItemHasChildren(browser->GetRootItem()))
			{
				groupitem = browser->GetFirstChild(browser->GetRootItem(), groupcookie);
				while (!found && groupitem)
				{
					if (browser->GetItemText(groupitem).StartsWith(cbGroup->GetValue()))
						found = true;
					else
						groupitem = browser->GetNextChild(browser->GetRootItem(), groupcookie);
				}
			}

			if (!found)
			{
				groupitem = browser->AppendItem(browser->GetRootItem(), cbGroup->GetValue(), browser->GetItemImage(browser->GetRootItem()));
				browser->SortChildren(browser->GetRootItem());
			}

			serveritem = browser->AppendItem(groupitem, newserver->GetFullName(), newserver->GetIconId(), -1, newserver);
			browser->SortChildren(groupitem);
			browser->Expand(groupitem);
			browser->SelectItem(serveritem);

			// Count the number of items in the old group item
			total = browser->GetChildrenCount(oldgroupitem, false);
			if (total == 0)
				browser->Delete(oldgroupitem);
			else
			{
				label = oldgroupname + wxT(" (") + NumToStr((long)total) + wxT(")");
				browser->SetItemText(oldgroupitem, label);
			}

			// Count the number of items in the new group item
			total = browser->GetChildrenCount(groupitem, false);
			label = cbGroup->GetValue() + wxT(" (") + NumToStr((long)total) + wxT(")");
			browser->SetItemText(groupitem, label);

			// Re-initialize old variables to have their new meanings
			server = newserver;
			item = serveritem;
		}
		server->iSetGroup(cbGroup->GetValue());

		mainForm->execSelChange(server->GetId(), true);
		mainForm->GetBrowser()->SetItemText(item, server->GetFullName());
		mainForm->SetItemBackgroundColour(item, wxColour(server->GetColour()));
		mainForm->StoreServers();
	}

	if (IsModal())
	{
		EndModal(wxID_OK);
		return;
	}
	else
		Destroy();
}
开发者ID:mintsoft,项目名称:pgadmin3,代码行数:101,代码来源:dlgServer.cpp


示例20: switch


//.........这里部分代 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NumToString函数代码示例发布时间:2022-05-30
下一篇:
C++ NumBits函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap