org.apache.ojb.broker.util
Class SqlHelper

java.lang.Object
  extended byorg.apache.ojb.broker.util.SqlHelper

public class SqlHelper
extends java.lang.Object

Helper class for all SQL related stuff.

Version:
$Id: SqlHelper.java,v 1.22 2004/02/04 21:07:34 brj Exp $
Author:
Armin Waibel

Nested Class Summary
static class SqlHelper.PathInfo
          Helper Class for a split column
ie: sum (distinct amount) as theAmount
 
Constructor Summary
SqlHelper()
           
 
Method Summary
static java.lang.String cleanPath(java.lang.String aPath)
          remove functions and () from path
ie: avg(amount) -> amount
ie: sum (accounts.amount) -> accounts.amount
ie: count(distinct id) as theCount-> id
static SqlHelper.PathInfo splitPath(java.lang.String aPath)
          Split a path into column , prefix and suffix, the prefix contains all info up to the column
ie: avg(amount) -> amount , avg( , )
ie: sum (accounts.amount) as theSum -> accounts.amount , sum( , ) as theSum
ie: count( distinct id ) as bla -> id , count(distinct , ) as bla
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlHelper

public SqlHelper()
Method Detail

cleanPath

public static java.lang.String cleanPath(java.lang.String aPath)
remove functions and () from path
ie: avg(amount) -> amount
ie: sum (accounts.amount) -> accounts.amount
ie: count(distinct id) as theCount-> id

Parameters:
aPath - the path to the attribute

splitPath

public static SqlHelper.PathInfo splitPath(java.lang.String aPath)
Split a path into column , prefix and suffix, the prefix contains all info up to the column
ie: avg(amount) -> amount , avg( , )
ie: sum (accounts.amount) as theSum -> accounts.amount , sum( , ) as theSum
ie: count( distinct id ) as bla -> id , count(distinct , ) as bla

Parameters:
aPath -
Returns:
PathInfo


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14