Very often it is much better to delegate the responsibility for manipulating database result sets to a separated class, rather that assigning these tasks to the same class that connects to MySQL. That’s the primary reason for the existence of the “Result” class. However, don’t be concerned about it. It only takes care of fetching data, counting table rows and other result-related operations. Here is the proper list for the “Result” class: class Result{ Although the methods belonging to the above class might be appended to the MySQL class, it’s much more efficient having a separated structure that accomplishes all of the row-related operations. So, as you can see, this class allows us to fetch rows, count result rows, and even get the ID from the last inserted record. Of course, more methods may be eventually added, useful for improving the functionality within the class. But, as I said before, we’ll keep it simple. By this point, we’ve covered in detail each class that interacts with “Cache.” The next step is putting all of the pieces together and demonstrating a practical example.
blog comments powered by Disqus |