Postgresql with case sensitive table and field names
Postgresql with case sensitive table and field names
- Subject: Postgresql with case sensitive table and field names
- From: D Tim Cummings <email@hidden>
- Date: Sat, 15 May 2004 20:08:50 +1000
I am using WebObjects 5.2.3 Mac OS X 10.3.3 that needs to use a
Postgresql 7.4 database through jdbc connector pg74.213.jdbc3.jar.
Unfortunately, the database which already existed had case sensitive
table names and field names. I tried using version 1.2 of the
PostgresqlPlugIn and PostgresqlPlugInBundle from www.hexdreams.com.
According to Apple's documentation it looked like all I needed to do
was add
static private final String EXTERNAL_NAME_QUOTE_CHARACTER = "\"";
public String externalNameQuoteCharacter() {
return EXTERNAL_NAME_QUOTE_CHARACTER;
}
to PostgresqlExpression.java in both of these projects and I would be
able to connect to case sensitive table and field names. This
certainly worked for SELECT statements, but as soon as I had to do
anything that generated an UPDATE statement, I would get error
messages. I think there are some bugs in the Apple
com.webobjects.eoaccess.EOSQLExpression that make it difficult for the
hexdreams plug ins to work. By also adding the following lines to
PostgresqlExpression.java in PostgresqlPlugIn project, it seems to work
around the bugs in Apple's EOSQLExpression.
public String sqlStringForAttribute(EOAttribute attribute) {
if ( attribute.isDerived() || useAliases() || attribute.columnName()
== null ) return super.sqlStringForAttribute(attribute);
return sqlStringForSchemaObjectName(attribute.columnName());
}
public String tableListWithRootEntity(EOEntity entity) {
if (useAliases()) return super.tableListWithRootEntity(entity);
return entity.valueForSQLExpression(this);
}
I hope this is helpful for other people.
D Tim Cummings
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.