Author: tv Date: Sun Aug 26 17:33:13 2012 New Revision: 1377468 URL: http://svn.apache.org/viewvc?rev=1377468&view=rev Log: Add missing methods to make the API orthogonal.
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java?rev=1377468&r1=1377467&r2=1377468&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java (original) +++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/BasePeerImpl.java Sun Aug 26 17:33:13 2012 @@ -1199,6 +1199,45 @@ public class BasePeerImpl<T> implements * Selects rows from a database an maps them to objects. * * @param query the sql query to execute, not null. + * + * @return The results of the query, not null. + * + * @throws TorqueException if querying the database fails. + */ + public List<T> doSelect(String query) + throws TorqueException + { + return doSelect( + query, + getRecordMapper(), + getDatabaseName()); + } + + /** + * Selects rows from a database an maps them to objects. + * + * @param query the SQL Query to execute, not null. + * @param connection the database connection, not null. + * + * @return The results of the query, not null. + * + * @throws TorqueException if querying the database fails. + */ + public List<T> doSelect( + String query, + Connection connection) + throws TorqueException + { + return doSelect( + query, + getRecordMapper(), + connection); + } + + /** + * Selects rows from a database an maps them to objects. + * + * @param query the sql query to execute, not null. * @param mapper The mapper creating the objects from the resultSet, * not null. * @param dbName The name of the database to create the connection for, @@ -1214,14 +1253,13 @@ public class BasePeerImpl<T> implements String dbName) throws TorqueException { - if (dbName == null) - { - dbName = Torque.getDefaultDB(); - } Connection connection = null; + try { - connection = Transaction.begin(dbName); + connection = Transaction.begin((dbName == null) ? + Torque.getDefaultDB() : + dbName); List<TT> result = doSelect( query, --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscr...@db.apache.org For additional commands, e-mail: torque-dev-h...@db.apache.org