com.caucho.amber.query
Class UserQuery

java.lang.Object
  extended by com.caucho.amber.query.UserQuery
All Implemented Interfaces:
AmberQuery

public class UserQuery
extends java.lang.Object
implements AmberQuery

Represents the application's view of the query.


Constructor Summary
UserQuery(AbstractQuery query)
           
 
Method Summary
 java.sql.ResultSet executeQuery()
          Executes the query returning a result set.
 int executeUpdate()
          Executes the query returning a result set.
 AmberConnection getConnection()
           
 int getMaxResults()
          Returns the max results.
 AbstractQuery getQuery()
          Returns the compiled query.
 java.lang.String getQueryString()
          Returns the query string.
 AmberConnection getSession()
           
 java.lang.Object getSingleResult()
          Executes the query returning the single result.
 void init(AmberConnection aConn)
          Initialize with the connection.
 java.util.List<java.lang.Object> list()
          Executes the query, returning a list.
 void list(java.util.List<java.lang.Object> list)
          Executes the query, filling the list.
 void list(java.util.Map<java.lang.Object,java.lang.Object> map, java.lang.reflect.Method methodGetMapKey)
          Executes the query, filling the map.
 void setByte(int index, byte v)
          Sets the argument with a byte
 void setCacheMaxAge(long ms)
          Sets the cache max age for the query.
 void setDate(int index, java.sql.Date v)
          Sets the argument with a date
 void setDouble(int index, double v)
          Sets the argument with a double
 void setFirstResult(int index)
          Sets the first result.
 void setFloat(int index, float v)
          Sets the argument with a double
 void setInt(int index, int v)
          Sets the argument with an int
 void setLoadOnQuery(boolean loadOnQuery)
          Sets true for load-on-query.
 void setLong(int index, long v)
          Sets the argument with a string
 void setMaxResults(int index)
          Sets the maximum number of results.
 void setNull(int index, int v)
          Sets the argument with a null
 void setObject(int index, java.lang.Object v)
          Sets the argument with an object.
 void setObject(int index, java.lang.Object v, AmberType type)
          Sets the argument with an object and its Amber type.
 void setSession(AmberConnection aConn)
           
 void setShort(int index, short v)
          Sets the argument with a short
 void setString(int index, java.lang.String v)
          Sets the argument with a string
 void setTimestamp(int index, java.sql.Timestamp v)
          Sets the argument with a timestamp
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserQuery

public UserQuery(AbstractQuery query)
Method Detail

getQueryString

public java.lang.String getQueryString()
Returns the query string.

Specified by:
getQueryString in interface AmberQuery

init

public void init(AmberConnection aConn)
Description copied from interface: AmberQuery
Initialize with the connection.

Specified by:
init in interface AmberQuery

setSession

public void setSession(AmberConnection aConn)

getSession

public AmberConnection getSession()

getConnection

public AmberConnection getConnection()

setLoadOnQuery

public void setLoadOnQuery(boolean loadOnQuery)
Sets true for load-on-query.

Specified by:
setLoadOnQuery in interface AmberQuery

getQuery

public AbstractQuery getQuery()
Returns the compiled query.


setString

public void setString(int index,
                      java.lang.String v)
Sets the argument with a string

Specified by:
setString in interface AmberQuery

setByte

public void setByte(int index,
                    byte v)
Sets the argument with a byte

Specified by:
setByte in interface AmberQuery

setShort

public void setShort(int index,
                     short v)
Sets the argument with a short

Specified by:
setShort in interface AmberQuery

setInt

public void setInt(int index,
                   int v)
Sets the argument with an int

Specified by:
setInt in interface AmberQuery

setLong

public void setLong(int index,
                    long v)
Sets the argument with a string

Specified by:
setLong in interface AmberQuery

setDouble

public void setDouble(int index,
                      double v)
Sets the argument with a double

Specified by:
setDouble in interface AmberQuery

setFloat

public void setFloat(int index,
                     float v)
Sets the argument with a double

Specified by:
setFloat in interface AmberQuery

setTimestamp

public void setTimestamp(int index,
                         java.sql.Timestamp v)
Sets the argument with a timestamp

Specified by:
setTimestamp in interface AmberQuery

setDate

public void setDate(int index,
                    java.sql.Date v)
Sets the argument with a date

Specified by:
setDate in interface AmberQuery

setObject

public void setObject(int index,
                      java.lang.Object v)
Sets the argument with an object.

Specified by:
setObject in interface AmberQuery

setObject

public void setObject(int index,
                      java.lang.Object v,
                      AmberType type)
Sets the argument with an object and its Amber type.


setNull

public void setNull(int index,
                    int v)
Sets the argument with a null

Specified by:
setNull in interface AmberQuery

setFirstResult

public void setFirstResult(int index)
Sets the first result.

Specified by:
setFirstResult in interface AmberQuery

setMaxResults

public void setMaxResults(int index)
Sets the maximum number of results.

Specified by:
setMaxResults in interface AmberQuery

getMaxResults

public int getMaxResults()
Returns the max results.


executeQuery

public java.sql.ResultSet executeQuery()
                                throws java.sql.SQLException
Executes the query returning a result set.

Specified by:
executeQuery in interface AmberQuery
Throws:
java.sql.SQLException

executeUpdate

public int executeUpdate()
                  throws java.sql.SQLException
Executes the query returning a result set.

Specified by:
executeUpdate in interface AmberQuery
Throws:
java.sql.SQLException

setCacheMaxAge

public void setCacheMaxAge(long ms)
Sets the cache max age for the query.

Specified by:
setCacheMaxAge in interface AmberQuery

list

public java.util.List<java.lang.Object> list()
                                      throws java.sql.SQLException
Executes the query, returning a list.

Specified by:
list in interface AmberQuery
Throws:
java.sql.SQLException

getSingleResult

public java.lang.Object getSingleResult()
                                 throws java.sql.SQLException
Executes the query returning the single result.

Specified by:
getSingleResult in interface AmberQuery
Throws:
java.sql.SQLException

list

public void list(java.util.List<java.lang.Object> list)
          throws java.sql.SQLException
Executes the query, filling the list.

Specified by:
list in interface AmberQuery
Throws:
java.sql.SQLException

list

public void list(java.util.Map<java.lang.Object,java.lang.Object> map,
                 java.lang.reflect.Method methodGetMapKey)
          throws java.sql.SQLException,
                 java.lang.IllegalAccessException,
                 java.lang.reflect.InvocationTargetException
Executes the query, filling the map.

Specified by:
list in interface AmberQuery
Throws:
java.sql.SQLException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object