本文整理汇总了C++中XSqlQuery::next方法的典型用法代码示例。如果您正苦于以下问题:C++ XSqlQuery::next方法的具体用法?C++ XSqlQuery::next怎么用?C++ XSqlQuery::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XSqlQuery
的用法示例。
在下文中一共展示了XSqlQuery::next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadScript
void ScriptablePrivate::loadScript(const QString& oName)
{
qDebug() << "Looking for a script " << oName;
XSqlQuery scriptq;
scriptq.prepare("SELECT script_source, script_order"
" FROM script"
" WHERE((script_name=:script_name)"
" AND (script_enabled))"
" ORDER BY script_order;");
scriptq.bindValue(":script_name", oName);
scriptq.exec();
while(scriptq.next())
{
if(engine())
{
QString script = scriptHandleIncludes(scriptq.value("script_source").toString());
QScriptValue result = _engine->evaluate(script, _parent->objectName());
if (_engine->hasUncaughtException())
{
int line = _engine->uncaughtExceptionLineNumber();
qDebug() << "uncaught exception at line" << line << ":" << result.toString();
}
}
else
qDebug() << "could not initialize engine";
}
}
示例2: pubHash
QSqlError pki_x509super::lookupKey()
{
XSqlQuery q;
unsigned hash = pubHash();
SQL_PREPARE(q, "SELECT item FROM public_keys WHERE hash=?");
q.bindValue(0, hash);
q.exec();
if (q.lastError().isValid())
return q.lastError();
while (q.next()) {
pki_key *x = db_base::lookupPki<pki_key>(q.value(0));
if (!x) {
qDebug("Public key with id %d not found",
q.value(0).toInt());
continue;
}
x->resetUcount();
if (compareRefKey(x)) {
setRefKey(x);
break;
}
}
return q.lastError();
}
示例3: populateTable
void CSVAddMapInputDialog::populateTable()
{
XSqlQuery relq;
if (_schema->currentIndex() == 0)
relq.prepare("SELECT CASE nspname WHEN 'public' THEN relname"
" ELSE nspname || '.' || relname"
" END AS relname,"
" CASE nspname WHEN 'public' THEN 0 ELSE 1 END AS seq"
" FROM pg_class"
" JOIN pg_namespace ON (relnamespace=pg_namespace.oid)"
" WHERE ((relkind IN ('r', 'v'))"
" AND (nspname !~ '^pg_')"
" AND (nspname != 'information_schema'))"
" ORDER BY seq, relname;");
else
{
relq.prepare("SELECT relname"
" FROM pg_class"
" JOIN pg_namespace ON (relnamespace=pg_namespace.oid)"
" WHERE ((relkind IN ('r', 'v'))"
" AND (nspname = :nspname))"
" ORDER BY relname;");
relq.bindValue(":nspname", _schema->currentText());
}
if (relq.exec())
_table->clear();
while (relq.next())
_table->addItem(relq.value("relname").toString());
if (relq.lastError().type() != QSqlError::NoError)
{
QMessageBox::critical(this, tr("Database Error"), relq.lastError().text());
return;
}
}
示例4: main
int main(int /*argc*/, const char * /*argv*/[]) {
QTextOStream qout(stdout);
QFile file("test.mql");
if(file.open(IO_ReadOnly)) {
QTextStream stream(&file);
QString query = stream.read();
file.close();
MetaSQLQuery mql(query);
if(mql.isValid()) {
ParameterList params;
params.append("classcode_code", QVariant("^MA"));
qout << "The parsed query generated a valid object." << endl;
XSqlQuery qry = mql.toQuery(params);
while(qry.next()) {
qDebug("row");
}
} else {
qout << "The parsed query did not generate a valid object." << endl;
}
} else {
qout << "Unable to open '" << file.name() << "' for reading." << endl;
}
return 0;
}
示例5: sGetGroups
void MetaSQLSaveParameters::sGetGroups()
{
ParameterList params;
if (_schema->currentText() == "public")
params.append("public");
else if (! _schema->currentText().isEmpty())
params.append("schema", _schema->currentText());
QString groups("SELECT DISTINCT metasql_group"
"<? if exists(\"public\") ?>"
" FROM ONLY metasql"
"<? elseif exists(\"schema\") ?>"
" FROM <? literal(\"schema\") ?>.pkgmetasql"
"<? else ?>"
" FROM metasql"
"<? endif ?>"
" ORDER BY metasql_group;");
MetaSQLQuery groupm(groups);
XSqlQuery groupq = groupm.toQuery(params);
groupq.exec();
_group->clear();
_group->addItem("");
while (groupq.next())
_group->addItem(groupq.value("metasql_group").toString());
if (groupq.lastError().type() != QSqlError::NoError)
QMessageBox::warning(this, tr("Database Errror"),
groupq.lastError().text());
_group->setCurrentIndex(-1);
}
示例6: next
bool XSqlQueryProto::next()
{
XSqlQuery *item = qscriptvalue_cast<XSqlQuery*>(thisObject());
if (item)
return item->next();
return false;
}
示例7: if
QWidget *ItemCharacteristicDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem & /*style*/,
const QModelIndex & index) const
{
if(index.column()!=1)
return 0;
QModelIndex idx = index.sibling(index.row(), CHAR);
characteristic::Type chartype = characteristic::Text;
// Determine what type we have
XSqlQuery qry;
qry.prepare("SELECT char_id, char_type "
"FROM char "
"WHERE (char_id=:char_id); ");
qry.bindValue(":char_id", idx.model()->data(idx, Qt::UserRole));
qry.exec();
if (qry.first())
chartype = (characteristic::Type)qry.value("char_type").toInt();
if (chartype == characteristic::Text ||
chartype == characteristic::List)
{
qry.prepare("SELECT charass_value "
"FROM char, charass "
" LEFT OUTER JOIN charopt ON ((charopt_char_id=charass_char_id) "
" AND (charopt_value=charass_value)) "
"WHERE ((charass_char_id=char_id)"
" AND (charass_target_type='I')"
" AND (charass_target_id=:item_id)"
" AND (char_id=:char_id) ) "
"ORDER BY COALESCE(charopt_order,0), charass_value;");
qry.bindValue(":char_id", idx.model()->data(idx, Qt::UserRole));
qry.bindValue(":item_id", index.model()->data(index, Xt::IdRole));
qry.exec();
QComboBox *editor = new QComboBox(parent);
editor->setEditable(chartype == characteristic::Text);
#ifdef Q_WS_MAC
QFont boxfont = editor->font();
boxfont.setPointSize((boxfont.pointSize() == -1) ? boxfont.pixelSize() - 3 : boxfont.pointSize() - 3);
editor->setFont(boxfont);
#endif
while(qry.next())
editor->addItem(qry.value("charass_value").toString());
editor->installEventFilter(const_cast<ItemCharacteristicDelegate*>(this));
return editor;
}
else if (chartype == characteristic::Date)
{
DLineEdit *editor = new DLineEdit(parent);
return editor;
}
return 0;
}
示例8: sPrint
void assignLotSerial::sPrint()
{
QPrinter printer(QPrinter::HighResolution);
bool setupPrinter = true;
bool userCanceled = false;
QString label;
QString presetPrinter(xtsettingsValue(QString("%1.defaultPrinter").arg(objectName())).toString());
XSqlQuery qlabel;
qlabel.prepare("SELECT ls_id, itemsite_controlmethod "
"FROM itemlocdist "
"LEFT OUTER JOIN itemsite ON (itemlocdist_itemsite_id = itemsite_id) "
"JOIN ls ON (itemlocdist_ls_id=ls_id) "
"WHERE (itemlocdist_series=:itemlocdist_series) "
"ORDER BY ls_number;");
qlabel.bindValue(":itemlocdist_series", _itemlocSeries);
qlabel.exec();
if (qlabel.first()) {
if (qlabel.value("itemsite_controlmethod").toString() == "L")
label = tr("Lot#:");
else
label = tr("Serial#:");
if (presetPrinter.isEmpty()) {
if (orReport::beginMultiPrint(&printer, userCanceled) == false) {
if(!userCanceled) {
systemError(this, tr("<p>Could not initialize printing system for "
"multiple reports."));
return;
}
}
}
else {
printer.setPrinterName(presetPrinter);
orReport::beginMultiPrint(&printer);
}
for (int i = 0; i < qlabel.size(); i++) {
ParameterList params;
params.append("label", label);
params.append("ls_id", qlabel.value("ls_id").toInt());
orReport report("LotSerialLabel", params);
if (report.isValid() && report.print(&printer, setupPrinter))
setupPrinter = false;
else {
report.reportError(this);
break;
}
qlabel.next();
}
orReport::endMultiPrint(&printer);
}
else if (q.lastError().type() != QSqlError::NoError) {
systemError(this, q.lastError().databaseText(), __FILE__, __LINE__);
return;
}
}
示例9: XDialog
user::user(QWidget* parent, const char * name, Qt::WindowFlags fl)
: XDialog(parent, name, fl)
{
setupUi(this);
_authCache = false;
_cUsername = "";
_crmacctid = -1;
_inTransaction = false;
_mode = cView;
connect(_close, SIGNAL(clicked()), this, SLOT(sClose()));
connect(_crmacct, SIGNAL(clicked()), this, SLOT(sCrmAccount()));
connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
connect(_add, SIGNAL(clicked()), this, SLOT(sAdd()));
connect(_addAll, SIGNAL(clicked()), this, SLOT(sAddAll()));
connect(_revoke, SIGNAL(clicked()), this, SLOT(sRevoke()));
connect(_revokeAll, SIGNAL(clicked()), this, SLOT(sRevokeAll()));
connect(_module, SIGNAL(activated(const QString&)), this, SLOT(sModuleSelected(const QString&)));
connect(_granted, SIGNAL(itemSelected(int)), this, SLOT(sRevoke()));
connect(_available, SIGNAL(itemSelected(int)), this, SLOT(sAdd()));
connect(_username, SIGNAL(editingFinished()), this, SLOT(sCheck()));
connect(_enhancedAuth, SIGNAL(toggled(bool)), this, SLOT(sEnhancedAuthUpdate()));
connect(_grantedGroup, SIGNAL(itemSelected(int)), this, SLOT(sRevokeGroup()));
connect(_availableGroup, SIGNAL(itemSelected(int)), this, SLOT(sAddGroup()));
connect(_addGroup, SIGNAL(clicked()), this, SLOT(sAddGroup()));
connect(_revokeGroup, SIGNAL(clicked()), this, SLOT(sRevokeGroup()));
connect(_grantedSite, SIGNAL(itemSelected(int)), this, SLOT(sRevokeSite()));
connect(_availableSite, SIGNAL(itemSelected(int)), this, SLOT(sAddSite()));
connect(_addSite, SIGNAL(clicked()), this, SLOT(sAddSite()));
connect(_revokeSite, SIGNAL(clicked()), this, SLOT(sRevokeSite()));
_available->addColumn("Available Privileges", -1, Qt::AlignLeft);
_granted->addColumn("Granted Privileges", -1, Qt::AlignLeft);
_availableGroup->addColumn("Available Roles", -1, Qt::AlignLeft);
_grantedGroup->addColumn("Granted Roles", -1, Qt::AlignLeft);
_availableSite->addColumn("Available Sites", -1, Qt::AlignLeft);
_grantedSite->addColumn("Granted Sites", -1, Qt::AlignLeft);
_locale->setType(XComboBox::Locales);
XSqlQuery modq;
modq.exec( "SELECT DISTINCT priv_module FROM priv ORDER BY priv_module;" );
for (int i = 0; modq.next(); i++)
_module->append(i, modq.value("priv_module").toString());
if(_evaluation == true)
{
_enhancedAuth->setEnabled(false);
_passwd->setEnabled(false);
_verify->setEnabled(false);
}
if (!_metrics->boolean("MultiWhs"))
_tab->removeTab(_tab->indexOf(_siteTab));
}
示例10: sPopulateItemChar
void purchaseOrderItem::sPopulateItemChar()
{
XSqlQuery item;
item.prepare( "SELECT char_id, char_name, "
" CASE WHEN char_type < 2 THEN "
" charass_value "
" ELSE "
" formatDate(charass_value::date) "
" END AS f_charass_value, "
" charass_value, charass_value AS charass_value_qttooltiprole "
" FROM ( "
" SELECT char_id, char_type, char_name, "
" COALESCE(pi.charass_value,i2.charass_value) AS charass_value "
" FROM "
" (SELECT DISTINCT char_id, char_type, char_name "
" FROM charass, char, charuse "
" WHERE ((charass_char_id=char_id) "
" AND (charuse_char_id=char_id AND charuse_target_type='PI') "
" AND (charass_target_type='I') "
" AND (charass_target_id=:item_id) )"
" UNION SELECT char_id, char_type, char_name "
" FROM charass, char "
" WHERE ((charass_char_id=char_id) "
" AND charass_char_id IN (SELECT charuse_char_id FROM charuse"
" WHERE charuse_target_type = 'I')"
" AND (charass_target_type = 'PI' AND charass_target_id=:poitem_id)) ) AS data "
" LEFT OUTER JOIN charass pi ON ((:poitem_id=pi.charass_target_id) "
" AND ('PI'=pi.charass_target_type) "
" AND (pi.charass_char_id=char_id)) "
" LEFT OUTER JOIN item i1 ON (i1.item_id=:item_id) "
" LEFT OUTER JOIN charass i2 ON ((i1.item_id=i2.charass_target_id) "
" AND ('I'=i2.charass_target_type) "
" AND (i2.charass_char_id=char_id) "
" AND (i2.charass_default))) data2 "
" ORDER BY char_name;" );
item.bindValue(":item_id", _item->id());
item.bindValue(":poitem_id", _poitemid);
item.exec();
int row = 0;
_itemchar->removeRows(0, _itemchar->rowCount());
QModelIndex idx;
while(item.next())
{
_itemchar->insertRow(_itemchar->rowCount());
idx = _itemchar->index(row, 0);
_itemchar->setData(idx, item.value("char_name"), Qt::DisplayRole);
_itemchar->setData(idx, item.value("char_id"), Qt::UserRole);
idx = _itemchar->index(row, 1);
_itemchar->setData(idx, item.value("charass_value"), Qt::DisplayRole);
_itemchar->setData(idx, _item->id(), Xt::IdRole);
_itemchar->setData(idx, _item->id(), Qt::UserRole);
row++;
}
}
示例11: sVoid
void voidChecks::sVoid()
{
XSqlQuery voidVoid;
voidVoid.prepare("SELECT checkhead_id, checkhead_number,"
" voidCheck(checkhead_id) AS result"
" FROM checkhead"
" WHERE ((NOT checkhead_posted)"
" AND (NOT checkhead_replaced)"
" AND (NOT checkhead_deleted)"
" AND (NOT checkhead_void)"
" AND (checkhead_bankaccnt_id=:bankaccnt_id))");
voidVoid.bindValue(":bankaccnt_id", _bankaccnt->id());
voidVoid.exec();
while (voidVoid.next())
{
int result = voidVoid.value("result").toInt();
if (result < 0)
systemError(this,
tr("Check %1").arg(voidVoid.value("checkhead_number").toString()) +
"\n" + storedProcErrorLookup("voidCheck", result),
__FILE__, __LINE__);
else if(_issueReplacements->isChecked())
{
XSqlQuery rplc;
rplc.prepare("SELECT replaceVoidedCheck(:checkhead_id) AS result;");
while(voidVoid.next())
{
rplc.bindValue(":checkhead_id", voidVoid.value("checkhead_id").toInt());
rplc.exec();
}
}
omfgThis->sChecksUpdated(_bankaccnt->id(), -1, TRUE);
}
if (voidVoid.lastError().type() != QSqlError::NoError)
{
systemError(this, voidVoid.lastError().databaseText(), __FILE__, __LINE__);
return;
}
accept();
}
示例12: generateHTML
QString ExportHelper::generateHTML(QString qtext, ParameterList ¶ms, QString &errmsg)
{
if (DEBUG)
qDebug("ExportHelper::generateHTML(%s..., %d params, errmsg) entered",
qPrintable(qtext.left(80)), params.size());
if (qtext.isEmpty())
return QString::null;
QTextDocument doc(0);
QTextCursor cursor(&doc);
QTextTableFormat tablefmt;
bool valid;
QVariant includeheaderVar = params.value("includeHeaderLine", &valid);
bool includeheader = (valid ? includeheaderVar.toBool() : false);
if (DEBUG)
qDebug("generateHTML(qtest, params, errmsg) includeheader = %d, valid = %d",
includeheader, valid);
MetaSQLQuery mql(qtext);
XSqlQuery qry = mql.toQuery(params);
if (qry.first())
{
int cols = qry.record().count();
int expected = qry.size();
if (includeheader)
expected++;
// presize the table
cursor.insertTable((expected < 0 ? 1 : expected), cols, tablefmt);
if (includeheader)
{
tablefmt.setHeaderRowCount(1);
for (int p = 0; p < cols; p++)
{
cursor.insertText(qry.record().fieldName(p));
cursor.movePosition(QTextCursor::NextCell);
}
}
do {
for (int i = 0; i < cols; i++)
{
cursor.insertText(qry.value(i).toString());
cursor.movePosition(QTextCursor::NextCell);
}
} while (qry.next());
}
if (qry.lastError().type() != QSqlError::NoError)
errmsg = qry.lastError().text();
return doc.toHtml();
}
示例13: groupEditTextChanged
void QueryEditor::groupEditTextChanged(const QString & t)
{
XSqlQuery xqry;
xqry.prepare("SELECT DISTINCT metasql_name FROM metasql WHERE metasql_group=:group ORDER BY metasql_name;");
xqry.bindValue(":group", t);
if(xqry.exec())
{
_mqlName->clear();
while(xqry.next())
_mqlName->addItem(xqry.value(0).toString());
}
}
示例14: sFillGroupList
void financialLayoutGroup::sFillGroupList()
{
XSqlQuery financialFillGroupList;
_group->clear();
financialFillGroupList.prepare("SELECT flgrp_id, flgrp_name"
" FROM flgrp"
" WHERE (flgrp_flhead_id=:flhead_id)"
" ORDER BY flgrp_name;");
financialFillGroupList.bindValue(":flhead_id", _flheadid);
financialFillGroupList.exec();
_group->append(-1, tr("Parent"));
while(financialFillGroupList.next())
_group->append(financialFillGroupList.value("flgrp_id").toInt(), financialFillGroupList.value("flgrp_name").toString());
}
示例15: generateXML
QString ExportHelper::generateXML(QString qtext, QString tableElemName, ParameterList ¶ms, QString &errmsg, int xsltmapid)
{
if (DEBUG)
qDebug("ExportHelper::generateXML(%s..., %s, %d params, errmsg, %d) entered",
qPrintable(qtext.left(80)), qPrintable(tableElemName),
params.size(), xsltmapid);
if (DEBUG)
{
QStringList plist;
for (int i = 0; i < params.size(); i++)
plist.append("\t" + params.name(i) + ":\t" + params.value(i).toString());
qDebug("generateXML parameters:\n%s", qPrintable(plist.join("\n")));
}
QDomDocument xmldoc("xtupleimport");
QDomElement rootelem = xmldoc.createElement("xtupleimport");
xmldoc.appendChild(rootelem);
if (! qtext.isEmpty())
{
MetaSQLQuery mql(qtext);
XSqlQuery qry = mql.toQuery(params);
if (qry.first())
{
do {
QDomElement tableElem = xmldoc.createElement(tableElemName);
if (DEBUG)
qDebug("generateXML starting %s", qPrintable(tableElemName));
for (int i = 0; i < qry.record().count(); i++)
{
QDomElement fieldElem = xmldoc.createElement(qry.record().fieldName(i));
if (qry.record().value(i).isNull())
fieldElem.appendChild(xmldoc.createTextNode("[NULL]"));
else
fieldElem.appendChild(xmldoc.createTextNode(qry.record().value(i).toString()));
tableElem.appendChild(fieldElem);
}
rootelem.appendChild(tableElem);
} while (qry.next());
}
if (qry.lastError().type() != QSqlError::NoError)
errmsg = qry.lastError().text();
}
if (xsltmapid < 0)
return xmldoc.toString();
else
return XSLTConvertString(xmldoc.toString(), xsltmapid, errmsg);
}