org.apache.derby.impl.load
Class Export

java.lang.Object
  extended by org.apache.derby.impl.load.ExportAbstract
      extended by org.apache.derby.impl.load.Export

public class Export
extends ExportAbstract

This class provides ways to export data from a table or a view into a file. Export functions provided in this class are called through Systement Procedures.


Field Summary
private  java.lang.String lobsFileName
           
private  java.lang.String outputFileName
           
 
Fields inherited from class org.apache.derby.impl.load.ExportAbstract
con, controlFileReader, entityName, exportResultSetForObject, exportWriteData, lobsInExtFile, schemaName, selectStatement
 
Constructor Summary
private Export(java.sql.Connection con, java.lang.String schemaName, java.lang.String tableName, java.lang.String selectStatement, java.lang.String outputFileName, java.lang.String characterDelimeter, java.lang.String columnDelimeter, java.lang.String codeset)
           
 
Method Summary
private  boolean dataFileExists(java.lang.String fileName)
          Checks whether the data file exists .
private  void doExport()
           
static void exportQuery(java.sql.Connection con, java.lang.String selectStatement, java.lang.String outputFileName, java.lang.String columnDelimeter, java.lang.String characterDelimeter, java.lang.String codeset)
          SYSCS_EXPORT_QUERY system Procedure from ij or from a Java application invokes this method to perform export of the data retrieved by select statement to a file.
static void exportQuery(java.sql.Connection con, java.lang.String selectStatement, java.lang.String outputFileName, java.lang.String columnDelimeter, java.lang.String characterDelimeter, java.lang.String codeset, java.lang.String lobsFileName)
          SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE system Procedure from ij or from a Java application invokes this method to perform export of the data retrieved by select statement to a file.
static void exportTable(java.sql.Connection con, java.lang.String schemaName, java.lang.String tableName, java.lang.String outputFileName, java.lang.String columnDelimeter, java.lang.String characterDelimeter, java.lang.String codeset)
          SYSCS_EXPORT_TABLE system Procedure from ij or from a Java application invokes this method to perform export of a table data to a file.
static void exportTable(java.sql.Connection con, java.lang.String schemaName, java.lang.String tableName, java.lang.String outputFileName, java.lang.String columnDelimeter, java.lang.String characterDelimeter, java.lang.String codeset, java.lang.String lobsFileName)
          SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE system procedure from ij or from a Java application invokes this method to perform export of a table data to a file.
private  boolean fileExists(java.io.File file)
          Checks if the specified file exists.
protected  ExportWriteDataAbstract getExportWriteData()
          For internal use only
private  boolean lobsFileExists(java.lang.String fileName)
          Checks whether the lobs file exists .
private  void setLobsExtFileName(java.lang.String lobsFileName)
          Set the file name to which larg object data has to be exported, and also set flag to indicate that large objects are exported to a different file.
 
Methods inherited from class org.apache.derby.impl.load.ExportAbstract
doAllTheWork, getControlFileReader, resultSetForEntity, stringifyObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputFileName

private java.lang.String outputFileName

lobsFileName

private java.lang.String lobsFileName
Constructor Detail

Export

private Export(java.sql.Connection con,
               java.lang.String schemaName,
               java.lang.String tableName,
               java.lang.String selectStatement,
               java.lang.String outputFileName,
               java.lang.String characterDelimeter,
               java.lang.String columnDelimeter,
               java.lang.String codeset)
        throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

doExport

private void doExport()
               throws java.sql.SQLException
Throws:
java.sql.SQLException

setLobsExtFileName

private void setLobsExtFileName(java.lang.String lobsFileName)
                         throws java.sql.SQLException
Set the file name to which larg object data has to be exported, and also set flag to indicate that large objects are exported to a different file.

Parameters:
lobsFileName - the file to to which lob data has to be exported.
Throws:
java.sql.SQLException - if file name is null.

lobsFileExists

private boolean lobsFileExists(java.lang.String fileName)
                        throws java.sql.SQLException
Checks whether the lobs file exists .

Parameters:
fileName - the file to to which lob data has to be exported.
Throws:
java.sql.SQLException - if file name is null.

dataFileExists

private boolean dataFileExists(java.lang.String fileName)
                        throws java.sql.SQLException
Checks whether the data file exists .

Parameters:
fileName - the file to to which lob data has to be exported.
Throws:
java.sql.SQLException - if file name is null.

fileExists

private final boolean fileExists(java.io.File file)
Checks if the specified file exists.

Parameters:
file - the file to check
Returns:
true if the file exists, false if not.
Throws:
java.lang.SecurityException - if the required privileges are missing

exportTable

public static void exportTable(java.sql.Connection con,
                               java.lang.String schemaName,
                               java.lang.String tableName,
                               java.lang.String outputFileName,
                               java.lang.String columnDelimeter,
                               java.lang.String characterDelimeter,
                               java.lang.String codeset)
                        throws java.sql.SQLException
SYSCS_EXPORT_TABLE system Procedure from ij or from a Java application invokes this method to perform export of a table data to a file.

Parameters:
con - The Derby database connection URL for the database containing the table
schemaName - schema name of the table data is being exported from
tableName - Name of the Table from which data has to be exported.
outputFileName - Name of the file to which data has to be exported.
columnDelimeter - Delimiter that seperates columns in the output file
characterDelimeter - Delimiter that is used to quoate non-numeric types
codeset - Codeset that should be used to write the data to the file
Throws:
SQL - Exception on errors
java.sql.SQLException

exportTable

public static void exportTable(java.sql.Connection con,
                               java.lang.String schemaName,
                               java.lang.String tableName,
                               java.lang.String outputFileName,
                               java.lang.String columnDelimeter,
                               java.lang.String characterDelimeter,
                               java.lang.String codeset,
                               java.lang.String lobsFileName)
                        throws java.sql.SQLException
SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE system procedure from ij or from a Java application invokes this method to perform export of a table data to a file. Large object data is exported to a different file and the reference to it is stored in the main output file.

Parameters:
con - The Derby database connection URL for the database containing the table
schemaName - schema name of the table data is being exported from
tableName - Name of the Table from which data has to be exported.
outputFileName - Name of the file to which data has to be exported.
columnDelimeter - Delimiter that seperates columns in the output file.
characterDelimeter - Delimiter that is used to quote non-numeric types.
codeset - Codeset that should be used to write the data to the file/
lobsFileName - Name of the file to which large object data has to be exported.
Throws:
SQL - Exception on errors
java.sql.SQLException

exportQuery

public static void exportQuery(java.sql.Connection con,
                               java.lang.String selectStatement,
                               java.lang.String outputFileName,
                               java.lang.String columnDelimeter,
                               java.lang.String characterDelimeter,
                               java.lang.String codeset)
                        throws java.sql.SQLException
SYSCS_EXPORT_QUERY system Procedure from ij or from a Java application invokes this method to perform export of the data retrieved by select statement to a file.

Parameters:
con - The Derby database connection URL for the database containing the table
selectStatement - select query that is used to export the data
outputFileName - Name of the file to which data has to be exported.
columnDelimeter - Delimiter that seperates columns in the output file
characterDelimeter - Delimiter that is used to quiote non-numeric types
codeset - Codeset that should be used to write the data to the file
Throws:
SQL - Exception on errors
java.sql.SQLException

exportQuery

public static void exportQuery(java.sql.Connection con,
                               java.lang.String selectStatement,
                               java.lang.String outputFileName,
                               java.lang.String columnDelimeter,
                               java.lang.String characterDelimeter,
                               java.lang.String codeset,
                               java.lang.String lobsFileName)
                        throws java.sql.SQLException
SYSCS_EXPORT_QUERY_LOBS_TO_EXTFILE system Procedure from ij or from a Java application invokes this method to perform export of the data retrieved by select statement to a file. Large object data is exported to a different file and the reference to it is stored in the main output file.

Parameters:
con - The Derby database connection URL for the database containing the table
selectStatement - select query that is used to export the data
outputFileName - Name of the file to which data has to be exported.
columnDelimeter - Delimiter that seperates columns in the output file
characterDelimeter - Delimiter that is used to quote non-numeric types
codeset - Codeset that should be used to write the data to the file
lobsFileName - Name of the file to which large object data has to be exported.
Throws:
SQL - Exception on errors
java.sql.SQLException

getExportWriteData

protected ExportWriteDataAbstract getExportWriteData()
                                              throws java.lang.Exception
For internal use only

Specified by:
getExportWriteData in class ExportAbstract
Throws:
java.lang.Exception - if there is an error

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.