Skip to content

Commit

Permalink
fix regex to match even if this is not the only option to the jdbc url
Browse files Browse the repository at this point in the history
  • Loading branch information
maiksd committed May 11, 2015
1 parent 63b96e4 commit 506de44
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.webobjects.eoaccess.EOAttribute;
import com.webobjects.eoaccess.EOEntity;
import com.webobjects.eoaccess.EOSQLExpression;
Expand Down Expand Up @@ -72,7 +73,8 @@ protected boolean shouldUseBundledJdbcInfo() {
boolean shouldUseBundledJdbcInfo = false;
String url = connectionURL();
if (url != null) {
shouldUseBundledJdbcInfo = url.toLowerCase().matches(".*(\\?|\\?.*&)" + PostgresqlPlugIn.QUERY_STRING_USE_BUNDLED_JDBC_INFO.toLowerCase() + "=(true|yes)(\\&|$)");
Matcher matcher = Pattern.compile(PostgresqlPlugIn.QUERY_STRING_USE_BUNDLED_JDBC_INFO.toLowerCase() + "=(true|yes)").matcher(url.toLowerCase());
shouldUseBundledJdbcInfo = matcher.find();
}
return shouldUseBundledJdbcInfo;
}
Expand Down Expand Up @@ -147,15 +149,15 @@ public EOSynchronizationFactory createSynchronizationFactory() {
}
}

/**
* Expression class to create. We have custom code, so we need our own class.
/**
* Expression class to create. We have custom code, so we need our own class.
*/
@Override
public Class defaultExpressionClass() {
return PostgresqlExpression.class;
}

/**
/**
* Overrides the parent implementation to provide a more efficient mechanism for generating primary keys,
* while generating the primary key support on the fly.
*
Expand Down Expand Up @@ -210,7 +212,7 @@ public NSArray<NSDictionary<String, Object>> newPrimaryKeys(int count, EOEntity
pk = Long.valueOf(pkObj.longValue());
}
results.addObject(new NSDictionary<String, Object>(pk, attrName));
}
}
}
}
finally {
Expand Down Expand Up @@ -273,7 +275,7 @@ else if (numCount == null) {
* @return the name of the sequence
*/
protected static String _sequenceNameForEntity(EOEntity entity) {
/* timc 2006-11-06
/* timc 2006-11-06
* This used to say ... + "_SEQ";
* _SEQ would get converted to _seq because postgresql converts all unquoted identifiers to lower case.
* In the future we may use enableIdentifierQuoting for sequence names so we need to set the correct case here in the first place
Expand Down

0 comments on commit 506de44

Please sign in to comment.