/** Test compound where clause, using the AND operator. */ void tst_QDjangoWhere::andWhere() { QDjangoWhere testQuery; const QDjangoWhere queryId("id", QDjangoWhere::Equals, 1); const QDjangoWhere queryUsername("username", QDjangoWhere::Equals, "foo"); testQuery = queryId && queryUsername; CHECKWHERE(testQuery, QLatin1String("id = ? AND username = ?"), QVariantList() << 1 << "foo"); // and with "all" queryset testQuery = QDjangoWhere() && queryId; CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); testQuery = queryId && QDjangoWhere(); CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); // and with "none" queryset testQuery = !QDjangoWhere() && queryId; QCOMPARE(testQuery.isNone(), true); CHECKWHERE(testQuery, QLatin1String("1 != 0"), QVariantList()); testQuery = queryId && !QDjangoWhere(); QCOMPARE(testQuery.isNone(), true); CHECKWHERE(testQuery, QLatin1String("1 != 0"), QVariantList()); // negation testQuery = !(queryId && queryUsername); CHECKWHERE(testQuery, QLatin1String("NOT (id = ? AND username = ?)"), QVariantList() << 1 << "foo"); }
/** Test eager loading of foreign keys. */ void tst_QDjangoModel::selectRelated() { // load fixtures { Item *item1 = new Item; item1->setName("first"); QCOMPARE(item1->save(), true); Item *item2 = new Item; item2->setName("second"); QCOMPARE(item2->save(), true); Owner owner; owner.setName("owner"); owner.setItem1(item1); owner.setItem2(item2); QCOMPARE(owner.save(), true); } // without eager loading QDjangoQuerySet<Owner> qs; Owner *owner = qs.get(QDjangoWhere("name", QDjangoWhere::Equals, "owner")); QVERIFY(owner != 0); QCOMPARE(owner->item1()->name(), QLatin1String("first")); QCOMPARE(owner->item2()->name(), QLatin1String("second")); delete owner; // with eager loading owner = qs.selectRelated().get(QDjangoWhere("name", QDjangoWhere::Equals, "owner")); QVERIFY(owner != 0); QCOMPARE(owner->item1()->name(), QLatin1String("first")); QCOMPARE(owner->item2()->name(), QLatin1String("second")); delete owner; }
static void saveMessage(const QXmppMessage &message, const QDateTime &now, bool received) { const QString localJid = QXmppUtils::jidToBareJid(received ? message.to() : message.from()); const QString remoteJid = QXmppUtils::jidToBareJid(received ? message.from() : message.to()); // get or create collection int chatId; QDjangoQuerySet<ArchiveMessage> qs; qs = qs.filter(QDjangoWhere("chat__jid", QDjangoWhere::Equals, localJid)); qs = qs.filter(QDjangoWhere("chat__with", QDjangoWhere::Equals, remoteJid)); qs = qs.orderBy(QStringList() << "-date").limit(0, 1); ArchiveMessage tmp; if (qs.size() > 0 && qs.at(0, &tmp) && tmp.date().secsTo(now) < 3600) { chatId = tmp.property("chat_id").toInt(); } else { ArchiveChat chat; chat.setJid(localJid); chat.setWith(remoteJid); chat.setStart(now); chat.save(); chatId = chat.pk().toInt(); } // save outgoing message ArchiveMessage msg; msg.setProperty("chat_id", chatId); msg.setBody(message.body()); msg.setDate(now); msg.setReceived(received); msg.save(); }
/** Test compound where clause, using the OR operator. */ void tst_QDjangoWhere::orWhere() { QDjangoWhere testQuery; const QDjangoWhere queryId("id", QDjangoWhere::Equals, 1); const QDjangoWhere queryUsername("username", QDjangoWhere::Equals, "foo"); testQuery = queryId || queryUsername; CHECKWHERE(testQuery, QLatin1String("id = ? OR username = ?"), QVariantList() << 1 << "foo"); // or with "all" queryset testQuery = QDjangoWhere() || queryId; QCOMPARE(testQuery.isAll(), true); CHECKWHERE(testQuery, QString(), QVariantList()); testQuery = queryId || QDjangoWhere(); QCOMPARE(testQuery.isAll(), true); CHECKWHERE(testQuery, QString(), QVariantList()); // or with "none" queryset testQuery = !QDjangoWhere() || queryId; CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); testQuery = queryId || !QDjangoWhere(); CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); // negation testQuery = !(queryId || queryUsername); CHECKWHERE(testQuery, QLatin1String("NOT (id = ? OR username = ?)"), QVariantList() << 1 << "foo"); }
QDjangoQuerySet<Project> DatabaseController::listProjects(QDateTime from, QDateTime to=QDateTime::currentDateTime()){ QDjangoQuerySet<Project> projects; projects = projects.filter( QDjangoWhere("start_date", QDjangoWhere::GreaterOrEquals, from) && QDjangoWhere("start_date", QDjangoWhere::LessOrEquals, to) ); return projects; }
/** Test "in" comparison. */ void tst_QDjangoWhere::isIn() { QDjangoWhere testQuery = QDjangoWhere("id", QDjangoWhere::IsIn, QVariantList() << 1 << 2); CHECKWHERE(testQuery, QLatin1String("id IN (?, ?)"), QVariantList() << 1 << 2); testQuery = !QDjangoWhere("id", QDjangoWhere::IsIn, QVariantList() << 1 << 2); CHECKWHERE(testQuery, QLatin1String("id NOT IN (?, ?)"), QVariantList() << 1 << 2); }
/** Test ">=" comparison. */ void tst_QDjangoWhere::greaterOrEquals() { QDjangoWhere testQuery; testQuery = QDjangoWhere("id", QDjangoWhere::GreaterOrEquals, 1); CHECKWHERE(testQuery, QLatin1String("id >= ?"), QVariantList() << 1); testQuery = !QDjangoWhere("id", QDjangoWhere::GreaterOrEquals, 1); CHECKWHERE(testQuery, QLatin1String("id < ?"), QVariantList() << 1); }
/** Test "<=" comparison. */ void tst_QDjangoWhere::lessOrEquals() { QDjangoWhere testQuery; testQuery = QDjangoWhere("id", QDjangoWhere::LessOrEquals, 1); CHECKWHERE(testQuery, QLatin1String("id <= ?"), QVariantList() << 1); testQuery = !QDjangoWhere("id", QDjangoWhere::LessOrEquals, 1); CHECKWHERE(testQuery, QLatin1String("id > ?"), QVariantList() << 1); }
/** Test "isnull" comparison. */ void tst_QDjangoWhere::isNull() { QDjangoWhere testQuery = QDjangoWhere("id", QDjangoWhere::IsNull, true); CHECKWHERE(testQuery, QLatin1String("id IS NULL"), QVariantList()); testQuery = QDjangoWhere("id", QDjangoWhere::IsNull, false); CHECKWHERE(testQuery, QLatin1String("id IS NOT NULL"), QVariantList()); testQuery = !QDjangoWhere("id", QDjangoWhere::IsNull, true); CHECKWHERE(testQuery, QLatin1String("id IS NOT NULL"), QVariantList()); }
QDjangoQuerySet<Product> DatabaseController::listProducts(int min_price, int max_price=-1){ QDjangoQuerySet<Product> some_products; QDjangoWhere query = QDjangoWhere("price", QDjangoWhere::GreaterOrEquals, min_price); if(max_price != -1) query = query && QDjangoWhere("price", QDjangoWhere::LessOrEquals, max_price); some_products = some_products.filter( query ); return some_products; }
/** Test "!=" comparison. */ void tst_QDjangoWhere::notEqualsWhere() { QDjangoWhere testQuery; // construct a "not equals" where clause testQuery = QDjangoWhere("id", QDjangoWhere::NotEquals, 1); CHECKWHERE(testQuery, QLatin1String("id != ?"), QVariantList() << 1); // negate the where clause testQuery = !QDjangoWhere("id", QDjangoWhere::NotEquals, 1); CHECKWHERE(testQuery, QLatin1String("id = ?"), QVariantList() << 1); }
void Patient::filtred_Patients(){ ui->lw_filtredPatients->clear(); QDjangoQuerySet <Paciente> pat; if (!ui->le_patFILTER->text().isEmpty()) pat = pat.filter(QDjangoWhere("nameP", QDjangoWhere::Contains, ui->le_patFILTER->text())); else if(!ui->le_prontSearch->text().isEmpty()) pat = pat.filter(QDjangoWhere("pront", QDjangoWhere::Contains, ui->le_prontSearch->text())); for (int i = 0; i < pat.count(); ++i){ QListWidgetItem * itemP = new QListWidgetItem(pat.at(i)->nameP(), ui->lw_filtredPatients); itemP->setData(Qt::UserRole, pat.at(i)->pront()); } }
/** Perform filtering on foreign keys. */ void tst_QDjangoModel::filterRelated() { // load fixtures { Item *item1 = new Item; item1->setName("first"); QCOMPARE(item1->save(), true); Item *item2 = new Item; item2->setName("second"); QCOMPARE(item2->save(), true); Owner owner; owner.setName("owner"); owner.setItem1(item1); owner.setItem2(item2); QCOMPARE(owner.save(), true); } // perform filtering QDjangoQuerySet<Owner> owners; QDjangoQuerySet<Owner> qs = owners.filter( QDjangoWhere("item1__name", QDjangoWhere::Equals, "first")); CHECKWHERE(qs.where(), QLatin1String("T0.\"name\" = ?"), QVariantList() << "first"); QCOMPARE(qs.count(), 1); QCOMPARE(qs.size(), 1); Owner *owner = qs.at(0); QVERIFY(owner != 0); QCOMPARE(owner->name(), QLatin1String("owner")); delete owner; }
/** Test "contains" comparison. */ void tst_QDjangoWhere::contains() { QDjangoDatabase::DatabaseType databaseType = QDjangoDatabase::databaseType(QDjango::database()); if (databaseType == QDjangoDatabase::MySqlServer) { QDjangoWhere testQuery = QDjangoWhere("name", QDjangoWhere::Contains, "abc"); CHECKWHERE(testQuery, QLatin1String("name LIKE BINARY ?"), QVariantList() << "%abc%"); testQuery = !QDjangoWhere("name", QDjangoWhere::Contains, "abc"); CHECKWHERE(testQuery, QLatin1String("name NOT LIKE BINARY ?"), QVariantList() << "%abc%"); } else { QDjangoWhere testQuery = QDjangoWhere("name", QDjangoWhere::Contains, "abc"); CHECKWHERE(testQuery, QLatin1String("name LIKE ?"), QVariantList() << "%abc%"); testQuery = !QDjangoWhere("name", QDjangoWhere::Contains, "abc"); CHECKWHERE(testQuery, QLatin1String("name NOT LIKE ?"), QVariantList() << "%abc%"); } }
entity::CashAccount* CashAccountTableModel::findBySelectedRow(const QSqlTableModel* model, int row) { QSqlRecord record = model->record(row); QVariant id = record.value("cashAccountId"); return QDjangoQuerySet<entity::CashAccount>() .get(QDjangoWhere("cashAccountId", QDjangoWhere::Equals, id)); }
/** Test case-insensitive "=" comparison. */ void tst_QDjangoWhere::iEqualsWhere() { QDjangoDatabase::DatabaseType databaseType = QDjangoDatabase::databaseType(QDjango::database()); if (databaseType == QDjangoDatabase::PostgreSQL) { QDjangoWhere testQuery = QDjangoWhere("name", QDjangoWhere::IEquals, "abc"); CHECKWHERE(testQuery, QLatin1String("UPPER(name::text) LIKE UPPER(?)"), QVariantList() << "abc"); testQuery = !QDjangoWhere("name", QDjangoWhere::IEquals, "abc"); CHECKWHERE(testQuery, QLatin1String("UPPER(name::text) NOT LIKE UPPER(?)"), QVariantList() << "abc"); } else { QDjangoWhere testQuery = QDjangoWhere("name", QDjangoWhere::IEquals, "abc"); CHECKWHERE(testQuery, QLatin1String("name LIKE ?"), QVariantList() << "abc"); testQuery = !QDjangoWhere("name", QDjangoWhere::IEquals, "abc"); CHECKWHERE(testQuery, QLatin1String("name NOT LIKE ?"), QVariantList() << "abc"); } }
QDjangoQuerySet<Project> DatabaseController::listProjects(bool active=false){ QDjangoQuerySet<Project> projects; if(active) projects = projects.filter( QDjangoWhere("valid_until", QDjangoWhere::GreaterOrEquals, QDateTime::currentDateTime()) ); return projects; }
void TestModels::test_ModelAPIs_schedule() { const QDjangoQuerySet<Schedule> schedule_set; Schedule* schedule = schedule_set.get(QDjangoWhere("id", QDjangoWhere::Equals, 2)); Schedule* schedule2 = ModelAPIs::Instance()->schedule(2); QCOMPARE(schedule->start(), schedule2->start()); }
void GroupsWidget::on_groupsTW_doubleClicked(const QModelIndex& index) { FUNCTION Group* group = _groups.at(index.row()); Normal* normal = QDjangoQuerySet<Normal>().get(QDjangoWhere("group_id", QDjangoWhere::Equals, 1)); GroupEditDialog* ged = new GroupEditDialog(group, normal, this); connect(ged, SIGNAL(finished(int)), this, SLOT(renderData())); ged->show(); }
void GroupsWidget::renderData() { FUNCTION QDjangoQuerySet<Group> gqs = QDjangoQuerySet<Group>().all(); ui->groupsTW->setRowCount(gqs.size()); for(qint32 i = 0; i < gqs.size(); ++i) { Group* group = gqs.at(i); _groups.append(group); QTableWidgetItem* item0 = new QTableWidgetItem(group->name()); Normal* normal = QDjangoQuerySet<Normal>().get(QDjangoWhere("group_id", QDjangoWhere::Equals, group->pk())); QTableWidgetItem* item1 = new QTableWidgetItem(QString::number(normal->speed())); qint32 userCount = QDjangoQuerySet<User>().filter(QDjangoWhere("group_id", QDjangoWhere::Equals, group->pk())).size(); QTableWidgetItem* item2 = new QTableWidgetItem(QString::number(userCount)); ui->groupsTW->setItem(i, 0, item0); ui->groupsTW->setItem(i, 1, item1); ui->groupsTW->setItem(i, 2, item2); } }
/** Test empty where clause. */ void tst_QDjangoWhere::emptyWhere() { // construct empty where clause QDjangoWhere testQuery; QCOMPARE(testQuery.isAll(), true); QCOMPARE(testQuery.isNone(), false); CHECKWHERE(testQuery, QString(), QVariantList()); // negate the where clause testQuery = !QDjangoWhere(); QCOMPARE(testQuery.isAll(), false); QCOMPARE(testQuery.isNone(), true); CHECKWHERE(testQuery, QLatin1String("1 != 0"), QVariantList()); }
void tst_QDjangoCompiler::resolve() { QSqlDatabase db = QDjango::database(); QDjangoCompiler compiler("Owner", db); QDjangoWhere where("name", QDjangoWhere::Equals, "foo"); compiler.resolve(where); CHECKWHERE(where, QLatin1String("\"owner\".\"name\" = ?"), QVariantList() << "foo"); QCOMPARE(compiler.fromSql(), QLatin1String("\"owner\"")); compiler = QDjangoCompiler("Owner", db); where = QDjangoWhere("item1__name", QDjangoWhere::Equals, "foo"); compiler.resolve(where); CHECKWHERE(where, QLatin1String("T0.\"name\" = ?"), QVariantList() << "foo"); QCOMPARE(compiler.fromSql(), QLatin1String("\"owner\" INNER JOIN \"item\" T0 ON T0.\"id\" = \"owner\".\"item1_id\"")); compiler = QDjangoCompiler("Owner", db); where = QDjangoWhere("item1__name", QDjangoWhere::Equals, "foo") && QDjangoWhere("item2__name", QDjangoWhere::Equals, "bar"); compiler.resolve(where); CHECKWHERE(where, QLatin1String("T0.\"name\" = ? AND T1.\"name\" = ?"), QVariantList() << "foo" << "bar"); QCOMPARE(compiler.fromSql(), QLatin1String("\"owner\" INNER JOIN \"item\" T0 ON T0.\"id\" = \"owner\".\"item1_id\" INNER JOIN \"item\" T1 ON T1.\"id\" = \"owner\".\"item2_id\"")); }
QDjangoWhere QDjangoWhereFromScriptValue(QScriptEngine *engine, const QScriptValue &obj) { if (obj.prototype().equals(engine->defaultPrototype(qMetaTypeId<QDjangoWhere>()))) { return engine->fromScriptValue<QDjangoWhere>(obj); } QDjangoWhere where; QScriptValueIterator it(obj); while (it.hasNext()) { it.next(); QString key = it.name(); QDjangoWhere::Operation op = QDjangoWhere::Equals; if (key.endsWith(QLatin1String("__lt"))) { key.chop(4); op = QDjangoWhere::LessThan; } else if (key.endsWith(QLatin1String("__lte"))) { key.chop(5); op = QDjangoWhere::LessOrEquals; } else if (key.endsWith(QLatin1String("__gt"))) { key.chop(4); op = QDjangoWhere::GreaterThan; } else if (key.endsWith(QLatin1String("__gte"))) { key.chop(5); op = QDjangoWhere::GreaterOrEquals; } else if (key.endsWith(QLatin1String("__startswith"))) { key.chop(12); op = QDjangoWhere::StartsWith; } else if (key.endsWith(QLatin1String("__endswith"))) { key.chop(10); op = QDjangoWhere::EndsWith; } else if (key.endsWith(QLatin1String("__contains"))) { key.chop(10); op = QDjangoWhere::Contains; } else if (key.endsWith(QLatin1String("__in"))) { key.chop(4); op = QDjangoWhere::IsIn; } where = where && QDjangoWhere(key, op, it.value().toVariant()); } return where; }
void NouveauxProduitsDialog::on_btAjouter_clicked() { QString code = edCode->text(); QString constructeur = edConstructeur->text(); QString nom = edNom->text(); QString description = edDescription->text(); QString categorie = cbCategorie->currentText(); double prixUnitaire = sbPrixUnitaire->value(); if( code == "" || constructeur == "" || nom == "" || description == "" ) { QMessageBox::warning( this, "Informations incomplètes", "Vous devez renseigner toutes les informations" ); show(); } else if( existe( code ) ) { QMessageBox::warning( this, "Informations dupliquées", "Un produit portant le code " + code + " existe déjà\n" "Veuillez en renseigner un autre" ); edCode->setFocus(); edCode->selectAll(); show(); } else { emit produitAjoute( true ); Core::TypeProduit *t = types.get( QDjangoWhere( "libelle", QDjangoWhere::Equals, categorie ) ); Core::Temp *p = new Core::Temp(); p->setCode( code ); p->setConstructeur( constructeur ); p->setNom( nom ); p->setDescription( description ); p->setType( t ); p->setPrixUnitaire( prixUnitaire ); p->save(); produitsModel->select(); effacerChamps(); } }
//! When a Patient is clicked those informations is showed in a QTableWidget void Patient::on_lw_filtredPatients_itemClicked(QListWidgetItem* item) { QDjangoQuerySet<Paciente> ptPront; ptPront = ptPront.filter(QDjangoWhere("nameP", QDjangoWhere::Equals, ui->lw_filtredPatients->currentItem()->text())); for(int i = 0; i < ptPront.count(); ++i){ QString t; QSqlQuery s; s.prepare("SELECT pront FROM sae.paciente WHERE nameP = :name"); s.bindValue(":name", ui->lw_filtredPatients->currentItem()->text()); s.exec(); while (s.next()){ t = s.value(0).toString(); } ui->tblW_selectedPatient->setItem(0, 0, new QTableWidgetItem(t)); ui->tblW_selectedPatient->setItem(0, 1, new QTableWidgetItem(ptPront.at(i)->rg())); ui->tblW_selectedPatient->setItem(0, 2, new QTableWidgetItem(ptPront.at(i)->dBornP().toString("dd / MM / yyyy"))); ui->tblW_selectedPatient->setItem(0, 3, new QTableWidgetItem(ptPront.at(i)->mailP())); ui->tblW_selectedPatient->setItem(0, 4, new QTableWidgetItem(ptPront.at(i)->ethn())); } }
/* * Чтение и подгрузка из БД требований. */ void BF_AnalizeForm::fillRequirements(const QString &type, QListWidget *lwgt) { lwgt->clear(); QDjango::setDatabase(*Core::Base::instance().sessionDatabase()); QDjangoQuerySet<RequirementElement> someRequirementElements; someRequirementElements = someRequirementElements.filter( QDjangoWhere("type", QDjangoWhere::Equals, type)); // retrieve usernames and passwords for matching users as maps QList<QVariantMap> propertyMaps = someRequirementElements.values( QStringList() << "id" << "type" << "name"); foreach (const QVariantMap &propertyList, propertyMaps) { QString tmp = QString("%1:%2%3-%4") .arg(propertyList["id"].toString()) .arg(propertyList["type"].toString()) .arg(propertyList["id"].toString()) .arg(propertyList["name"].toString()); lwgt->addItem(tmp); }
void TestShares::testFile() { // create a file File file; file.setDate(QDateTime(QDate(2010, 6, 1), QTime(10, 5, 14))); file.setHash(QByteArray("\0\1\2\3\4", 5)); file.setPath("foo/bar.txt"); file.setSize(1234); QCOMPARE(file.save(), true); File *other = QDjangoQuerySet<File>().get(QDjangoWhere("path", QDjangoWhere::Equals, "foo/bar.txt")); QVERIFY(other != 0); QCOMPARE(other->date(), QDateTime(QDate(2010, 6, 1), QTime(10, 5, 14))); QCOMPARE(other->hash(), QByteArray("\0\1\2\3\4", 5)); QCOMPARE(other->path(), QLatin1String("foo/bar.txt")); QCOMPARE(other->size(), qint64(1234)); delete other; // update the file file.setSize(5678); QCOMPARE(file.save(), true); }
void TestModels::test_ModelAPIs_unit() { // // get an existing user // other = users.get(QDjangoWhere("username", QDjangoWhere::Equals, "foouser")); // QVERIFY(other != 0); // QCOMPARE(other->username(), QLatin1String("foouser")); // QCOMPARE(other->password(), QLatin1String("foopass")); const QDjangoQuerySet<Unit> units_set; Unit* unit = units_set.get(QDjangoWhere("name", QDjangoWhere::Equals, "second")); //qDebug() << unit->name(); Unit* unit2; unit2 = ModelAPIs::unit("second"); QCOMPARE(unit->name(), unit2->name()); // There is no element. Unit* unit3; unit3 = ModelAPIs::unit("no_exist"); QVERIFY(unit3 == 0); }
PromissionModel::PromissionModel() { QDjango::setDatabase(*Core::Base::instance().sessionDatabase()); QDjango::registerModel<Promission>(); QDjango::createTables(); // Создаем роль по-умолчанию QDjangoQuerySet<Role> roles; roles = roles.filter(QDjangoWhere("name", QDjangoWhere::Equals, "Admin")); if (roles.count()==0) { messageLibrary msg; msg.createInfoMessage("Информация", "Роль администратора отсутствует, разрешения по-умолчанию создать не могу!"); } else { addPromission( tr("Возможность смотреть документацию приложения"), "CAN_SEE_APP_DOCS", "CONST", roles.at(0) ); addPromission( tr("Возможность смотреть настройки приложения"), "CAN_SEE_APP_SETTINGS", "CONST", roles.at(0) ); addPromission( tr("Возможность смотреть меню плагинов приложения"), "CAN_SEE_MANAGERS_MENU", "CONST", roles.at(0) ); addPromission( tr("Возможность управлять настройками плагинов"), "CAN_SEE_MANAGERS_SETTINGS", "CONST", roles.at(0) ); addPromission( tr("Возможность работать с панелями плагинов"), "CAN_SEE_MANAGERS_TOOLBAR", "CONST", roles.at(0) ); addPromission( tr("Возможность работать с элементами управления плагина на уровне 0"), "CAN_SEE_MANAGER_CONROLS_LEVEL_0", "CONST", roles.at(0) ); addPromission( tr("Возможность работать с элементами управления плагина на уровне 1"), "CAN_SEE_MANAGER_CONROLS_LEVEL_1", "CONST", roles.at(0) ); addPromission( tr("Возможность работать с элементами управления плагина на уровне 2"), "CAN_SEE_MANAGER_CONROLS_LEVEL_2", "CONST", roles.at(0) ); addPromission( tr("Возможность работать с элементами управления плагина на уровне 0"), "CAN_SEE_MODULES_CONROLS_LEVEL_0", "CONST", roles.at(0) ); addPromission( tr("Возможность работать с элементами управления плагина на уровне 1"), "CAN_SEE_MODULES_CONROLS_LEVEL_1", "CONST", roles.at(0) ); addPromission( tr("Возможность работать с элементами управления плагина на уровне 2"), "CAN_SEE_MODULES_CONROLS_LEVEL_2", "CONST", roles.at(0) ); addPromission( tr("Возможность смотреть меню модулей приложения"), "CAN_SEE_MODULES_MENU", "CONST", roles.at(0) ); addPromission( tr("Возможность смотреть настройки модулей приложения"), "CAN_SEE_MODULES_SETTINGS", "CONST", roles.at(0) ); addPromission( tr("Возможность смотреть панели модулей приложения"), "CAN_SEE_MODULES_TOOLBAR", "CONST", roles.at(0) ); addPromission( tr("Возможность работать в отладочном режиме"), "DEBUG_MODE", "CONST", roles.at(0) ); } }
/** Test "contains" comparison. */ void tst_QDjangoWhere::contains() { QDjangoWhere testQuery = QDjangoWhere("name", QDjangoWhere::Contains, "abc"); CHECKWHERE(testQuery, QLatin1String("name LIKE ? ESCAPE ?"), QVariantList() << "%abc%" << "\\"); }