Currently the NodeManager.getList function of the bridge works like this

NodeList list = nodeManager.getList(where, orderby, directions);

And if 'where' is wrong, e.g, contains non-existing fields, then list will
simply be an empty list, which is rather confusing.

This is because the 'search' methods in MMObjectBuilder behave
correspondingly.

I would like to add function to MMObjectBuilder who would let the
SQLException go, use them in the implementation of NodeManager and then you
get exceptions like this:

ava.sql.SQLException: Column not found: Unknown column 'pos' in 'order
clause'
        at org.gjt.mm.mysql.MysqlIO.sendCommand(MysqlIO.java:498)
        at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(MysqlIO.java:551)
        at org.gjt.mm.mysql.MysqlIO.sqlQuery(MysqlIO.java:636)
        at org.gjt.mm.mysql.Connection.execSQL(Connection.java:924)
        at org.gjt.mm.mysql.Connection.execSQL(Connection.java:857)
        at org.gjt.mm.mysql.Statement.executeQuery(Statement.java:169)
        at org.gjt.mm.mysql.jdbc2.Statement.executeQuery(Statement.java:78)
        at 
org.mmbase.module.database.MultiStatement.executeQuery(MultiStatement.java:184)
        at org.mmbase.module.core.MMObjectBuilder.getList(MMObjectBuilder.java:1101)
        at org.mmbase.module.core.MMObjectBuilder.searchList(MMObjectBuilder.java:1357)
        at 
org.mmbase.bridge.implementation.BasicNodeManager.getList(BasicNodeManager.java:159)

Which is rather a lot more helpfull then an empty list (well, granted, the
exception appears in the log).

The bridge-user (e.g. the taglib) can simply let the exception go (and
disply on the html-page), or catch to do something reasonable (can e.g. log
it as an error if this really would be feasiable). At least you have the
choice then.

Some constraints checks are already done in the bridge implementation
'validConstraints' of BasicCloud, but it is obviousely not smart enough, and
I think it can just as well be left to the database itself... 

I would like to apply this change, but it is not absolutely backwards
compatible, so I would like to request for comments about it first.


 Michiel


-- 
Michiel Meeuwissen 
Mediapark, C 107 tel. +31 (0)35 6772979



Reply via email to