Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The QueryGenerator class
#1
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?
Reply
#2
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
Joe
TSolucio
Reply
#3
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.?
Reply
#4
Yes, it does!

I just added a couple of tests:

https://github.com/tsolucio/coreBOSTests/commit/f8b33ae6366169476403b6acd3150f1b21f1e47c
Joe
TSolucio
Reply
#5
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.
Reply
#6
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!!
Joe
TSolucio
Reply
#7
Cool, I'll wait a bit for that then.
Reply
#8
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.
Joe
TSolucio
Reply
#9
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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)