Such as:
select * from blog,author where blog.author_id = author.author_id and author.name like '%xxx%'
select * from blog,author where blog.author_id = author.author_id and author.name like '%xxx%'
QSqlError daoError = qx::dao::fetch_by_query_with_relation("author", qx_query().where("author.name").like("xxx"), my_blog);
QxOrm admin wrote:select * from blog,author where blog.author_id = author.author_id and author.name like '%xxx%'
Just write something like this :
- Code: Select all
QSqlError daoError = qx::dao::fetch_by_query_with_relation("author", qx_query().where("author.name").like("xxx"), my_blog);
qx::QxSqlQuery query;
query.where("AccountGroup.name").like(groupName)
.and_("AccountType.name").like(typeName);
AccountList accountList;
daoError = qx::dao::fetch_by_query_with_all_relation(query, accountList);
qx::QxSqlQuery query;
query.where("AccountGroup_1.name").like(groupName)
.and_("AccountType_2.name").like(typeName);
How about your opinion?
qx_query query = qx_query().where("AccountGroup_1.name").like(groupName).and_("AccountType_2.name").like(typeName);
QxOrm admin wrote:How about your opinion?
You are right, it needs to be improved
It will be a part of the improvment of relationships for the next version of QxOrm library (1.2.3)...
With current version, it will work with the following code, so you can use it :
- Code: Select all
qx_query query = qx_query().where("AccountGroup_1.name").like(groupName).and_("AccountType_2.name").like(typeName);
How long will QxOrm library (1.2.3) be released?
QxOrm admin wrote:Hi,
You can try this BETA version of QxOrm library (1.2.3 BETA 07) :
http://www.qxorm.com/version/QxOrm_1.2.3_BETA_07.zip
There is a fix to replace automatically your table name with the alias into your query...
is there any "readme" about this update?
FROM "Process"
LEFT OUTER JOIN "ProcessType" "ProcessType_1" ON "ProcessType_1"."id" = "Process"."process_type_id"
LEFT OUTER JOIN "Company" "Company_2" ON "Company_2"."id" = "Process"."owner_id"
LEFT OUTER JOIN "Company" "Company_3" ON "Company_3"."id" = "Process"."so_id"
LEFT OUTER JOIN "ProcessObject" "ProcessObject_4" ON "Process"."id" = "ProcessObject_4"."process_id"
LEFT OUTER JOIN "Object" "Object_4" ON "ProcessObject_4"."object_id" = "Object_4"."id"
LEFT OUTER JOIN "Document" "Document_8" ON "Document_8"."object_id" = "Object_4"."id"
LEFT OUTER JOIN "File" "File_12" ON "File_12"."document_id" = "Document_8"."id"
LEFT OUTER JOIN "Document" "Document_13" ON "Document_13"."process_id" = "Process"."id"
LEFT OUTER JOIN "File" "File_17" ON "File_17"."document_id" = "Document_13"."id"
WHERE ProcessType.short_name = :ProcessType_short_name_1_0
AND ObjectType.short_name = :ObjectType_short_name_3_0
QSqlError ProcessDAO::read_by_type_and_objtype_with_relations(Process_list& proc, const QString& ptype, const QString& objtype)
{
const QStringList ProcessDAO::relations(
QStringList()
<< "process_type_id"
<< "owner_id"
<< "so_id"
<< "Object_list->Document_list->File_list"
<< "Document_list->File_list");
qx::QxSqlQuery query;
query.where("ProcessType.short_name").isEqualTo(ptype)
.and_("ObjectType.short_name").isEqualTo(objtype);
return qx::dao::fetch_by_query_with_relation(relations, query, proc);
}
Users browsing this forum: No registered users and 4 guests