Page 1 of 1

IxSqlRelation Error

PostPosted: Tue Jan 17, 2017 3:22 pm
by Kasuax
I setup a scenario where I would fetch my project tree back from the database. The nature of my objects were intentionally setup with a circular reference where (A -> B -> C -> A). I ended up finding the following foreign key relation bug? Posting screenshot and stack trace. Let me know if you have any ideas. Thanks!

Code: Select all
1  qt_message_output                                                                                   qglobal.cpp                                 2347 0x66d4b94d
2  qt_message                                                                                          qglobal.cpp                                 2405 0x66d4bac9
3  qFatal                                                                                              qglobal.cpp                                 2588 0x66d4beb9
4  qt_assert                                                                                           qglobal.cpp                                 2054 0x66d4b489
5  qx::IxSqlRelation::eagerSelect_OneToMany                                                            IxSqlRelation.cpp                           433  0x73f45f   
6  qx::QxSqlRelation_OneToMany<QList<QSharedPointer<QXC::ComponentChannel>>,QXC::EngUnit>::eagerSelect QxSqlRelation_OneToMany.h                   112  0xf874e74 
7  qx::QxSqlRelationLinked::hierarchySelect                                                            QxSqlRelationLinked.cpp                     184  0x77e6b3   
8  qx::IxSqlQueryBuilder::sql_FetchAll_WithRelation                                                    IxSqlQueryBuilder.cpp                       283  0x72be31   
9  qx::dao::detail::QxSqlQueryHelper_FetchAll_WithRelation<QXC::EngUnit>::sql                          QxSqlQueryHelper_FetchAll_WithRelation.inl  44   0xf86fdf1 
10 qx::QxSqlQueryBuilder_FetchAll_WithRelation<QXC::EngUnit>::buildSql                                 QxSqlQueryBuilder.h                         454  0xf86eacf 
11 qx::IxSqlQueryBuilder::sql_FetchById_WithRelation                                                   IxSqlQueryBuilder.cpp                       314  0x72c4db   
12 qx::dao::detail::QxSqlQueryHelper_FetchById_WithRelation<QXC::EngUnit>::sql                         QxSqlQueryHelper_FetchById_WithRelation.inl 44   0xf86fd61 
13 qx::QxSqlQueryBuilder_FetchById_WithRelation<QXC::EngUnit>::buildSql                                QxSqlQueryBuilder.h                         483  0xf86e47d 
14 qx::dao::detail::QxDao_FetchById_WithRelation_Generic<QXC::EngUnit>::fetchById                      QxDao_FetchById_WithRelation.inl            51   0xf869e1c 
15 qx::dao::detail::QxDao_FetchById_WithRelation<QXC::EngUnit>::fetchById                              QxDao_FetchById_WithRelation.inl            222  0xf868501 
16 qx::dao::detail::QxDao_FetchById_WithRelation<QXC::EngUnit>::fetchById                              QxDao_FetchById_WithRelation.inl            213  0xf868489 
17 qx::dao::fetch_by_id_with_relation<QXC::EngUnit>                                                    QxDao.h                                     275  0xf867230 
18 QXC::EngUnit::ComponentChannelReferences                                                            QXC_EngUnit.gen.cpp                         167  0xf8646b7 
19 QXC::EngUnit::onRefreshRelationships                                                                QXC_EngUnit.cpp                             30   0xfb4b4f2 
20 QXC::Object::refreshRelationships                                                                   object.cpp                                  230  0xfb61086 
21 QXC::`anonymous namespace'::_fetchTree                                                              object.cpp                                  37   0xfb5f764 
22 QXC::`anonymous namespace'::_fetchTree                                                              object.cpp                                  48   0xfb5fba8 
23 QXC::Object::fetchTree                                                                              object.cpp                                  265  0xfb6122c 
24 recall_database                                                                                     recall_database.cpp                         20   0x10654dd 
25 main                                                                                                main.cpp                                    141  0x103a436 
26 __tmainCRTStartup                                                                                   crtexe.c                                    555  0x1093bdf 
27 mainCRTStartup                                                                                      crtexe.c                                    371  0x1093a0f 
28 BaseThreadInitThunk                                                                                 kernel32                                         0x76fd336a
29 RtlInitializeExceptionChain                                                                         ntdll                                            0x77509902
30 RtlInitializeExceptionChain                                                                         ntdll                                            0x775098d5

Re: IxSqlRelation Error

PostPosted: Wed Jan 18, 2017 8:40 pm
by qxorm
I have never seen this error before.
Are you sure this is because of circular reference ?
It is strange because in qxBlog example project in ./test/ directory of QxOrm package, there is a fetch with circular reference (using *->*->* syntax).

Re: IxSqlRelation Error

PostPosted: Mon Jan 30, 2017 6:13 pm
by Kasuax
Ok, I did some more investigation and it would appear that we had a typo in the editor when we defined this foreign key relationship.

ParentChanneLimit was supposed to be ParentChannelLimit
and EngUnits was supposed to be EngUnit

Problem Solved I think?
Maybe the messaging was too cryptic, I had to dig into the debug stack to see what it was trying to tie out.

Re: IxSqlRelation Error

PostPosted: Tue Jan 31, 2017 10:01 am
by qxorm
a typo in the editor when we defined this foreign key relationship
......
Problem Solved I think?

Great !
I hope your problem is solved too :)