org.h2.upgrade
Class DbUpgradeFromVersion1

java.lang.Object
  extended by org.h2.upgrade.DbUpgradeFromVersion1

public class DbUpgradeFromVersion1
extends java.lang.Object

Class to convert a 1.1 database (non page store) to the 1.2 (page store) format. Conversion is done via "script to" and "runscript from".


Constructor Summary
DbUpgradeFromVersion1(java.lang.String url, java.util.Properties info)
          Converts a database from a 1.1 DB (non page store) to a 1.2 DB (page store) format.
 
Method Summary
 boolean mustBeConverted()
          Returns if a database must be converted by this class.
static void setDeleteOldDb(boolean deleteOldDb)
          Old files will be renamed to .backup after a successful conversion.
static void setScriptInTempDir(boolean scriptInTempDir)
          The conversion script file will per default be created in the db directory.
 void upgrade()
          Converts the database from 1.1 (non page store) to current (page store).
 boolean wasSuccessful()
          Returns if the database upgrade was successful.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbUpgradeFromVersion1

public DbUpgradeFromVersion1(java.lang.String url,
                             java.util.Properties info)
                      throws java.sql.SQLException
Converts a database from a 1.1 DB (non page store) to a 1.2 DB (page store) format.

Parameters:
url - The connection string
info - The connection properties
Throws:
java.sql.SQLException - if an exception occurred
Method Detail

mustBeConverted

public boolean mustBeConverted()
                        throws java.sql.SQLException
Returns if a database must be converted by this class.

Returns:
if the conversion classes were found and the database must be converted
Throws:
java.sql.SQLException

upgrade

public void upgrade()
             throws java.sql.SQLException
Converts the database from 1.1 (non page store) to current (page store).

Throws:
java.sql.SQLException

wasSuccessful

public boolean wasSuccessful()
Returns if the database upgrade was successful.

Returns:
if the database upgrade was successful

setScriptInTempDir

public static void setScriptInTempDir(boolean scriptInTempDir)
The conversion script file will per default be created in the db directory. Use this method to change the directory to the temp directory.

Parameters:
scriptInTempDir - true if the conversion script should be located in the temp directory.

setDeleteOldDb

public static void setDeleteOldDb(boolean deleteOldDb)
Old files will be renamed to .backup after a successful conversion. To delete them after the conversion, use this method with the parameter 'true'.

Parameters:
deleteOldDb - if true, the old db files will be deleted.