RE: Re: [OJB-developers] bug in sql generation
Brought to you by:
thma
From: <tr...@th...> - 2002-05-31 03:17:41
|
It's your call, just bringing it to your attention. Travis ---- Original Message ---- From: Oleg Nitz <on...@uk...> Sent: 2002-05-30 To: obj...@li... Subject: Re: [OJB-developers] bug in sql generation On Thursday 30 May 2002 23:47, tr...@th... wrote: > Because you are adding extra levels of complexity to OJB by trying to > handle all databases internally. Abstracting this out would make it much > more modular and easier to maintain and implement new databases. Not to > mention better performance because crossdb uses a factory get the > appropriate crossdb implementation, so there's not a bunch of if(db is > mysql) else if(db is oracle), etc, etc. Travis, the same thing is done in OJB: see Platform interface, PlatformFactory, and so on. And database handling is completely contained in ojb.broker.platforms module. The similar factory architecture is used in Castor. But I decided to introduce a classification of outer join syntax of *all* existing RDBMS (at least all that I know). At first I thought that there are 3 types of syntax: SQL-92, Sybase and Oracle. Than it turned out that SQL-92 syntax has 2 flavours: with braces and without braces. And you are right, SqlStatement.java contains some number of if/else, which handles these 4 types of syntax. I don't believe that this is noticable for performance. But I suppose that the amount of code that handles database differences in OJB is less than in Castor (ojb.broker.platforms = 21K, org.exolab.castor.jdo.drivers = 217K), while OJB's SqlStatement.java is much more powerful than Castor's QueryExpression. > And it can support everything but unions (only because unions aren't > supported in all dbs). Joins are easily supported and Where statements can > be infinitely nested. And what about aliases? Anyway we need to use unions with all databases that support them, thus CrossDB doesn't fit our needs. And supports less databases. Not to mention better performance of SqlStatement because it does directly stringBuffer.append("X.col1"); stringBuffer.append("="); stringBuffer.append("Y.col2"); instead of SelectQuery sq = factory.getSelectQuery(); ... sq.addWhereCondition("X.col1", WhereCondition.EQUAL_TO, "Y.col2"); sq.execute(); I guess some number of additional objects are created inside the called methods. And how many if/else handle constants like WhereCondition.EQUAL_TO? Don't tell me that with CrossDB we will increase performance ;o) Regards, Oleg _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-developers mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-developers |