summaryrefslogtreecommitdiff
path: root/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy
diff options
context:
space:
mode:
Diffstat (limited to 'projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy')
-rw-r--r--projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptor.java56
-rw-r--r--projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptorException.java28
-rw-r--r--projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCChannel.java230
-rw-r--r--projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java56
-rw-r--r--projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpression.java38
-rw-r--r--projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpressionFactory.java29
6 files changed, 248 insertions, 189 deletions
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptor.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptor.java
index ece159b..f3d848c 100644
--- a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptor.java
+++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptor.java
@@ -23,14 +23,13 @@ import net.wotonomy.access.EOModel;
import net.wotonomy.access.EOSQLExpressionFactory;
import net.wotonomy.foundation.NSDictionary;
-
/**
-* An adaptor that connects to a databaser server via JDBC.
-*
-* @author ezamudio@nasoft.com
-* @author $Author: cgruber $
-* @version $Revision: 903 $
-*/
+ * An adaptor that connects to a databaser server via JDBC.
+ *
+ * @author ezamudio@nasoft.com
+ * @author $Author: cgruber $
+ * @version $Revision: 903 $
+ */
public class JDBCAdaptor extends EOAdaptor {
protected EOSQLExpressionFactory _expressionFactory;
@@ -39,6 +38,7 @@ public class JDBCAdaptor extends EOAdaptor {
/**
* Creates a new instance.
+ *
* @param name The name of the adaptor (should always be JDBC)
*/
public JDBCAdaptor(String name) {
@@ -48,17 +48,19 @@ public class JDBCAdaptor extends EOAdaptor {
public void setConnectionDictionary(NSDictionary dict) {
super.setConnectionDictionary(dict);
if (dict.objectForKey("driver") != null)
- _driverName = (String)dict.objectForKey("driver");
+ _driverName = (String) dict.objectForKey("driver");
else
throw new JDBCAdaptorException("Connection dictionary must have a 'driver' key.", null);
if (dict.objectForKey("jdbc2Info") != null)
- _jdbcInfo = (NSDictionary)dict.objectForKey("jdbc2Info");
+ _jdbcInfo = (NSDictionary) dict.objectForKey("jdbc2Info");
else
throw new JDBCAdaptorException("Connection dictionary must have a 'jdbc2Info' key.", null);
}
- /* Checks to see if the connection dictionary is valid.
- * Throws an exception if it's not.
+ /*
+ * Checks to see if the connection dictionary is valid. Throws an exception if
+ * it's not.
+ *
* @see net.wotonomy.access.EOAdaptor#assertConnectionDictionaryIsValid()
*/
public void assertConnectionDictionaryIsValid() {
@@ -67,7 +69,9 @@ public class JDBCAdaptor extends EOAdaptor {
context.disconnect();
}
- /* Creates a JDBCContext.
+ /*
+ * Creates a JDBCContext.
+ *
* @see net.wotonomy.access.EOAdaptor#createAdaptorContext()
*/
public EOAdaptorContext createAdaptorContext() {
@@ -76,14 +80,18 @@ public class JDBCAdaptor extends EOAdaptor {
return context;
}
- /* Returns the JDBCExpression class.
+ /*
+ * Returns the JDBCExpression class.
+ *
* @see net.wotonomy.access.EOAdaptor#defaultExpressionClass()
*/
public Class defaultExpressionClass() {
return JDBCExpression.class;
}
- /* Returns a JDBCExpressionFactory.
+ /*
+ * Returns a JDBCExpressionFactory.
+ *
* @see net.wotonomy.access.EOAdaptor#expressionFactory()
*/
public EOSQLExpressionFactory expressionFactory() {
@@ -92,8 +100,11 @@ public class JDBCAdaptor extends EOAdaptor {
return _expressionFactory;
}
- /* Determines if a qualifier type is valid.
- * @see net.wotonomy.access.EOAdaptor#isValidQualifierType(java.lang.String, net.wotonomy.access.EOModel)
+ /*
+ * Determines if a qualifier type is valid.
+ *
+ * @see net.wotonomy.access.EOAdaptor#isValidQualifierType(java.lang.String,
+ * net.wotonomy.access.EOModel)
*/
public boolean isValidQualifierType(String typeName, EOModel model) {
// TODO Auto-generated method stub
@@ -110,14 +121,13 @@ public class JDBCAdaptor extends EOAdaptor {
}
/*
- * $Log$
- * Revision 1.2 2006/02/18 22:59:22 cgruber
- * make it compile with maven dependencies and add a cvsignore.
+ * $Log$ Revision 1.2 2006/02/18 22:59:22 cgruber make it compile with maven
+ * dependencies and add a cvsignore.
*
- * Revision 1.1 2006/02/16 13:22:23 cgruber
- * Check in all sources in eclipse-friendly maven-enabled packages.
+ * Revision 1.1 2006/02/16 13:22:23 cgruber Check in all sources in
+ * eclipse-friendly maven-enabled packages.
*
- * Revision 1.1 2003/08/13 20:09:37 chochos
- * a concrete implementation of EOAdaptor for use with JDBC
+ * Revision 1.1 2003/08/13 20:09:37 chochos a concrete implementation of
+ * EOAdaptor for use with JDBC
*
*/
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptorException.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptorException.java
index 5a999d0..412c0a1 100644
--- a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptorException.java
+++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCAdaptorException.java
@@ -14,19 +14,20 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see http://www.gnu.org
- */package net.wotonomy.jdbcadaptor;
+ */
+package net.wotonomy.jdbcadaptor;
import java.sql.SQLException;
import net.wotonomy.access.EOGeneralAdaptorException;
/**
-* Concrete implementation of EOSQLExpression for use with JDBC.
-*
-* @author ezamudio@nasoft.com
-* @author $Author: cgruber $
-* @version $Revision: 903 $
-*/
+ * Concrete implementation of EOSQLExpression for use with JDBC.
+ *
+ * @author ezamudio@nasoft.com
+ * @author $Author: cgruber $
+ * @version $Revision: 903 $
+ */
public class JDBCAdaptorException extends EOGeneralAdaptorException {
protected SQLException _sqlException;
@@ -55,14 +56,13 @@ public class JDBCAdaptorException extends EOGeneralAdaptorException {
}
/*
- * $Log$
- * Revision 1.2 2006/02/18 22:59:22 cgruber
- * make it compile with maven dependencies and add a cvsignore.
+ * $Log$ Revision 1.2 2006/02/18 22:59:22 cgruber make it compile with maven
+ * dependencies and add a cvsignore.
*
- * Revision 1.1 2006/02/16 13:22:23 cgruber
- * Check in all sources in eclipse-friendly maven-enabled packages.
+ * Revision 1.1 2006/02/16 13:22:23 cgruber Check in all sources in
+ * eclipse-friendly maven-enabled packages.
*
- * Revision 1.2 2003/08/13 20:11:30 chochos
- * forgot to add the wotonomy disclaimer...
+ * Revision 1.2 2003/08/13 20:11:30 chochos forgot to add the wotonomy
+ * disclaimer...
*
*/
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCChannel.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCChannel.java
index c62c463..64e4572 100644
--- a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCChannel.java
+++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCChannel.java
@@ -41,12 +41,12 @@ import net.wotonomy.foundation.NSMutableDictionary;
import net.wotonomy.foundation.NSTimestamp;
/**
-* Concrete implementation of EOAdaptorChannel for use with JDBC.
-*
-* @author ezamudio@nasoft.com
-* @author $Author: cgruber $
-* @version $Revision: 903 $
-*/
+ * Concrete implementation of EOAdaptorChannel for use with JDBC.
+ *
+ * @author ezamudio@nasoft.com
+ * @author $Author: cgruber $
+ * @version $Revision: 903 $
+ */
public class JDBCChannel extends EOAdaptorChannel {
protected boolean _fetchInProgress;
@@ -60,6 +60,7 @@ public class JDBCChannel extends EOAdaptorChannel {
/**
* Creates a new JDBCChannel.
+ *
* @param context The JDBCContext this channel belongs to.
*/
public JDBCChannel(JDBCContext context) {
@@ -67,24 +68,31 @@ public class JDBCChannel extends EOAdaptorChannel {
}
protected JDBCContext _context() {
- return (JDBCContext)adaptorContext();
+ return (JDBCContext) adaptorContext();
}
- /* Sets the attributes to be fetched from the database.
- * @see net.wotonomy.access.EOAdaptorChannel#setAttributesToFetch(net.wotonomy.foundation.NSArray)
+ /*
+ * Sets the attributes to be fetched from the database.
+ *
+ * @see net.wotonomy.access.EOAdaptorChannel#setAttributesToFetch(net.wotonomy.
+ * foundation.NSArray)
*/
public void setAttributesToFetch(NSArray atts) {
_attsToFetch = atts;
}
- /* Returns an array with the attributes that will be fetched.
+ /*
+ * Returns an array with the attributes that will be fetched.
+ *
* @see net.wotonomy.access.EOAdaptorChannel#attributesToFetch()
*/
public NSArray attributesToFetch() {
return _attsToFetch;
}
- /* Cancels the fetch, rolling back the transaction.
+ /*
+ * Cancels the fetch, rolling back the transaction.
+ *
* @see net.wotonomy.access.EOAdaptorChannel#cancelFetch()
*/
public void cancelFetch() {
@@ -98,7 +106,9 @@ public class JDBCChannel extends EOAdaptorChannel {
}
}
- /* Closes the jdbc channel.
+ /*
+ * Closes the jdbc channel.
+ *
* @see net.wotonomy.access.EOAdaptorChannel#closeChannel()
*/
public void closeChannel() {
@@ -111,9 +121,11 @@ public class JDBCChannel extends EOAdaptorChannel {
}
}
- /* If the fetch was done with an array of EOAttributes, returns
- * that same array; otherwise it creates an array of EOAttributes
- * based on the column names that will be fetched.
+ /*
+ * If the fetch was done with an array of EOAttributes, returns that same array;
+ * otherwise it creates an array of EOAttributes based on the column names that
+ * will be fetched.
+ *
* @see net.wotonomy.access.EOAdaptorChannel#describeResults()
*/
public NSArray describeResults() {
@@ -134,7 +146,7 @@ public class JDBCChannel extends EOAdaptorChannel {
a.setAllowsNull(_rsmeta.isNullable(i) == ResultSetMetaData.columnNullable);
a.setWidth(_rsmeta.getColumnDisplaySize(i));
a.setReadOnly(_rsmeta.isReadOnly(i));
- attarr[i-1] = a;
+ attarr[i - 1] = a;
}
_resultAttributes = new NSArray(attarr);
} catch (SQLException ex) {
@@ -144,9 +156,12 @@ public class JDBCChannel extends EOAdaptorChannel {
return _resultAttributes;
}
- /* Deletes from the database the rows described by the qualifier,
- * in the specified entity.
- * @see net.wotonomy.access.EOAdaptorChannel#deleteRowsDescribedByQualifier(net.wotonomy.control.EOQualifier, net.wotonomy.access.EOEntity)
+ /*
+ * Deletes from the database the rows described by the qualifier, in the
+ * specified entity.
+ *
+ * @see net.wotonomy.access.EOAdaptorChannel#deleteRowsDescribedByQualifier(net.
+ * wotonomy.control.EOQualifier, net.wotonomy.access.EOEntity)
*/
public int deleteRowsDescribedByQualifier(EOQualifier q, EOEntity entity) {
EOSQLExpression exp = adaptorContext().adaptor().expressionFactory().createExpression(entity);
@@ -155,11 +170,14 @@ public class JDBCChannel extends EOAdaptorChannel {
return _resultCount;
}
- /* Creates a java.sql.Statement object and executes it.
- * If there is an open transaction, the statement is executed inside it;
- * otherwise a transaction is started, the statement executed, and
- * the transaction is committed.
- * @see net.wotonomy.access.EOAdaptorChannel#evaluateExpression(net.wotonomy.access.EOSQLExpression)
+ /*
+ * Creates a java.sql.Statement object and executes it. If there is an open
+ * transaction, the statement is executed inside it; otherwise a transaction is
+ * started, the statement executed, and the transaction is committed.
+ *
+ * @see
+ * net.wotonomy.access.EOAdaptorChannel#evaluateExpression(net.wotonomy.access.
+ * EOSQLExpression)
*/
public void evaluateExpression(EOSQLExpression sql) {
if (!isOpen())
@@ -173,20 +191,20 @@ public class JDBCChannel extends EOAdaptorChannel {
boolean isQuery = false;
String text = sql.statement();
try {
- //run an executeUpdate with these prefixes
+ // run an executeUpdate with these prefixes
if (text.startsWith("INSERT") || text.startsWith("DELETE") || text.startsWith("UPDATE")) {
conditionalBeginTransaction();
_resultCount = _statement.executeUpdate(text);
conditionalCommitTransaction();
return;
} else if (text.startsWith("SELECT")) {
- //run an executeQuery with SELECT
+ // run an executeQuery with SELECT
if (_resultCount > 0)
_statement.setMaxRows(_resultCount);
_resultSet = _statement.executeQuery(text);
_fetchInProgress = true;
return;
- } else { //just plain execute
+ } else { // just plain execute
conditionalBeginTransaction();
isQuery = _statement.execute(text);
}
@@ -207,80 +225,83 @@ public class JDBCChannel extends EOAdaptorChannel {
}
}
- /* Executes a stored procedure with the specified parameters.
- * Any results that the procedure returns should be obtained
- * by calling returnValuesForLastStoredProcedureInvocation.
- * @see net.wotonomy.access.EOAdaptorChannel#executeStoredProcedure(net.wotonomy.access.EOStoredProcedure, net.wotonomy.foundation.NSDictionary)
+ /*
+ * Executes a stored procedure with the specified parameters. Any results that
+ * the procedure returns should be obtained by calling
+ * returnValuesForLastStoredProcedureInvocation.
+ *
+ * @see
+ * net.wotonomy.access.EOAdaptorChannel#executeStoredProcedure(net.wotonomy.
+ * access.EOStoredProcedure, net.wotonomy.foundation.NSDictionary)
*/
- public void executeStoredProcedure(
- EOStoredProcedure proc, NSDictionary values) {
+ public void executeStoredProcedure(EOStoredProcedure proc, NSDictionary values) {
if (!isOpen())
throw new EOGeneralAdaptorException("Attempt to execute a stored procedure on a closed channel.");
conditionalBeginTransaction();
try {
- //Assemble the procedure call
+ // Assemble the procedure call
StringBuffer buf = new StringBuffer("{ call ");
buf.append(proc.externalName());
NSArray args = proc.arguments();
if (args != null && args.count() > 0) {
buf.append("[");
for (int i = 0; i < args.count(); i++) {
- EOAttribute a = (EOAttribute)args.objectAtIndex(i);
+ EOAttribute a = (EOAttribute) args.objectAtIndex(i);
if (a.parameterDirection() != EOAttribute.OutParameter) {
buf.append('?');
buf.append(", ");
}
}
- buf.delete(buf.length()-2, buf.length());
+ buf.delete(buf.length() - 2, buf.length());
buf.append("]");
}
buf.append(" }");
- //get the callable statement
+ // get the callable statement
CallableStatement sp = _context().connection().prepareCall(buf.toString());
if (args != null && args.count() > 0) {
int pos = 1;
- //set the in and inOut parameters
+ // set the in and inOut parameters
for (int i = 0; i < args.count(); i++) {
- EOAttribute a = (EOAttribute)args.objectAtIndex(i);
+ EOAttribute a = (EOAttribute) args.objectAtIndex(i);
if (a.parameterDirection() != EOAttribute.OutParameter) {
Object val = values.objectForKey(a.name());
if (val == NSKeyValueCoding.NullValue)
- sp.setNull(pos, 0); //TODO: check sql type
+ sp.setNull(pos, 0); // TODO: check sql type
if (val instanceof String)
- sp.setString(pos, (String)val);
+ sp.setString(pos, (String) val);
else if (val instanceof BigDecimal)
- sp.setBigDecimal(pos, (BigDecimal)val);
+ sp.setBigDecimal(pos, (BigDecimal) val);
else if (val instanceof NSTimestamp)
- sp.setTimestamp(pos, (NSTimestamp)val);
+ sp.setTimestamp(pos, (NSTimestamp) val);
else if (val instanceof NSData)
- sp.setBytes(pos, ((NSData)val).bytes());
+ sp.setBytes(pos, ((NSData) val).bytes());
else if (val instanceof Integer)
- sp.setInt(pos, ((Integer)val).intValue());
+ sp.setInt(pos, ((Integer) val).intValue());
else if (val instanceof Long)
- sp.setLong(pos, ((Long)val).longValue());
+ sp.setLong(pos, ((Long) val).longValue());
else
sp.setObject(pos, val);
pos++;
}
}
}
- //run the procedure
+ // run the procedure
sp.execute();
- //get the return values
+ // get the return values
if (args != null && args.count() > 0) {
int pos = 1;
NSMutableDictionary retvals = new NSMutableDictionary();
for (int i = 0; i < args.count(); i++) {
- EOAttribute a = (EOAttribute)args.objectAtIndex(i);
+ EOAttribute a = (EOAttribute) args.objectAtIndex(i);
if (a.parameterDirection() != EOAttribute.InParameter) {
Object val = sp.getObject(pos);
if (val == null)
retvals.setObjectForKey(NSKeyValueCoding.NullValue, a.name());
else if (val instanceof Blob) {
try {
- retvals.setObjectForKey(new NSData(((Blob)val).getBinaryStream(), 1024), a.name());
+ retvals.setObjectForKey(new NSData(((Blob) val).getBinaryStream(), 1024), a.name());
} catch (java.io.IOException ex) {
- //what should I do here?
+ // what should I do here?
retvals.setObjectForKey(NSData.EmptyData, a.name());
}
} else
@@ -296,7 +317,9 @@ public class JDBCChannel extends EOAdaptorChannel {
conditionalCommitTransaction();
}
- /* Fetches one row from the database
+ /*
+ * Fetches one row from the database
+ *
* @see net.wotonomy.access.EOAdaptorChannel#fetchRow()
*/
public NSMutableDictionary fetchRow() {
@@ -306,7 +329,7 @@ public class JDBCChannel extends EOAdaptorChannel {
if (attributesToFetch() == null)
throw new EOGeneralAdaptorException("Attempt to fetchRow without setting attributes to fetch first.");
try {
- //If the current result set ends, there may be another one
+ // If the current result set ends, there may be another one
if (!_resultSet.next()) {
_resultSet.close();
_resultAttributes = null;
@@ -319,12 +342,12 @@ public class JDBCChannel extends EOAdaptorChannel {
throw new JDBCAdaptorException("While trying to fetch row.", ex);
}
- //Assemble the dictionary
+ // Assemble the dictionary
NSMutableDictionary dict = new NSMutableDictionary(attributesToFetch().count());
try {
for (int i = 0; i < attributesToFetch().count(); i++) {
- EOAttribute a = (EOAttribute)attributesToFetch().objectAtIndex(i);
- Object o = _resultSet.getObject(i+1);
+ EOAttribute a = (EOAttribute) attributesToFetch().objectAtIndex(i);
+ Object o = _resultSet.getObject(i + 1);
if (o == null)
o = NSKeyValueCoding.NullValue;
dict.setObjectForKey(o, a.name());
@@ -335,8 +358,11 @@ public class JDBCChannel extends EOAdaptorChannel {
return dict;
}
- /* Inserts a row into a table in the database.
- * @see net.wotonomy.access.EOAdaptorChannel#insertRow(net.wotonomy.foundation.NSDictionary, net.wotonomy.access.EOEntity)
+ /*
+ * Inserts a row into a table in the database.
+ *
+ * @see net.wotonomy.access.EOAdaptorChannel#insertRow(net.wotonomy.foundation.
+ * NSDictionary, net.wotonomy.access.EOEntity)
*/
public void insertRow(NSDictionary row, EOEntity entity) {
EOSQLExpression exp = adaptorContext().adaptor().expressionFactory().createExpression(entity);
@@ -344,15 +370,19 @@ public class JDBCChannel extends EOAdaptorChannel {
evaluateExpression(exp);
}
- /* Indicates if a fetch is in progress; that is, if a SELECT statement
- * was executed and there are still rows to be fetched.
+ /*
+ * Indicates if a fetch is in progress; that is, if a SELECT statement was
+ * executed and there are still rows to be fetched.
+ *
* @see net.wotonomy.access.EOAdaptorChannel#isFetchInProgress()
*/
public boolean isFetchInProgress() {
return _fetchInProgress;
}
- /* Indicates if the channel is open.
+ /*
+ * Indicates if the channel is open.
+ *
* @see net.wotonomy.access.EOAdaptorChannel#isOpen()
*/
public boolean isOpen() {
@@ -365,9 +395,10 @@ public class JDBCChannel extends EOAdaptorChannel {
return open;
}
- /* Opens the channel. If the adaptor context has not yet made
- * a connection to the database, this forces the context to
- * connect.
+ /*
+ * Opens the channel. If the adaptor context has not yet made a connection to
+ * the database, this forces the context to connect.
+ *
* @see net.wotonomy.access.EOAdaptorChannel#openChannel()
*/
public void openChannel() {
@@ -379,36 +410,46 @@ public class JDBCChannel extends EOAdaptorChannel {
}
}
- /* Returns the values obtained from the last stored procedure executed.
- * @see net.wotonomy.access.EOAdaptorChannel#returnValuesForLastStoredProcedureInvocation()
+ /*
+ * Returns the values obtained from the last stored procedure executed.
+ *
+ * @see net.wotonomy.access.EOAdaptorChannel#
+ * returnValuesForLastStoredProcedureInvocation()
*/
public NSDictionary returnValuesForLastStoredProcedureInvocation() {
return _spReturnValues;
}
- /* Creates a SELECT expression and executes it. If the attribute array is null,
- * then the result's metadata is used to dynamically create an array
- * of attributes.
- * @see net.wotonomy.access.EOAdaptorChannel#selectAttributes(net.wotonomy.foundation.NSArray, net.wotonomy.control.EOFetchSpecification, boolean, net.wotonomy.access.EOEntity)
+ /*
+ * Creates a SELECT expression and executes it. If the attribute array is null,
+ * then the result's metadata is used to dynamically create an array of
+ * attributes.
+ *
+ * @see
+ * net.wotonomy.access.EOAdaptorChannel#selectAttributes(net.wotonomy.foundation
+ * .NSArray, net.wotonomy.control.EOFetchSpecification, boolean,
+ * net.wotonomy.access.EOEntity)
*/
- public void selectAttributes(
- NSArray atts, EOFetchSpecification fspec,
- boolean lock, EOEntity entity) {
+ public void selectAttributes(NSArray atts, EOFetchSpecification fspec, boolean lock, EOEntity entity) {
_resultAttributes = atts;
EOSQLExpression expr = adaptorContext().adaptor().expressionFactory().createExpression(entity);
_fetchInProgress = true;
expr.prepareSelectExpressionWithAttributes(atts, lock, fspec);
- //for now we store the fetch limit here
+ // for now we store the fetch limit here
if (fspec != null)
_resultCount = fspec.fetchLimit();
evaluateExpression(expr);
}
- /* Creates and executes an UPDATE statement.
- * @see net.wotonomy.access.EOAdaptorChannel#updateValuesInRowsDescribedByQualifier(net.wotonomy.foundation.NSDictionary, net.wotonomy.control.EOQualifier, net.wotonomy.access.EOEntity)
+ /*
+ * Creates and executes an UPDATE statement.
+ *
+ * @see
+ * net.wotonomy.access.EOAdaptorChannel#updateValuesInRowsDescribedByQualifier(
+ * net.wotonomy.foundation.NSDictionary, net.wotonomy.control.EOQualifier,
+ * net.wotonomy.access.EOEntity)
*/
- public int updateValuesInRowsDescribedByQualifier(
- NSDictionary row, EOQualifier q, EOEntity entity) {
+ public int updateValuesInRowsDescribedByQualifier(NSDictionary row, EOQualifier q, EOEntity entity) {
EOSQLExpression exp = adaptorContext().adaptor().expressionFactory().createExpression(entity);
exp.prepareUpdateExpressionWithRow(row, q);
evaluateExpression(exp);
@@ -429,21 +470,18 @@ public class JDBCChannel extends EOAdaptorChannel {
}
/*
-* $Log$
-* Revision 1.2 2006/02/18 22:59:22 cgruber
-* make it compile with maven dependencies and add a cvsignore.
-*
-* Revision 1.1 2006/02/16 13:22:23 cgruber
-* Check in all sources in eclipse-friendly maven-enabled packages.
-*
-* Revision 1.3 2003/08/14 02:15:11 chochos
-* added lots of comments
-*
-* Revision 1.2 2003/08/13 20:45:20 chochos
-* small fixes in evaluateExpression, which has been successfully tested with a SELECT statement.
-*
-* Revision 1.1 2003/08/13 20:12:48 chochos
-* a subclass of EOAdaptorChannel to be used with JDBC.
-*
-*/
-
+ * $Log$ Revision 1.2 2006/02/18 22:59:22 cgruber make it compile with maven
+ * dependencies and add a cvsignore.
+ *
+ * Revision 1.1 2006/02/16 13:22:23 cgruber Check in all sources in
+ * eclipse-friendly maven-enabled packages.
+ *
+ * Revision 1.3 2003/08/14 02:15:11 chochos added lots of comments
+ *
+ * Revision 1.2 2003/08/13 20:45:20 chochos small fixes in evaluateExpression,
+ * which has been successfully tested with a SELECT statement.
+ *
+ * Revision 1.1 2003/08/13 20:12:48 chochos a subclass of EOAdaptorChannel to be
+ * used with JDBC.
+ *
+ */
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java
index 445ffb5..9e6df6c 100644
--- a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java
+++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCContext.java
@@ -27,18 +27,19 @@ import net.wotonomy.access.EOAdaptorChannel;
import net.wotonomy.access.EOAdaptorContext;
/**
-* Concrete implementation of EOAdaptorContext for use with JDBC.
-*
-* @author ezamudio@nasoft.com
-* @author $Author: cgruber $
-* @version $Revision: 903 $
-*/
+ * Concrete implementation of EOAdaptorContext for use with JDBC.
+ *
+ * @author ezamudio@nasoft.com
+ * @author $Author: cgruber $
+ * @version $Revision: 903 $
+ */
public class JDBCContext extends EOAdaptorContext {
protected Connection _jdbcConnection;
/**
* Creates a new instance.
+ *
* @param adaptor The adaptor this context belongs to.
*/
public JDBCContext(EOAdaptor adaptor) {
@@ -49,12 +50,12 @@ public class JDBCContext extends EOAdaptorContext {
try {
if (_jdbcConnection != null && !_jdbcConnection.isClosed())
throw new JDBCAdaptorException("Attempt to connect when already connected.", null);
- Class.forName(((JDBCAdaptor)adaptor()).driverName());
- String url = (String)adaptor().connectionDictionary().objectForKey("URL");
+ Class.forName(((JDBCAdaptor) adaptor()).driverName());
+ String url = (String) adaptor().connectionDictionary().objectForKey("URL");
Driver driver = DriverManager.getDriver(url);
java.util.Properties props = new java.util.Properties();
- props.setProperty("user", (String)adaptor().connectionDictionary().objectForKey("username"));
- props.setProperty("password", (String)adaptor().connectionDictionary().objectForKey("password"));
+ props.setProperty("user", (String) adaptor().connectionDictionary().objectForKey("username"));
+ props.setProperty("password", (String) adaptor().connectionDictionary().objectForKey("password"));
_jdbcConnection = driver.connect(url, props);
_jdbcConnection.setAutoCommit(false);
} catch (SQLException ex) {
@@ -80,8 +81,9 @@ public class JDBCContext extends EOAdaptorContext {
return _jdbcConnection;
}
- /* Begins a transaction. Actually it does nothing because it's not
- * necessary.
+ /*
+ * Begins a transaction. Actually it does nothing because it's not necessary.
+ *
* @see net.wotonomy.access.EOAdaptorContext#beginTransaction()
*/
public void beginTransaction() {
@@ -90,7 +92,9 @@ public class JDBCContext extends EOAdaptorContext {
transactionDidBegin();
}
- /* Commits a transaction.
+ /*
+ * Commits a transaction.
+ *
* @see net.wotonomy.access.EOAdaptorContext#commitTransaction()
*/
public void commitTransaction() {
@@ -102,7 +106,9 @@ public class JDBCContext extends EOAdaptorContext {
}
}
- /* Rolls back a transacion.
+ /*
+ * Rolls back a transacion.
+ *
* @see net.wotonomy.access.EOAdaptorContext#rollbackTransaction()
*/
public void rollbackTransaction() {
@@ -114,7 +120,9 @@ public class JDBCContext extends EOAdaptorContext {
}
}
- /* Creates a JDBCChannel instance.
+ /*
+ * Creates a JDBCChannel instance.
+ *
* @see net.wotonomy.access.EOAdaptorContext#createAdaptorChannel()
*/
public EOAdaptorChannel createAdaptorChannel() {
@@ -123,7 +131,9 @@ public class JDBCContext extends EOAdaptorContext {
return channel;
}
- /* I don't know what to do here. Throw something, maybe?
+ /*
+ * I don't know what to do here. Throw something, maybe?
+ *
* @see net.wotonomy.access.EOAdaptorContext#handleDroppedConnection()
*/
public void handleDroppedConnection() {
@@ -133,14 +143,14 @@ public class JDBCContext extends EOAdaptorContext {
}
/*
- * $Log$
- * Revision 1.2 2006/02/18 22:59:22 cgruber
- * make it compile with maven dependencies and add a cvsignore.
+ * $Log$ Revision 1.2 2006/02/18 22:59:22 cgruber make it compile with maven
+ * dependencies and add a cvsignore.
*
- * Revision 1.1 2006/02/16 13:22:23 cgruber
- * Check in all sources in eclipse-friendly maven-enabled packages.
+ * Revision 1.1 2006/02/16 13:22:23 cgruber Check in all sources in
+ * eclipse-friendly maven-enabled packages.
*
- * Revision 1.1 2003/08/13 20:13:33 chochos
- * concrete implementation of EOAdaptorContext for use with JDBC. This is the class that holds the physical connection to the database.
+ * Revision 1.1 2003/08/13 20:13:33 chochos concrete implementation of
+ * EOAdaptorContext for use with JDBC. This is the class that holds the physical
+ * connection to the database.
*
*/
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpression.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpression.java
index 2258a65..97e3352 100644
--- a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpression.java
+++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpression.java
@@ -23,14 +23,13 @@ import net.wotonomy.access.EOSQLExpression;
import net.wotonomy.foundation.NSDictionary;
import net.wotonomy.foundation.NSMutableDictionary;
-
/**
-* Concrete implementation of EOSQLExpression for use with JDBC.
-*
-* @author ezamudio@nasoft.com
-* @author $Author: cgruber $
-* @version $Revision: 903 $
-*/
+ * Concrete implementation of EOSQLExpression for use with JDBC.
+ *
+ * @author ezamudio@nasoft.com
+ * @author $Author: cgruber $
+ * @version $Revision: 903 $
+ */
public class JDBCExpression extends EOSQLExpression {
protected NSDictionary _jdbcInfo;
@@ -45,29 +44,32 @@ public class JDBCExpression extends EOSQLExpression {
public void setJdbcInfo(NSDictionary info) {
_jdbcInfo = info;
}
+
public NSDictionary jdbcInfo() {
return _jdbcInfo;
}
- /* (non-Javadoc)
- * @see net.wotonomy.access.EOSQLExpression#bindVariableDictionaryForAttribute(net.wotonomy.access.EOAttribute, java.lang.Object)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * net.wotonomy.access.EOSQLExpression#bindVariableDictionaryForAttribute(net.
+ * wotonomy.access.EOAttribute, java.lang.Object)
*/
- public NSMutableDictionary bindVariableDictionaryForAttribute(
- EOAttribute attr, Object variable) {
+ public NSMutableDictionary bindVariableDictionaryForAttribute(EOAttribute attr, Object variable) {
// TODO Auto-generated method stub
return null;
}
}
/*
- * $Log$
- * Revision 1.2 2006/02/18 22:59:22 cgruber
- * make it compile with maven dependencies and add a cvsignore.
+ * $Log$ Revision 1.2 2006/02/18 22:59:22 cgruber make it compile with maven
+ * dependencies and add a cvsignore.
*
- * Revision 1.1 2006/02/16 13:22:23 cgruber
- * Check in all sources in eclipse-friendly maven-enabled packages.
+ * Revision 1.1 2006/02/16 13:22:23 cgruber Check in all sources in
+ * eclipse-friendly maven-enabled packages.
*
- * Revision 1.1 2003/08/13 20:14:38 chochos
- * subclass of EOSQLExpression. Still needs a lot of work for bindings, mostly.
+ * Revision 1.1 2003/08/13 20:14:38 chochos subclass of EOSQLExpression. Still
+ * needs a lot of work for bindings, mostly.
*
*/
diff --git a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpressionFactory.java b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpressionFactory.java
index 15c167f..6f51181 100644
--- a/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpressionFactory.java
+++ b/projects/net.wotonomy.persistence.adapter.jdbc/src/main/java/net/wotonomy/jdbcadaptor/JDBCExpressionFactory.java
@@ -23,25 +23,25 @@ import net.wotonomy.access.EOSQLExpression;
import net.wotonomy.access.EOSQLExpressionFactory;
import net.wotonomy.foundation.NSDictionary;
-
/**
-* Concrete implementation of EOSQLExpressionFactory for use with JDBC.
-*
-* @author ezamudio@nasoft.com
-* @author $Author: cgruber $
-* @version $Revision: 903 $
-*/
+ * Concrete implementation of EOSQLExpressionFactory for use with JDBC.
+ *
+ * @author ezamudio@nasoft.com
+ * @author $Author: cgruber $
+ * @version $Revision: 903 $
+ */
public class JDBCExpressionFactory extends EOSQLExpressionFactory {
protected NSDictionary _jdbcInfo;
/**
* Creates a new instance.
+ *
* @param adaptor The adaptor for this factory.
*/
public JDBCExpressionFactory(EOAdaptor adaptor) {
super(adaptor);
- _jdbcInfo = ((JDBCAdaptor)adaptor()).jdbcInfo();
+ _jdbcInfo = ((JDBCAdaptor) adaptor()).jdbcInfo();
}
public EOSQLExpression createExpression(EOEntity entity) {
@@ -52,14 +52,13 @@ public class JDBCExpressionFactory extends EOSQLExpressionFactory {
}
/*
- * $Log$
- * Revision 1.2 2006/02/18 22:59:22 cgruber
- * make it compile with maven dependencies and add a cvsignore.
+ * $Log$ Revision 1.2 2006/02/18 22:59:22 cgruber make it compile with maven
+ * dependencies and add a cvsignore.
*
- * Revision 1.1 2006/02/16 13:22:23 cgruber
- * Check in all sources in eclipse-friendly maven-enabled packages.
+ * Revision 1.1 2006/02/16 13:22:23 cgruber Check in all sources in
+ * eclipse-friendly maven-enabled packages.
*
- * Revision 1.1 2003/08/13 20:15:05 chochos
- * the subclass of EOSQLExpressionFactory to be used with JDBC.
+ * Revision 1.1 2003/08/13 20:15:05 chochos the subclass of
+ * EOSQLExpressionFactory to be used with JDBC.
*
*/ \ No newline at end of file