In the project that I am about to complete, I wrote and implemented an object-relational mapping solution for PHP. Before the doubters and dreamers shout “how on earth?”, Relax - I have not found a way to do the late static binding work - I just work on it in the best way that I can.
In any case, I do not currently use prepared statements for queries, because I could not find a way to pass a variable number of arguments to the bind_params() or bind_result() methods.
Why do I need to maintain a variable number of arguments, you ask? Since the superclass of my models (I think my solution as a hacked PHP ActiveRecord wannabe) is where the query is defined, so the find () method, for example, does not know how many parameters it needs to bind.
Now I was thinking about creating an argument list and passing a string to eval (), but I don't really like this solution - I would rather just implement my own security checks and pass instructions.
Does anyone have any suggestions (or success stories) on how to do this? If you can help me solve this first problem, perhaps we can relate the result set (what I suspect will be more complex or at least more resource intensive if it includes the original query to determine the structure of the table).
php mysql mysqli orm
Brian warshaw
source share