oop - Objects with recursive properties in php -


i'm using class, moduleselectquery, generate sql queries in php.

basically, class breaks individual components of sql select query, such table name, fields select, conditions, etc.

however, becomes complicated nested queries, such where table1.field1 in (select table2.field2 table2 table2.field3 = criteria)

currently have property moduleselectquery called $inwhereclause used store where... in(select...) clause. other properties (i.e. $tablename, $whereclause, $havingclause), parsed own function based on user input.

however, parsing function fundamentally limited. if devote enough effort parsing $whereclause property, can't have additional nested select statements.

i think 1 way set $inwhereclause moduleselectquery object. mean parent moduleselectquery have property moduleselectquery, i.e. recursive object. possible/good practice in php? there other drawbacks?

i see being possible solution. visualize having person class. person might have child, person. doesn't seem unreasonable.

i wouldn't call recursive object, object doesn't reference itself, rather object can have property instance of same class.

it would, need nested appropriately, sub-queries in statement need moduleselectquery object, simple comparisons instances of strings, or integers.

the drawbacks can arrive approach in design of class, , methods. not see glaring performance issues, or maintainability issues.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -