git-svn-id: https://samskivert.googlecode.com/svn/trunk@2334 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -89,10 +89,6 @@ public abstract class FindAllQuery<T extends PersistentRecord>
|
|||||||
_builder.newQuery(new SelectClause<T>(_type, _marsh.getPrimaryKeyFields(), _clauses));
|
_builder.newQuery(new SelectClause<T>(_type, _marsh.getPrimaryKeyFields(), _clauses));
|
||||||
PreparedStatement stmt = _builder.prepare(conn);
|
PreparedStatement stmt = _builder.prepare(conn);
|
||||||
try {
|
try {
|
||||||
if (PersistenceContext.DEBUG) {
|
|
||||||
log.info("KEY QUERY: " + stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
ResultSet rs = stmt.executeQuery();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
Key<T> key = _marsh.makePrimaryKey(rs);
|
Key<T> key = _marsh.makePrimaryKey(rs);
|
||||||
@@ -145,10 +141,6 @@ public abstract class FindAllQuery<T extends PersistentRecord>
|
|||||||
|
|
||||||
// and execute it
|
// and execute it
|
||||||
try {
|
try {
|
||||||
if (PersistenceContext.DEBUG) {
|
|
||||||
log.info("VALUE QUERY: " + stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
ResultSet rs = stmt.executeQuery();
|
||||||
int cnt = 0, dups = 0;
|
int cnt = 0, dups = 0;
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
@@ -201,10 +193,6 @@ public abstract class FindAllQuery<T extends PersistentRecord>
|
|||||||
List<T> result = new ArrayList<T>();
|
List<T> result = new ArrayList<T>();
|
||||||
PreparedStatement stmt = _builder.prepare(conn);
|
PreparedStatement stmt = _builder.prepare(conn);
|
||||||
try {
|
try {
|
||||||
if (PersistenceContext.DEBUG) {
|
|
||||||
log.info("QUERY: " + stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
ResultSet rs = stmt.executeQuery();
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
result.add(_marsh.createObject(rs));
|
result.add(_marsh.createObject(rs));
|
||||||
|
|||||||
@@ -68,10 +68,6 @@ public class FindOneQuery<T extends PersistentRecord>
|
|||||||
{
|
{
|
||||||
PreparedStatement stmt = _builder.prepare(conn);
|
PreparedStatement stmt = _builder.prepare(conn);
|
||||||
try {
|
try {
|
||||||
if (PersistenceContext.DEBUG) {
|
|
||||||
log.info("KEY QUERY: " + stmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
T result = null;
|
T result = null;
|
||||||
ResultSet rs = stmt.executeQuery();
|
ResultSet rs = stmt.executeQuery();
|
||||||
if (rs.next()) {
|
if (rs.next()) {
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ import com.samskivert.jdbc.depot.annotation.FullTextIndex;
|
|||||||
import com.samskivert.jdbc.depot.annotation.GeneratedValue;
|
import com.samskivert.jdbc.depot.annotation.GeneratedValue;
|
||||||
import com.samskivert.jdbc.depot.clause.QueryClause;
|
import com.samskivert.jdbc.depot.clause.QueryClause;
|
||||||
|
|
||||||
|
import static com.samskivert.jdbc.depot.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* At the heart of Depot's SQL generation, this object constructs two {@link ExpressionVisitor}
|
* At the heart of Depot's SQL generation, this object constructs two {@link ExpressionVisitor}
|
||||||
* objects and executes them, one after another; the first one constructs SQL as it recurses, the
|
* objects and executes them, one after another; the first one constructs SQL as it recurses, the
|
||||||
@@ -88,6 +90,11 @@ public abstract class SQLBuilder
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Failed to find SQL parameters", e);
|
throw new RuntimeException("Failed to find SQL parameters", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PersistenceContext.DEBUG) {
|
||||||
|
log.info("SQL: " + stmt.toString());
|
||||||
|
}
|
||||||
|
|
||||||
return stmt;
|
return stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user