1 30 31 32 package org.hsqldb.scriptio; 33 34 import java.io.IOException ; 35 36 import org.hsqldb.Database; 37 import org.hsqldb.HsqlException; 38 import org.hsqldb.NumberSequence; 39 import org.hsqldb.Result; 40 import org.hsqldb.Session; 41 import org.hsqldb.Table; 42 import org.hsqldb.rowio.RowOutputBinary; 43 44 49 class ScriptWriterBinary extends ScriptWriterBase { 50 51 RowOutputBinary rowOut; 52 53 ScriptWriterBinary(Database db, String file, boolean includeCached, 54 boolean newFile) throws HsqlException { 55 super(db, file, includeCached, newFile, false); 56 } 57 58 protected void initBuffers() { 59 rowOut = new RowOutputBinary(); 60 } 61 62 protected void writeSingleColumnResult(Result r) 63 throws IOException , HsqlException { 64 Result.write(r, rowOut, fileStreamOut); 65 } 66 67 protected void writeRow(Session session, Table t, 70 Object [] data) throws IOException , HsqlException { 71 72 rowOut.reset(); 73 rowOut.writeRow(data, t); 74 fileStreamOut.write(rowOut.getBuffer(), 0, rowOut.size()); 75 76 tableRowCount++; 77 } 78 79 protected void writeTableInit(Table t) throws HsqlException, IOException { 81 82 tableRowCount = 0; 83 84 rowOut.reset(); 85 rowOut.writeSize(0); 86 rowOut.writeString(t.getName().name); 87 rowOut.writeIntData(INSERT_WITH_SCHEMA); 88 rowOut.writeString(t.getSchemaName()); 89 rowOut.writeIntData(rowOut.size(), 0); 90 fileStreamOut.write(rowOut.getBuffer(), 0, rowOut.size()); 91 } 92 93 protected void writeTableTerm(Table t) throws IOException { 94 95 rowOut.reset(); 96 rowOut.writeSize(0); 97 rowOut.writeIntData(this.tableRowCount); 98 fileStreamOut.write(rowOut.getBuffer(), 0, rowOut.size()); 99 } 100 101 protected void writeDataTerm() throws IOException { 102 103 rowOut.reset(); 104 rowOut.writeSize(0); 105 fileStreamOut.write(rowOut.getBuffer(), 0, rowOut.size()); 106 } 107 108 public void writeLogStatement(Session session, 109 String s) 110 throws IOException , HsqlException {} 111 112 protected void addSessionId(Session session) throws IOException {} 113 114 public void writeDeleteStatement(Session session, Table table, 115 Object [] ddata) 116 throws HsqlException, IOException {} 117 118 public void writeSequenceStatement(Session session, 119 NumberSequence seq) 120 throws HsqlException, IOException {} 121 122 public void writeInsertStatement(Session session, Table table, 123 Object [] data) 124 throws HsqlException, IOException {} 125 126 public void writeCommitStatement(Session session) 127 throws HsqlException, IOException {} 128 } 129 | Popular Tags |