Class CopyStatement (0.6.1)

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.

Constructors

CopyStatement(ConnectionHandler connectionHandler, OptionsMetadata options, String name, AbstractStatementParser.ParsedStatement parsedStatement, Statement originalStatement)

public CopyStatement(ConnectionHandler connectionHandler, OptionsMetadata options, String name, AbstractStatementParser.ParsedStatement parsedStatement, Statement originalStatement)
Parameters
Name Description
connectionHandler ConnectionHandler
options OptionsMetadata
name String
parsedStatement ParsedStatement
originalStatement com.google.cloud.spanner.Statement

Methods

bind(String name, byte[][] parameters, List<Short> parameterFormatCodes, List<Short> resultFormatCodes)

public IntermediatePortalStatement bind(String name, byte[][] parameters, List<Short> parameterFormatCodes, List<Short> resultFormatCodes)

Bind this statement (that is to say, transform it into a portal by giving it the data items to complete the statement.

Parameters
Name Description
name String
parameters byte[][]
parameterFormatCodes List<Short>
resultFormatCodes List<Short>
Returns
Type Description
IntermediatePortalStatement
Overrides

close()

public void close()

Cleanly close the statement. Does nothing if the statement has not been executed or has no result.

Overrides Exceptions
Type Description
Exception

executeAsync(BackendConnection backendConnection)

public void executeAsync(BackendConnection backendConnection)
Parameter
Name Description
backendConnection BackendConnection
Overrides

getCopyColumnNames()

public List<String> getCopyColumnNames()
Returns
Type Description
List<String>

List of column names specified in COPY statement, if provided.

getDelimiterChar()

public char getDelimiterChar()
Returns
Type Description
char

Delimiter character specified in COPY statement, if provided.

getEscapeChar()

public char getEscapeChar()
Returns
Type Description
char

Escape character specified in COPY statement, if provided.

getException()

public SpannerException getException()

Returns any execution exception registered for this statement.

Returns
Type Description
com.google.cloud.spanner.SpannerException
Overrides

getFormatCode()

public int getFormatCode()
Returns
Type Description
int

0 for text/csv formatting and 1 for binary

getFormatType()

public String getFormatType()
Returns
Type Description
String

Format type specified in COPY statement, if provided.

getMutationWriter()

public MutationWriter getMutationWriter()
Returns
Type Description
MutationWriter

getNullString()

public String getNullString()
Returns
Type Description
String

Null string specified in COPY statement, if provided.

getParserFormat()

public CSVFormat getParserFormat()
Returns
Type Description
org.apache.commons.csv.CSVFormat

getQuoteChar()

public char getQuoteChar()
Returns
Type Description
char

Quote character specified in COPY statement, if provided.

getStatementType()

public AbstractStatementParser.StatementType getStatementType()
Returns
Type Description
StatementType
Overrides

getTableColumns()

public Map<String,Type> getTableColumns()
Returns
Type Description
Map<String,com.google.cloud.spanner.Type>

Mapping of table column names to column type.

getTableName()

public String getTableName()
Returns
Type Description
String

getUpdateCount()

public long getUpdateCount()
Returns
Type Description
long
Overrides

hasException()

public boolean hasException()
Returns
Type Description
boolean
Overrides

hasHeader()

public boolean hasHeader()
Returns
Type Description
boolean

True if copy data contains a header, false otherwise.

setParserFormat(CopyTreeParser.CopyOptions options)

public void setParserFormat(CopyTreeParser.CopyOptions options)

CSVFormat for parsing copy data based on COPY statement options specified.

Parameter
Name Description
options CopyTreeParser.CopyOptions