You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2012/02/25 23:38:53 UTC
svn commit: r1293710 - in
/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db:
DBCmdParam.java DBCommand.java
Author: doebele
Date: Sat Feb 25 22:38:53 2012
New Revision: 1293710
URL: http://svn.apache.org/viewvc?rev=1293710&view=rev
Log: (empty)
Modified:
empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCmdParam.java
empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCmdParam.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCmdParam.java?rev=1293710&r1=1293709&r2=1293710&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCmdParam.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCmdParam.java Sat Feb 25 22:38:53 2012
@@ -22,20 +22,38 @@ import java.util.Set;
import org.apache.empire.data.DataType;
+/**
+ * This class defines a parameter for a prepared statement query.
+ * Do not create instances of this class yourself, rather use DBCommand.addParam(...)
+ * @author Rainer
+ */
public class DBCmdParam extends DBExpr
{
private final static long serialVersionUID = 1L;
protected DBCommand cmd;
protected DataType type;
protected Object value;
-
+
+ /**
+ * Protected constructor used e.g. by DBCommand.addParam(...)
+ * @param cmd the command to which this DBCommand belongs to
+ * @param type the parameter data type
+ * @param value the initial value (can be changed any time by calling setValue(...))
+ */
protected DBCmdParam(DBCommand cmd, DataType type, Object value)
{
this.cmd = cmd;
this.type = type;
this.value = getCmdParamValue(value);
}
-
+
+ /**
+ * Returns the internal parameter value for a given "real" value.
+ * Depending on the data type this might involve wrapping the real value with another class.
+ * This is done e.g. for CLOBs and BLOBs
+ * @param the "real" value
+ * @return the (possibly wrapped) value
+ */
protected Object getCmdParamValue(Object value)
{
switch (type)
@@ -84,16 +102,29 @@ public class DBCmdParam extends DBExpr
return cmd.getDatabase();
}
+ /**
+ * Returns the data type of the command parameter
+ * @return the data type
+ */
public DataType getDataType()
{
return type;
}
+ /**
+ * Returns the current value of the parameter.
+ * In some cases (as for CLOBs and BLOBs) this might return a Wrapper class for the underlying value.
+ * @return the current (possibly wrapped) value
+ */
public Object getValue()
{
return value;
}
+ /**
+ * Sets the current value of the parameter
+ * @param value the new value
+ */
public void setValue(Object value)
{
this.value = getCmdParamValue(value);
Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java?rev=1293710&r1=1293709&r2=1293710&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/db/DBCommand.java Sat Feb 25 22:38:53 2012
@@ -60,7 +60,7 @@ public abstract class DBCommand extends
protected List<DBCompareExpr> having = null;
protected List<DBColumnExpr> groupBy = null;
// Parameters for prepared Statements
- protected Vector<DBCmdParam> cmdParams = null;
+ protected Vector<DBCmdParam> cmdParams = null;
private int paramUsageCount= 0;
// Database
private DBDatabase db;