本文整理汇总了C++中qtDbString函数的典型用法代码示例。如果您正苦于以下问题:C++ qtDbString函数的具体用法?C++ qtDbString怎么用?C++ qtDbString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qtDbString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxT
wxString dlgRepSequence::GetSql()
{
wxString sql;
if (sequence)
{
// edit mode
}
else
{
// create mode
sql = wxT("SELECT ") + cluster->GetSchemaPrefix() + wxT("setaddsequence(")
+ NumToStr(set->GetSlId()) + wxT(", ");
if (StrToLong(txtID->GetValue()) > 0)
sql += txtID->GetValue();
else
sql += wxT("(SELECT COALESCE(MAX(seq_id), 0) + 1 FROM ") + cluster->GetSchemaPrefix() + wxT("sl_sequence)");
sql += wxT(", ") + qtDbString(cbSequence->GetGuessedStringSelection())
+ wxT(", ") + qtDbString(txtComment->GetValue())
+ wxT(")\n");
}
return sql;
}
示例2: wxT
/*
* Execute default privileges statement
*
* - Hacked to execute the default privileges statement (sql) for dlgDatabse against this database,
* because connection for this database object is getting disconnected, and replaced by the server
* connection, before execution of any statements (sqls) in dlgPropery::apply function called
* from dlgPropery::OnOK event handler.
*
* NOTE: This will work only if the database object exists.
*/
bool dlgDatabase::executeDDLSql(const wxString &strSql)
{
pgConn *myConn = connection;
if (!strSql.IsEmpty())
{
wxString tmp;
if (cbClusterSet && cbClusterSet->GetSelection() > 0)
{
replClientData *data = (replClientData *)cbClusterSet->wxItemContainer::GetClientData(cbClusterSet->GetSelection());
if (data->majorVer > 1 || (data->majorVer == 1 && data->minorVer >= 2))
{
tmp = wxT("SELECT ") + qtIdent(data->cluster)
+ wxT(".ddlscript_prepare(") + NumToStr(data->setId) + wxT(", 0);\n")
+ wxT("SELECT ") + qtIdent(data->cluster)
+ wxT(".ddlscript_complete(") + NumToStr(data->setId) + wxT(", ")
+ qtDbString(strSql) + wxT(", 0);\n");
}
else
{
tmp = wxT("SELECT ") + qtIdent(data->cluster)
+ wxT(".ddlscript(") + NumToStr(data->setId) + wxT(", ")
+ qtDbString(strSql) + wxT(", 0);\n");
}
}
else
tmp = strSql;
if (!myConn->ExecuteVoid(tmp))
// error message is displayed inside ExecuteVoid
return false;
}
return true;
}
示例3: AppendNameChange
wxString dlgForeignServer::GetSql()
{
wxString sql, name;
name = txtName->GetValue();
if (foreignserver)
{
// edit mode
AppendNameChange(sql, wxT("SERVER ") + qtIdent(foreignserver->GetName()));
if (txtVersion->GetValue() != foreignserver->GetVersion())
{
sql = wxT("ALTER SERVER ") + qtIdent(name)
+ wxT("\n VERSION ") + qtDbString(txtVersion->GetValue()) + wxT(";\n");
}
wxString sqloptions = GetOptionsSql();
if (sqloptions.Length() > 0)
{
sql += wxT("ALTER SERVER ") + name
+ wxT("\n OPTIONS (") + sqloptions + wxT(");\n");
}
AppendOwnerChange(sql, wxT("SERVER ") + qtIdent(name));
}
else
{
// create mode
sql = wxT("CREATE SERVER ") + qtIdent(name);
if (!(txtType->GetValue()).IsEmpty())
sql += wxT("\n TYPE ") + qtDbString(txtType->GetValue());
if (!(txtVersion->GetValue()).IsEmpty())
sql += wxT("\n VERSION ") + qtDbString(txtVersion->GetValue());
sql += wxT("\n FOREIGN DATA WRAPPER ") + qtIdent(foreigndatawrapper->GetName());
// check for options
if (lstOptions->GetItemCount() > 0)
{
wxString options = wxEmptyString;
for (int pos = 0 ; pos < lstOptions->GetItemCount() ; pos++)
{
if (options.Length() > 0)
options += wxT(", ");
options += lstOptions->GetText(pos, 0)
+ wxT(" '") + lstOptions->GetText(pos, 1) + wxT("' ");
}
sql += wxT("\n OPTIONS (") + options + wxT(")");
}
sql += wxT(";\n");
AppendOwnerNew(sql, wxT("SERVER ") + qtIdent(name));
}
sql += GetGrant(wxT("U"), wxT("SERVER ") + qtIdent(name));
AppendComment(sql, wxT("SERVER"), 0, foreignserver);
return sql;
}
示例4: ExecuteScalar
bool pgConn::HasPrivilege(const wxString &objTyp, const wxString &objName, const wxString &priv)
{
wxString res = ExecuteScalar(
wxT("SELECT has_") + objTyp.Lower()
+ wxT("_privilege(") + qtDbString(objName)
+ wxT(", ") + qtDbString(priv) + wxT(")"));
return StrToBool(res);
}
示例5: qtIdent
void dlgRepCluster::OnChangeCluster(wxCommandEvent &ev)
{
clusterBackup = wxEmptyString;
remoteVersion = wxEmptyString;
cbAdminNode->Clear();
cbAdminNode->Append(_("<none>"), (void *) - 1);
int sel = cbClusterName->GetCurrentSelection();
if (remoteConn && sel >= 0)
{
wxString schemaPrefix = qtIdent(wxT("_") + cbClusterName->GetValue()) + wxT(".");
long adminNodeID = settings->Read(wxT("Replication/") + cbClusterName->GetValue() + wxT("/AdminNode"), -1L);
remoteVersion = remoteConn->ExecuteScalar(wxT("SELECT ") + schemaPrefix + wxT("slonyVersion();"));
wxString sql =
wxT("SELECT no_id, no_comment\n")
wxT(" FROM ") + schemaPrefix + wxT("sl_node\n")
wxT(" JOIN ") + schemaPrefix + wxT("sl_path ON no_id = pa_client\n")
wxT(" WHERE pa_server = (SELECT last_value FROM ") + schemaPrefix + wxT("sl_local_node_id)\n")
wxT(" AND pa_conninfo ILIKE ") + qtDbString(wxT("%host=") + remoteServer->GetName() + wxT("%")) + wxT("\n")
wxT(" AND pa_conninfo LIKE ") + qtDbString(wxT("%dbname=") + cbDatabase->GetValue() + wxT("%")) + wxT("\n");
if (remoteServer->GetPort() != 5432)
sql += wxT(" AND pa_conninfo LIKE ") + qtDbString(wxT("%port=") + NumToStr((long)remoteServer->GetPort()) + wxT("%"));
pgSet *set = remoteConn->ExecuteSet(sql);
if (set)
{
if (!set->Eof())
{
long id = set->GetLong(wxT("no_id"));
cbAdminNode->Append(IdAndName(id, set->GetVal(wxT("no_comment"))), (void *)id);
if (adminNodeID == id)
cbAdminNode->SetSelection(cbAdminNode->GetCount() - 1);
}
}
usedNodes.Clear();
set = remoteConn->ExecuteSet(
wxT("SELECT no_id FROM ") + schemaPrefix + wxT("sl_node"));
if (set)
{
while (!set->Eof())
{
usedNodes.Add(set->GetLong(wxT("no_id")));
set->MoveNext();
}
delete set;
}
}
OnChange(ev);
}
示例6: wxT
pgObject *dlgColumn::CreateObject(pgCollection *collection)
{
pgObject *obj;
obj = columnFactory.CreateObjects(collection, 0,
wxT("\n AND attname=") + qtDbString(GetName()) +
wxT("\n AND cl.relname=") + qtDbString(table->GetName()) +
wxT("\n AND cl.relnamespace=") + table->GetSchema()->GetOidStr() +
wxT("\n"));
return obj;
}
示例7: wxT
pgObject *dlgPackage::CreateObject(pgCollection *collection)
{
pgObject *obj;
if (collection->GetConnection()->EdbMinimumVersion(8, 2))
obj = packageFactory.CreateObjects(collection, 0,
wxT(" AND nspname = ") + qtDbString(GetName()));
else
obj = packageFactory.CreateObjects(collection, 0,
wxT(" AND pkgname = ") + qtDbString(GetName()));
return obj;
}
示例8: wxT
pgObject *dlgSynonym::CreateObject(pgCollection *collection)
{
pgObject *obj = NULL;
if (!synonymSchema)
obj = synonymFactory.CreateObjects(collection, 0,
wxT(" WHERE synname = ") + qtDbString(GetName()));
else
obj = edbPrivFactory.CreateObjects(collection, 0,
wxT(" WHERE s.synname=") + qtDbString(GetName()) +
wxT(" AND s.synnamespace=") + collection->GetSchema()->GetOidStr() + wxT(" \n"));
return obj;
}
示例9: wxT
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;
}
示例10: wxT
wxString dlgJob::GetInsertSql()
{
wxString sql;
if (!job)
{
sql = wxT("INSERT INTO pgagent.pga_job (jobid, jobjclid, jobname, jobdesc, jobenabled, jobhostagent)\n")
wxT("SELECT <JobId>, jcl.jclid, ") + qtDbString(GetName()) +
wxT(", ") + qtDbString(txtComment->GetValue()) + wxT(", ") + BoolToStr(chkEnabled->GetValue()) +
wxT(", ") + qtDbString(txtHostAgent->GetValue()) + wxT("\n")
wxT(" FROM pgagent.pga_jobclass jcl WHERE jclname=") + qtDbString(cbJobclass->GetValue()) + wxT(";\n");
}
return sql;
}
示例11: wxT
/*
* Execute default privileges statement
*
* - Hacked to execute the default privileges statement (sql) for dlgDatabse against this database,
* because connection for this database object is getting disconnected, and replaced by the server
* connection, before execution of any statements (sqls) in dlgPropery::apply function called
* from dlgPropery::OnOK event handler.
*
* NOTE: This will work only if the database object exists.
*/
bool dlgDatabase::executeDDLSql(const wxString &strSql)
{
pgConn *myConn = connection;
if (!strSql.IsEmpty())
{
wxString tmp;
if (cbClusterSet && cbClusterSet->GetSelection() > 0)
{
replClientData *data = (replClientData *)cbClusterSet->wxItemContainer::GetClientData(cbClusterSet->GetSelection());
if (data->majorVer > 1 || (data->majorVer == 1 && data->minorVer >= 2))
{
// From slony version 2.2.0 onwards ddlscript_prepare() method is removed and
// ddlscript_complete() method arguments got changed so we have to use ddlcapture() method
// instead of ddlscript_prepare() and changed the argument of ddlscript_complete() method
if ((data->majorVer == 2 && data->minorVer >= 2) || (data->majorVer > 2))
{
tmp = wxT("SELECT ") + qtIdent(data->cluster)
+ wxT(".ddlcapture(") + qtDbString(strSql) + wxT(", ") + wxT("NULL::text") + wxT(");\n")
+ wxT("SELECT ") + qtIdent(data->cluster)
+ wxT(".ddlscript_complete(") + wxT("NULL::text") + wxT(");\n");
}
else
{
tmp = wxT("SELECT ") + qtIdent(data->cluster)
+ wxT(".ddlscript_prepare(") + NumToStr(data->setId) + wxT(", -1);\n")
+ strSql + wxT(";\n")
+ wxT("SELECT ") + qtIdent(data->cluster)
+ wxT(".ddlscript_complete(") + NumToStr(data->setId) + wxT(", ")
+ qtDbString(strSql) + wxT(", -1);\n");
}
}
else
{
tmp = wxT("SELECT ") + qtIdent(data->cluster)
+ wxT(".ddlscript(") + NumToStr(data->setId) + wxT(", ")
+ qtDbString(strSql) + wxT(", 0);\n");
}
}
else
tmp = strSql;
if (!myConn->ExecuteVoid(tmp))
// error message is displayed inside ExecuteVoid
return false;
}
return true;
}
示例12: wxT
pgObject *edbPackage::Refresh(ctlTree *browser, const wxTreeItemId item)
{
pgObject *package=0;
pgCollection *coll=browser->GetParentCollection(item);
if (coll)
{
if (coll->GetConnection()->EdbMinimumVersion(8, 2))
package = packageFactory.CreateObjects(coll, 0, wxT(" AND nspname=") + qtDbString(GetName()));
else
package = packageFactory.CreateObjects(coll, 0, wxT(" AND pkgname=") + qtDbString(GetName()));
}
return package;
}
示例13: wxT
pgObject *dlgView::CreateObject(pgCollection *collection)
{
pgObject *obj = viewFactory.CreateObjects(collection, 0,
wxT("\n AND c.relname=") + qtDbString(txtName->GetValue()) +
wxT("\n AND c.relnamespace=") + schema->GetOidStr());
return obj;
}
示例14: wxT
pgObject *dlgRepCluster::CreateObject(pgCollection *collection)
{
pgObject *obj = slClusterFactory.CreateObjects(collection, 0,
wxT(" WHERE nspname = ") + qtDbString(wxT("_") + GetName()));
return obj;
}
示例15: wxT
void dlgRepTable::LoadTrigger(OID relid)
{
wxString sql = wxT("SELECT tgname FROM pg_trigger\n")
wxT(" JOIN pg_proc pr ON pr.oid=tgfoid\n")
wxT(" JOIN pg_namespace ns ON ns.oid=pronamespace\n")
wxT(" WHERE tgrelid=") + NumToStr(relid);
if (connection->BackendMinimumVersion(8, 5))
sql += wxT(" AND tgconstraint=0\n");
else
sql += wxT(" AND NOT tgisconstraint\n");
sql += wxT(" AND nspname <> ") + qtDbString(wxT("_") + set->GetCluster()->GetName()) + wxT("\n")
wxT(" ORDER BY tgname");
pgSet *trg=connection->ExecuteSet(sql);
if (trg)
{
while (!trg->Eof())
{
chkTrigger->Append(trg->GetVal(wxT("tgname")));
trg->MoveNext();
}
delete trg;
}
}