public class CopyStatement extends IntermediatePortalStatement
CopyStatement models a COPY table FROM STDIN
statement. The same class is used both as
an IntermediatePreparedStatement and IntermediatePortalStatement, as COPY does
not support any statement parameters, which means that there is no difference between the two.
Inheritance
java.lang.Object > IntermediateStatement > IntermediatePreparedStatement > IntermediatePortalStatement > CopyStatementStatic Methods
create(ConnectionHandler connectionHandler, OptionsMetadata options, String name, AbstractStatementParser.ParsedStatement parsedStatement, Statement originalStatement)
public static IntermediatePortalStatement create(ConnectionHandler connectionHandler, OptionsMetadata options, String name, AbstractStatementParser.ParsedStatement parsedStatement, Statement originalStatement)
Name | Description |
connectionHandler | ConnectionHandler |
options | OptionsMetadata |
name | String |
parsedStatement | ParsedStatement |
originalStatement | com.google.cloud.spanner.Statement |
Type | Description |
IntermediatePortalStatement |
Constructors
CopyStatement(ConnectionHandler connectionHandler, OptionsMetadata options, String name, AbstractStatementParser.ParsedStatement parsedStatement, Statement originalStatement, CopyStatement.ParsedCopyStatement parsedCopyStatement)
public CopyStatement(ConnectionHandler connectionHandler, OptionsMetadata options, String name, AbstractStatementParser.ParsedStatement parsedStatement, Statement originalStatement, CopyStatement.ParsedCopyStatement parsedCopyStatement)
Name | Description |
connectionHandler | ConnectionHandler |
options | OptionsMetadata |
name | String |
parsedStatement | ParsedStatement |
originalStatement | com.google.cloud.spanner.Statement |
parsedCopyStatement | com.google.cloud.spanner.pgadapter.statements.CopyStatement.ParsedCopyStatement |
Methods
close()
public void close()
Cleanly close the statement. Does nothing if the statement has not been executed or has no result.
Type | Description |
Exception |
createPortal(String name, byte[][] parameters, List<Short> parameterFormatCodes, List<Short> resultFormatCodes)
public IntermediatePortalStatement createPortal(String name, byte[][] parameters, List<Short> parameterFormatCodes, List<Short> resultFormatCodes)
Creates a portal from this statement.
Name | Description |
name | String |
parameters | byte[][] |
parameterFormatCodes | List<Short> |
resultFormatCodes | List<Short> |
Type | Description |
IntermediatePortalStatement |
executeAsync(BackendConnection backendConnection)
public void executeAsync(BackendConnection backendConnection)
Name | Description |
backendConnection | BackendConnection |
getCopyColumnNames()
public List<SimpleParser.TableOrIndexName> getCopyColumnNames()
Type | Description |
List<com.google.cloud.spanner.pgadapter.statements.SimpleParser.TableOrIndexName> | List of column names specified in COPY statement, if provided. |
getDelimiterChar()
public char getDelimiterChar()
Type | Description |
char | Delimiter character specified in COPY statement, if provided. |
getEscapeChar()
public char getEscapeChar()
Type | Description |
char | Escape character specified in COPY statement, if provided. |
getFormatCode()
public int getFormatCode()
Type | Description |
int | 0 for text/csv formatting and 1 for binary |
getFormatType()
public String getFormatType()
Type | Description |
String | Format type specified in COPY statement, if provided. |
getMutationWriter()
public MutationWriter getMutationWriter()
Type | Description |
MutationWriter |
getNullString()
public String getNullString()
Type | Description |
String | Null string specified in COPY statement, if provided. |
getParserFormat()
public CSVFormat getParserFormat()
Type | Description |
org.apache.commons.csv.CSVFormat |
getQuoteChar()
public char getQuoteChar()
Type | Description |
char | Quote character specified in COPY statement, if provided. |
getStatementType()
public AbstractStatementParser.StatementType getStatementType()
Type | Description |
StatementType |
getTableColumns()
public Map<String,Type> getTableColumns()
Type | Description |
Map<String,com.google.cloud.spanner.Type> | Mapping of table column names to column type. |
getTableName()
public SimpleParser.TableOrIndexName getTableName()
Type | Description |
com.google.cloud.spanner.pgadapter.statements.SimpleParser.TableOrIndexName |
getUpdateCount()
public long getUpdateCount()
Type | Description |
long |
hasException()
public boolean hasException()
Type | Description |
boolean |
hasHeader()
public boolean hasHeader()
Type | Description |
boolean | True if copy data contains a header, false otherwise. |
setParserFormat(CopyStatement.ParsedCopyStatement parsedCopyStatement)
public void setParserFormat(CopyStatement.ParsedCopyStatement parsedCopyStatement)
CSVFormat for parsing copy data based on COPY statement options specified.
Name | Description |
parsedCopyStatement | com.google.cloud.spanner.pgadapter.statements.CopyStatement.ParsedCopyStatement |