I have a DB interface as well as a wrapper (for specific Db engines), let's start with MySQL.
First off is a code question: can I return an "interface" as an object and within the specific DB result wrapper, as long as it implements the functions still use that result?
IE, does the following work:
Code: Select all
public class MySQL implements DBConnection
public function query($sql) {
return new DBResult(mysql_query($sql));
}
}
.....
public interface DBResult {
public function __construct($queryResource);
}
public class MySQL_DBResult implements DBResult {
}