1 9 package org.jboss.portal.setup.impl.dl.dbloader; 10 11 import org.jboss.portal.setup.PortalSetupException; 12 13 import java.sql.Date ; 14 15 16 22 public class SqlFunctionMetaData 23 { 24 private String m_funcString = null; 25 private String m_funcName = null; 26 27 protected SqlFunctionMetaData(String funcStr) 28 { 29 m_funcString = funcStr; 30 int index = funcStr.indexOf("("); 31 if (index > 0) 32 { 33 m_funcName = funcStr.substring(0, index); 34 35 } 36 else 37 { 38 m_funcName = funcStr; 39 } 40 } 41 42 public String toString() 43 { 44 return m_funcString; 45 } 46 47 public String getFuncName() 48 { 49 return m_funcName; 50 } 51 52 public Object resolveSQLFunction(String dbVendor) throws PortalSetupException 53 { 54 if ("now".equalsIgnoreCase(m_funcName)) 55 { 56 return new Date (System.currentTimeMillis()); 57 } 58 else 59 { 60 throw new PortalSetupException("Specified function: " + 61 (getFuncName() + " is not supported by hibernate dialect: " + 62 dbVendor)); 63 } 64 } 65 } 66 | Popular Tags |