| java.lang.Object org.hsqldb.scriptio.ScriptWriterBase
All known Subclasses: org.hsqldb.scriptio.ScriptWriterText, org.hsqldb.scriptio.ScriptWriterBinary,
ScriptWriterBase | abstract public class ScriptWriterBase implements Runnable(Code) | | Handles all logging to file operations. A log consists of three 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. In versions up to 1.7.2, this data is written
to the *.script file for the database. Since 1.7.2 the data can also be
written as binray in order to speed up shutdown and startup.
In 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.
author: fredt@users version: 1.8.0 since: 1.7.2 |
Method Summary | |
abstract protected void | addSessionId(Session session) | public void | close() | protected void | finishStream() This is not really useful in the current usage but may be if this
class is used in a different way. | public int | getWriteDelay() | abstract protected void | initBuffers() | public static ScriptWriterBase | newScriptWriter(Database db, String file, boolean includeCachedData, boolean newFile, int scriptType) | protected void | openFile() | public void | reopen() | public void | run() | public void | setWriteDelay(int delay) | public long | size() | public void | start() | public void | stop() | public synchronized void | sync() Called internally or externally in write delay intervals. | public void | writeAll() | abstract public void | writeCommitStatement(Session session) | protected void | writeDDL() | abstract protected void | writeDataTerm() | abstract public void | writeDeleteStatement(Session session, Table table, Object[] data) | protected void | writeExistingData() | abstract public void | writeInsertStatement(Session session, Table table, Object[] data) | abstract public void | writeLogStatement(Session session, String s) | abstract void | writeRow(Session session, Table table, Object[] data) | abstract public void | writeSequenceStatement(Session session, NumberSequence seq) | protected void | writeSingleColumnResult(Result r) | protected void | writeTableInit(Table t) | protected void | writeTableTerm(Table t) |
INSERT | final static int INSERT(Code) | | |
INSERT_WITH_SCHEMA | final static int INSERT_WITH_SCHEMA(Code) | | |
LIST_SCRIPT_FORMATS | final public static String[] LIST_SCRIPT_FORMATS(Code) | | |
SCRIPT_BINARY_172 | final public static int SCRIPT_BINARY_172(Code) | | |
SCRIPT_TEXT_170 | final public static int SCRIPT_TEXT_170(Code) | | |
SCRIPT_ZIPPED_BINARY_172 | final public static int SCRIPT_ZIPPED_BINARY_172(Code) | | |
busyWriting | volatile boolean busyWriting(Code) | | |
byteCount | long byteCount(Code) | | |
currentSession | Session currentSession(Code) | | the last schema for last sessionId
|
forceSync | volatile boolean forceSync(Code) | | |
includeCachedData | boolean includeCachedData(Code) | | |
isDump | boolean isDump(Code) | | this determines if the script is the normal script (false) used
internally by the engine or a user-initiated snapshot of the DB (true)
|
needsSync | volatile boolean needsSync(Code) | | |
schemaToLog | HsqlName schemaToLog(Code) | | |
tableRowCount | int tableRowCount(Code) | | |
writeDelay | protected volatile int writeDelay(Code) | | |
ScriptWriterBase | ScriptWriterBase()(Code) | | |
finishStream | protected void finishStream() throws IOException(Code) | | This is not really useful in the current usage but may be if this
class is used in a different way.
|
getWriteDelay | public int getWriteDelay()(Code) | | |
initBuffers | abstract protected void initBuffers()(Code) | | |
openFile | protected void openFile() throws HsqlException(Code) | | File is opened in append mode although in current usage the file
never pre-exists
|
setWriteDelay | public void setWriteDelay(int delay)(Code) | | |
start | public void start()(Code) | | |
sync | public synchronized void sync()(Code) | | Called internally or externally in write delay intervals.
|
|
|