CoreBOSBB
The QueryGenerator class - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4)
+--- Thread: The QueryGenerator class (/showthread.php?tid=686)



The QueryGenerator class - Guido1982 - 07-17-2017

Looking at the code from this PR, I saw a class called QueryGenerator that could save me coding I think. Can anyone explain a bit about this class?


RE: The QueryGenerator class - joebordes - 07-17-2017

QueryGenerator class is a very powerful query abstraction capable of generating very complex SQL for any module in the system.
At a very high level it is:
- instantiate against a module
- indicate the fields you want
- indicate the conditons
- ask for the SQL

Look at the unit test for some examples:
https://github.com/tsolucio/coreBOSTests/blob/master/include/QueryGenerator/QueryGeneratorTest.php


RE: The QueryGenerator class - Guido1982 - 07-24-2017

Cool, I've skimmed through it. Seems like a wrapper for complex queries yes. Does it also take into account address tables for modules like accounts, salesorders etc.?


RE: The QueryGenerator class - joebordes - 07-24-2017

Yes, it does!

I just added a couple of tests:

https://github.com/tsolucio/coreBOSTests/commit/f8b33ae6366169476403b6acd3150f1b21f1e47c


RE: The QueryGenerator class - Guido1982 - 07-25-2017

Cool, check out this function in my Schedular module, where I wrote a whole query function (which is not perfect yet). I think I could simplify this by using the Query Generator.


RE: The QueryGenerator class - joebordes - 07-25-2017

wow! definitely, this class can help there :-)

Patience, I learned about a condition class for events this past week that exists in the code for over 6 years!!


RE: The QueryGenerator class - Guido1982 - 07-26-2017

Cool, I'll wait a bit for that then.


RE: The QueryGenerator class - joebordes - 07-26-2017

Sorry, I didn't express myself correctly nor understood that you need help.

I meant that I found a class while I was documenting that I didn't know existed, still, after all this time. It is not related to query generator.

If you need help with QG, let me know.


RE: The QueryGenerator class - Guido1982 - 07-26-2017

No problem, I understood kind of what you meant, but thought I could use the class in my AJAX function. Anyway I'll get back here if I need help on the QG class.