|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hsqldb.scriptio.ScriptWriterBase
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.
Field Summary | |
static String[] |
LIST_SCRIPT_FORMATS
|
static int |
SCRIPT_BINARY_172
|
static int |
SCRIPT_TEXT_170
|
static int |
SCRIPT_ZIPPED_BINARY_172
|
Method Summary | |
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. |
protected abstract void |
initBuffers()
|
static ScriptWriterBase |
newScriptWriter(Database db,
String file,
boolean includeCachedData,
boolean newFile,
int scriptType)
|
protected void |
openFile()
File is opened in append mode although in current usage the file never pre-exists |
void |
setWriteDelay(int delay)
Not used in current implementation. |
long |
size()
|
void |
sync()
Called externally in write delay intervals. |
void |
writeAll()
|
protected abstract void |
writeDataTerm()
|
protected void |
writeDDL()
|
protected void |
writeExistingData()
|
protected abstract void |
writeSessionId(int sid)
|
protected void |
writeSingleColumnResult(Result r)
|
protected void |
writeTableInit(Table t)
|
protected void |
writeTableTerm(Table t)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static String[] LIST_SCRIPT_FORMATS
public static final int SCRIPT_TEXT_170
public static final int SCRIPT_BINARY_172
public static final int SCRIPT_ZIPPED_BINARY_172
Method Detail |
public static ScriptWriterBase newScriptWriter(Database db, String file, boolean includeCachedData, boolean newFile, int scriptType) throws HsqlException
HsqlException
protected abstract void initBuffers()
public void setWriteDelay(int delay)
public void sync()
public void close() throws HsqlException
HsqlException
public long size()
public void writeAll() throws HsqlException
HsqlException
protected void openFile() throws HsqlException
HsqlException
protected void finishStream() throws IOException
IOException
protected void writeDDL() throws IOException, HsqlException
IOException
HsqlException
protected void writeExistingData() throws HsqlException, IOException
HsqlException
IOException
protected void writeTableInit(Table t) throws HsqlException, IOException
HsqlException
IOException
protected void writeTableTerm(Table t) throws HsqlException, IOException
HsqlException
IOException
protected void writeSingleColumnResult(Result r) throws HsqlException, IOException
HsqlException
IOException
protected abstract void writeDataTerm() throws IOException
IOException
protected abstract void writeSessionId(int sid) throws IOException
IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |