Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hsqldb
Class Log  view Log download Log.java

java.lang.Object
  extended byorg.hsqldb.Log
All Implemented Interfaces:
java.lang.Runnable

class Log
extends java.lang.Object
implements java.lang.Runnable

This class is responsible for most file handling. A HSQL database consists of a .properties file, a .script file (contains a SQL script), a .data file (contains data of cached tables) and a .backup file (contains the compressed .data file)

This is an example of the .properties file. The version and the modified properties are automatically created by the database and should not be changed manually:

 modified=no
 version=1.43
 
The following lines are optional, this means they are not created automatically by the database, but they are interpreted if they exist in the .script file. They have to be created manually if required. If they don't exist the default is used. This are the defaults of the database 'test':
 readonly=false
 

Version:
1.7.0

Field Summary
private  boolean bNeedFlush
           
private  boolean bReadOnly
           
private  boolean bRestoring
           
private  boolean bWriteDelay
           
private  Cache cCache
           
private static int COPY_BLOCK_SIZE
           
private  Database dDatabase
           
private  int iLogCount
           
private  int iLogSize
           
private static java.lang.String lineSep
          Method declaration
private  int mLastId
           
private  HsqlDatabaseProperties pProperties
           
private  java.io.File scriptChecker
           
private  java.lang.String sFileBackup
           
private  java.lang.String sFileCache
           
private  java.lang.String sFileScript
           
private  java.lang.String sName
           
private  Session sysSession
           
private  java.util.Hashtable textCacheList
           
private  java.lang.Thread tRunner
           
private  java.io.Writer wScript
           
 
Constructor Summary
(package private) Log(Database db, Session system, java.lang.String name)
          Constructor declaration
 
Method Summary
private  void backup()
          Saves the *.data file as compressed *.backup.
(package private)  void checkpoint()
          Method declaration
(package private)  void close(boolean compact)
          Method declaration
(package private)  void closeAllTextCaches(boolean compact)
           
private  void closeScript()
          Method declaration
(package private)  void closeTextCache(java.lang.String table)
           
private  void create()
           
(package private)  Cache getCache()
           
(package private)  HsqlDatabaseProperties getProperties()
          Method declaration
private  boolean isAlreadyOpen()
          Method declaration
(package private)  boolean open()
          When opening a database, the hsqldb.compatible_version property is used to determine if this version of the engine is equal to or greater than the earliest version of the engine capable of opening that database.
private  void openScript()
          Method declaration
(package private)  Cache openTextCache(java.lang.String table, java.lang.String source, boolean readOnlyData, boolean reversed)
           
private static java.lang.String readLine(java.io.LineNumberReader r)
          Method declaration
private  void renameNewToCurrent(java.lang.String file)
          Method declaration
(package private)  void reopenAllTextCaches()
           
private  void restoreBackup()
          Method declaration
 void run()
          Method declaration
private  void runScript()
          Method declaration
(package private) static void scriptToFile(Database db, java.lang.String file, boolean full, Session session)
          Method declaration
(package private)  void setLogSize(int mb)
          Method declaration
(package private)  void setWriteDelay(boolean delay)
          Method declaration
(package private)  void shutdown()
          Method declaration
(package private)  void shutdownAllTextCaches()
           
(package private)  void stop()
          Method declaration
(package private)  void write(Session c, java.lang.String s)
          Method declaration
private static int writeLine(java.io.Writer w, java.lang.String s)
           
private  void writeScript(boolean full)
          Method declaration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPY_BLOCK_SIZE

private static final int COPY_BLOCK_SIZE
See Also:
Constant Field Values

pProperties

private HsqlDatabaseProperties pProperties

sName

private java.lang.String sName

dDatabase

private Database dDatabase

sysSession

private Session sysSession

wScript

private java.io.Writer wScript

scriptChecker

private java.io.File scriptChecker

sFileScript

private java.lang.String sFileScript

sFileCache

private java.lang.String sFileCache

sFileBackup

private java.lang.String sFileBackup

bRestoring

private boolean bRestoring

bReadOnly

private boolean bReadOnly

iLogSize

private int iLogSize

iLogCount

private int iLogCount

tRunner

private java.lang.Thread tRunner

bNeedFlush

private volatile boolean bNeedFlush

bWriteDelay

private volatile boolean bWriteDelay

mLastId

private int mLastId

cCache

private Cache cCache

lineSep

private static final java.lang.String lineSep
Method declaration


textCacheList

private java.util.Hashtable textCacheList
Constructor Detail

Log

Log(Database db,
    Session system,
    java.lang.String name)
throws java.sql.SQLException
Constructor declaration

Method Detail

run

public void run()
Method declaration

Specified by:
run in interface java.lang.Runnable

setWriteDelay

void setWriteDelay(boolean delay)
Method declaration


open

boolean open()
       throws java.sql.SQLException
When opening a database, the hsqldb.compatible_version property is used to determine if this version of the engine is equal to or greater than the earliest version of the engine capable of opening that database.


getCache

Cache getCache()
         throws java.sql.SQLException

stop

void stop()
Method declaration


close

void close(boolean compact)
     throws java.sql.SQLException
Method declaration


checkpoint

void checkpoint()
          throws java.sql.SQLException
Method declaration


setLogSize

void setLogSize(int mb)
Method declaration


write

void write(Session c,
           java.lang.String s)
     throws java.sql.SQLException
Method declaration


shutdown

void shutdown()
        throws java.sql.SQLException
Method declaration


scriptToFile

static void scriptToFile(Database db,
                         java.lang.String file,
                         boolean full,
                         Session session)
                  throws java.sql.SQLException
Method declaration


renameNewToCurrent

private void renameNewToCurrent(java.lang.String file)
Method declaration


create

private void create()
             throws java.sql.SQLException

isAlreadyOpen

private boolean isAlreadyOpen()
                       throws java.sql.SQLException
Method declaration


backup

private void backup()
             throws java.sql.SQLException
Saves the *.data file as compressed *.backup.


restoreBackup

private void restoreBackup()
                    throws java.sql.SQLException
Method declaration


openScript

private void openScript()
                 throws java.sql.SQLException
Method declaration


closeScript

private void closeScript()
                  throws java.sql.SQLException
Method declaration


runScript

private void runScript()
                throws java.sql.SQLException
Method declaration


writeScript

private void writeScript(boolean full)
                  throws java.sql.SQLException
Method declaration


writeLine

private static int writeLine(java.io.Writer w,
                             java.lang.String s)
                      throws java.io.IOException

readLine

private static java.lang.String readLine(java.io.LineNumberReader r)
                                  throws java.io.IOException
Method declaration


getProperties

HsqlDatabaseProperties getProperties()
Method declaration


openTextCache

Cache openTextCache(java.lang.String table,
                    java.lang.String source,
                    boolean readOnlyData,
                    boolean reversed)
              throws java.sql.SQLException

closeTextCache

void closeTextCache(java.lang.String table)
              throws java.sql.SQLException

closeAllTextCaches

void closeAllTextCaches(boolean compact)
                  throws java.sql.SQLException

reopenAllTextCaches

void reopenAllTextCaches()
                   throws java.sql.SQLException

shutdownAllTextCaches

void shutdownAllTextCaches()
                     throws java.sql.SQLException