public static Connection connectOrUpgrade(String url,Properties info) throws SQLException {
  if (!UPGRADE_CLASSES_PRESENT) {
    return null;
  }
  Properties i2=new Properties();
  i2.putAll(info);
  Object o=info.get("password");
  if (o instanceof char[]) {
    i2.put("password",StringUtils.cloneCharArray((char[])o));
  }
  info=i2;
  ConnectionInfo ci=new ConnectionInfo(url,info);
  if (ci.isRemote() || !ci.isPersistent()) {
    return null;
  }
  String name=ci.getName();
  if (FileUtils.exists(name + Constants.SUFFIX_PAGE_FILE)) {
    return null;
  }
  if (!FileUtils.exists(name + Constants.SUFFIX_OLD_DATABASE_FILE)) {
    return null;
  }
  if (ci.removeProperty("NO_UPGRADE",false)) {
    return connectWithOldVersion(url,info);
  }
synchronized (DbUpgrade.class) {
    upgrade(ci,info);
    return null;
  }
}

public static Connection connectOrUpgrade ( String url , Properties info ) throws SQLException { if ( ! UPGRADE_CLASSES_PRESENT ) { return null ; } Properties i2 = new Properties ( ) ; i2 . putAll ( info ) ; Object o = info . get ( "password" ) ; if ( o instanceof char [ ] ) { i2 . put ( "password" , StringUtils . cloneCharArray ( ( char [ ] ) o ) ) ; } info = i2 ; ConnectionInfo ci = new ConnectionInfo ( url , info ) ; if ( ci . isRemote ( ) || ! ci . isPersistent ( ) ) { return null ; } String name = ci . getName ( ) ; if ( FileUtils . exists ( name + Constants . SUFFIX_PAGE_FILE ) ) { return null ; } if ( ! FileUtils . exists ( name + Constants . SUFFIX_OLD_DATABASE_FILE ) ) { return null ; } if ( ci . removeProperty ( "NO_UPGRADE" , false ) ) { return connectWithOldVersion ( url , info ) ; } synchronized ( DbUpgrade . class ) { upgrade ( ci , info ) ; return null ; } }
if the upgrade classes are present , upgrade the database , or connect using the old version ( if the parameter no_upgrade is set to true ) . if the database is upgraded , or if no upgrade is possible or needed , this methods returns null .
