The answer is that you probably DO NOT WANT to return all rows of a table. You would probably be better served returning the statement handle to the caller for iteration. Otherwise you are going to load an entire table into memory when you might not actually have the need to do that in your program. This might not be a problem if all your tables do not hold that much data, but would certainly be a memory hog as soon as you start doing this on larger tables.
For example if you are going to simply output the entire table data to a browser client, and let's say you you have a table that have 1000 rows each averaging 1kB of data. You would have to read 1MB of data into memory if you use you approach vs. only having to hold an average of 1 kB in memory if you let the caller iterate through the result set.