org.hsqldb.scriptio
Class ScriptWriterText

java.lang.Object
  extended byorg.hsqldb.scriptio.ScriptWriterBase
      extended byorg.hsqldb.scriptio.ScriptWriterText

public class ScriptWriterText
extends ScriptWriterBase

Handles all logging to file operations. A log consists of three blocks:

LOG BLOCK: SQL statements logged since startup or the last CHECKPOINT
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.

Since:
1.7.2
Version:
1.7.2
Author:
fredt@users

Field Summary
static byte[] BYTES_LINE_SEP
           
 
Fields inherited from class org.hsqldb.scriptio.ScriptWriterBase
LIST_SCRIPT_FORMATS, SCRIPT_BINARY_172, SCRIPT_TEXT_170, SCRIPT_ZIPPED_BINARY_172
 
Constructor Summary
ScriptWriterText(Database db, String file, boolean includeCachedData, boolean newFile)
           
 
Method Summary
protected  void initBuffers()
           
protected  void openFile()
          File is opened in append mode although in current usage the file never pre-exists
protected  void writeDataTerm()
           
 void writeDeleteStatement(int sid, Table table, Object[] data)
           
 void writeLogStatement(String s, int sid)
           
 void writeRow(int sid, Table table, Object[] data)
           
 void writeSequenceStatement(int sid, NumberSequence seq)
           
protected  void writeSessionId(int sid)
           
 
Methods inherited from class org.hsqldb.scriptio.ScriptWriterBase
close, finishStream, newScriptWriter, setWriteDelay, size, sync, writeAll, writeDDL, writeExistingData, writeSingleColumnResult, writeTableInit, writeTableTerm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTES_LINE_SEP

public static byte[] BYTES_LINE_SEP
Constructor Detail

ScriptWriterText

public ScriptWriterText(Database db,
                        String file,
                        boolean includeCachedData,
                        boolean newFile)
                 throws HsqlException
Method Detail

initBuffers

protected void initBuffers()
Specified by:
initBuffers in class ScriptWriterBase

openFile

protected void openFile()
                 throws HsqlException
File is opened in append mode although in current usage the file never pre-exists

Overrides:
openFile in class ScriptWriterBase
Throws:
HsqlException

writeRow

public void writeRow(int sid,
                     Table table,
                     Object[] data)
              throws HsqlException,
                     IOException
Throws:
HsqlException
IOException

writeDataTerm

protected void writeDataTerm()
                      throws IOException
Specified by:
writeDataTerm in class ScriptWriterBase
Throws:
IOException

writeSessionId

protected void writeSessionId(int sid)
                       throws IOException
Specified by:
writeSessionId in class ScriptWriterBase
Throws:
IOException

writeLogStatement

public void writeLogStatement(String s,
                              int sid)
                       throws IOException,
                              HsqlException
Throws:
IOException
HsqlException

writeDeleteStatement

public void writeDeleteStatement(int sid,
                                 Table table,
                                 Object[] data)
                          throws HsqlException,
                                 IOException
Throws:
HsqlException
IOException

writeSequenceStatement

public void writeSequenceStatement(int sid,
                                   NumberSequence seq)
                            throws HsqlException,
                                   IOException
Throws:
HsqlException
IOException


Copyright © 2001 - 2004 HSQL Development Group. All Rights Reserved.