Class ScriptWriterBase
- java.lang.Object
-
- org.hsqldb.scriptio.ScriptWriterBase
-
- All Implemented Interfaces:
- java.lang.Runnable
- Direct Known Subclasses:
- ScriptWriterText
public abstract class ScriptWriterBase extends java.lang.Object implements java.lang.RunnableHandles all logging to file operations. A log consists of three kinds of blocks:DDL BLOCK: definition of DB objects, users and rights at startup time
DATA BLOCK: all data for MEMORY tables at startup time
LOG BLOCK: SQL statements logged since startup or the last CHECKPOINT
The implementation of this class and its subclasses support the formats used for writing the data. Since 1.7.2 the data can also be written as binray in order to speed up shutdown and startup.From 1.7.2, two separate files are used, one for the DDL + DATA BLOCK and the other for the LOG BLOCK.
A related use for this class is for saving a current snapshot of the database data to a user-defined file. This happens in the SHUTDOWN COMPACT process or done as a result of the SCRIPT command. In this case, the DATA block contains the CACHED table data as well.
DatabaseScriptReader and its subclasses read back the data at startup time.
- Since:
- 1.7.2
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String[]LIST_SCRIPT_FORMATS
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidclose()voidforceSync()intgetWriteDelay()voidrun()voidsetIncludeCachedData(boolean include)voidsetIncludeIndexRoots(boolean include)voidsetWriteDelay(int delay)longsize()voidstart()voidstop()voidsync()Called internally or externally in write delay intervals.voidwriteAll()abstract voidwriteCommitStatement(Session session)voidwriteDDL()abstract voidwriteDeleteStatement(Session session, Table table, java.lang.Object[] data)voidwriteExistingData()abstract voidwriteInsertStatement(Session session, Row row, Table table)abstract voidwriteLogStatement(Session session, java.lang.String s)abstract voidwriteOtherStatement(Session session, java.lang.String s)abstract voidwriteRow(Session session, Row row, Table table)abstract voidwriteSequenceStatement(Session session, NumberSequence seq)voidwriteTableInit(Table t)voidwriteTableTerm(Table t)
-
-
-
Method Detail
-
setIncludeIndexRoots
public void setIncludeIndexRoots(boolean include)
-
setIncludeCachedData
public void setIncludeCachedData(boolean include)
-
sync
public void sync()
Called internally or externally in write delay intervals.
-
forceSync
public void forceSync()
-
close
public void close()
-
size
public long size()
-
writeAll
public void writeAll()
-
writeDDL
public void writeDDL() throws java.io.IOException- Throws:
java.io.IOException
-
writeExistingData
public void writeExistingData() throws java.io.IOException- Throws:
java.io.IOException
-
writeTableInit
public void writeTableInit(Table t) throws java.io.IOException
- Throws:
java.io.IOException
-
writeTableTerm
public void writeTableTerm(Table t) throws java.io.IOException
- Throws:
java.io.IOException
-
writeRow
public abstract void writeRow(Session session, Row row, Table table) throws java.io.IOException
- Throws:
java.io.IOException
-
writeLogStatement
public abstract void writeLogStatement(Session session, java.lang.String s) throws java.io.IOException
- Throws:
java.io.IOException
-
writeOtherStatement
public abstract void writeOtherStatement(Session session, java.lang.String s) throws java.io.IOException
- Throws:
java.io.IOException
-
writeInsertStatement
public abstract void writeInsertStatement(Session session, Row row, Table table) throws java.io.IOException
- Throws:
java.io.IOException
-
writeDeleteStatement
public abstract void writeDeleteStatement(Session session, Table table, java.lang.Object[] data) throws java.io.IOException
- Throws:
java.io.IOException
-
writeSequenceStatement
public abstract void writeSequenceStatement(Session session, NumberSequence seq) throws java.io.IOException
- Throws:
java.io.IOException
-
writeCommitStatement
public abstract void writeCommitStatement(Session session) throws java.io.IOException
- Throws:
java.io.IOException
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
setWriteDelay
public void setWriteDelay(int delay)
-
start
public void start()
-
stop
public void stop()
-
getWriteDelay
public int getWriteDelay()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG