Class CopyStatement (0.14.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.

Static 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)
Parameters
NameDescription
connectionHandlerConnectionHandler
optionsOptionsMetadata
nameString
parsedStatementParsedStatement
originalStatementcom.google.cloud.spanner.Statement
Returns
TypeDescription
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)
Parameters
NameDescription
connectionHandlerConnectionHandler
optionsOptionsMetadata
nameString
parsedStatementParsedStatement
originalStatementcom.google.cloud.spanner.Statement
parsedCopyStatementcom.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.

Overrides Exceptions
TypeDescription
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.

Parameters
NameDescription
nameString
parametersbyte[][]
parameterFormatCodesList<Short>
resultFormatCodesList<Short>
Returns
TypeDescription
IntermediatePortalStatement
Overrides

executeAsync(BackendConnection backendConnection)

public void executeAsync(BackendConnection backendConnection)
Parameter
NameDescription
backendConnectionBackendConnection
Overrides

getCopyColumnNames()

public List<SimpleParser.TableOrIndexName> getCopyColumnNames()
Returns
TypeDescription
List<com.google.cloud.spanner.pgadapter.statements.SimpleParser.TableOrIndexName>

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

getDelimiterChar()

public char getDelimiterChar()
Returns
TypeDescription
char

Delimiter character specified in COPY statement, if provided.

getEscapeChar()

public char getEscapeChar()
Returns
TypeDescription
char

Escape character specified in COPY statement, if provided.

getFormatCode()

public int getFormatCode()
Returns
TypeDescription
int

0 for text/csv formatting and 1 for binary

getFormatType()

public String getFormatType()
Returns
TypeDescription
String

Format type specified in COPY statement, if provided.

getMutationWriter()

public MutationWriter getMutationWriter()
Returns
TypeDescription
MutationWriter

getNullString()

public String getNullString()
Returns
TypeDescription
String

Null string specified in COPY statement, if provided.

getParserFormat()

public CSVFormat getParserFormat()
Returns
TypeDescription
org.apache.commons.csv.CSVFormat

getQuoteChar()

public char getQuoteChar()
Returns
TypeDescription
char

Quote character specified in COPY statement, if provided.

getStatementType()

public AbstractStatementParser.StatementType getStatementType()
Returns
TypeDescription
StatementType
Overrides

getTableColumns()

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

Mapping of table column names to column type.

getTableName()

public SimpleParser.TableOrIndexName getTableName()
Returns
TypeDescription
com.google.cloud.spanner.pgadapter.statements.SimpleParser.TableOrIndexName

getUpdateCount()

public long getUpdateCount()
Returns
TypeDescription
long
Overrides

hasException()

public boolean hasException()
Returns
TypeDescription
boolean
Overrides

hasHeader()

public boolean hasHeader()
Returns
TypeDescription
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.

Parameter
NameDescription
parsedCopyStatementcom.google.cloud.spanner.pgadapter.statements.CopyStatement.ParsedCopyStatement