incubator-empire-db-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eike Kettner <n...@eknet.org>
Subject Re: Work on EMPIREDB-103 (DDL duplicate code) almost complete!
Date Mon, 10 Oct 2011 21:19:49 GMT
Hi!

I just ran the basic and advances examples on my linux machine with
postgresql 8.4.8, mysql 5.1.49 and derby 10.4.2.0.

All went well except for the basic example with postgresql. Here is the
stack trace:

org.apache.empire.exceptions.InvalidArgumentException: Invalid Argument -1 for parameter index.
	at org.apache.empire.db.DBReader.getValue(DBReader.java:370)
	at org.apache.empire.db.DBRecordData.getString(DBRecordData.java:193)
	at org.apache.empire.db.DBRecordData.getString(DBRecordData.java:206)
	at org.apache.empire.samples.db.SampleApp.queryRecords(SampleApp.java:419)
	at org.apache.empire.samples.db.SampleApp.main(SampleApp.java:135)


The problem is line 422 of SampleApp.java, it says

 reader.getString(PHONE_EXT_NUMBER)

It seems that the query depends on the dbms. In line 380-386, the
"column" PHONE_EXT_NUMBER is only added to the query if it's _not_
postgresql. The comment states, that this is due to posgresql not
supporting substring. I'm pretty sure, that postgre supports this (see
http://www.postgresql.org/docs/8.1/static/functions-string.html) So I
bravely removed the if condition and the example ran successfully.

Are there any other reasons for this if-condition? I'd then say, we
should remove it, since substring is supported by postgre?

Regards,
Eike


On [Mon, 10.10.2011 00:28], Rainer Döbele wrote:
> Hi folks,
> 
> I am happy to announce that I have almost completed another major task that has long
been overdue: The reduction of duplicate code for DDL generation.
> 
> Doesn't sound like much, but this issue has been quite a bit of work and hence took me
quite a bit of time.
> I have tried my best to achieve the same results as before by comparison of the DDL outcome.
> But I have not been able to make real database tests against the following databases:
MySQL, Postgre, H2, Derby.
> However I have tested Oracle, SQLServer and HSQLDB.
> 
> Is anyone able to test it with any of the remaining databases by running at least the
basic and the advanced sample?
> 
> Cheers,
> Rainer
> 

-- 
email: eike@eknet.org   https://www.eknet.org  pgp: 481161A0

Mime
View raw message