本文整理汇总了C++中NumToStr函数的典型用法代码示例。如果您正苦于以下问题:C++ NumToStr函数的具体用法?C++ NumToStr怎么用?C++ NumToStr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NumToStr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
示例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;
}
示例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();
}
}
//.........这里部分代码省略.........
示例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")
//.........这里部分代码省略.........
示例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;
}