Package org.springframework.jdbc.core.metadata

Examples of org.springframework.jdbc.core.metadata.CallMetaDataProvider


   * @param context the class that holds configuration and metedata
   * @return instance of the CallMetaDataProvider implementation to be used
   */
  static public CallMetaDataProvider createMetaDataProvider(final DataSource dataSource, final CallMetaDataContext context) {
    try {
      CallMetaDataProvider provider = (CallMetaDataProvider) JdbcUtils.extractDatabaseMetaData(dataSource, new DatabaseMetaDataCallback() {
        public Object processMetaData(DatabaseMetaData databaseMetaData) throws SQLException, MetaDataAccessException {
          String databaseProductName = JdbcUtils.commonDatabaseName(databaseMetaData.getDatabaseProductName());
          boolean accessProcedureColumnMetaData = context.isAccessCallParameterMetaData();
          if (context.isFunction()) {
            if (!supportedDatabaseProductsForFunctions.contains(databaseProductName)) {
              if (accessProcedureColumnMetaData) {
                accessProcedureColumnMetaData = false;
              }
            }
          }
          else {
            if (!supportedDatabaseProductsForProcedures.contains(databaseProductName)) {
              if (accessProcedureColumnMetaData) {
                accessProcedureColumnMetaData = false;
              }
            }
          }

          CallMetaDataProvider provider = null;
          if ("Oracle".equals(databaseProductName)) {  //$NON-NLS-1$
            provider = new OracleTypeHandler(databaseMetaData);
          }

          if (provider != null){
            provider.initializeWithMetaData(databaseMetaData);
            if (accessProcedureColumnMetaData) {
              provider.initializeWithProcedureColumnMetaData(
                databaseMetaData, context.getCatalogName(), context.getSchemaName(), context.getProcedureName());
            }
          }
         
          return provider;
View Full Code Here


    onCompileInternal();
  }
 
  @Override
  public Object convertInputValue(SqlParameter sqlParameter, Object value){
    CallMetaDataProvider metaDataProvider = callMetaDataContext.getMetaDataProvider();

    if (metaDataProvider instanceof VendorTypeHandler){
      return ((VendorTypeHandler)callMetaDataContext.getMetaDataProvider()).transformInputValue(getJdbcTemplate(), sqlParameter, value);
    }
   
View Full Code Here

    return value;
  }
 
  @Override
  public Object convertOutputValue(SqlParameter sqlParameter, Object value){
    CallMetaDataProvider metaDataProvider = callMetaDataContext.getMetaDataProvider();
   
    if (metaDataProvider instanceof VendorTypeHandler){
      SqlParameter logicalParameter = getLogicalParameterByDbName(sqlParameter.getName());
   
      if (logicalParameter instanceof TypedSqlOutParameter){
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.metadata.CallMetaDataProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.