CopyBuffer
Buffer for storing data in memory in a format that can be passed to the Postgres COPY operation. The caller is responsible for knowing the table format and putting values in the expected order. Typical usage:
val buffer = ...
rows.foreach { row =>
buffer.putString(row.column(1)).putInt(row.column(2))
if (!buffer.nextRow()) {
buffer.copyIn(copyManager, tableName)
buffer.putString(row.column(1)).putInt(row.column(2)).nextRow()
}
}
buffer.copyIn(copyManager, tableName)
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class BinaryCopyBufferclass TextCopyBuffer
Members list
Value members
Abstract methods
Clear the contents of the buffer so it can be reused.
Clear the contents of the buffer so it can be reused.
Attributes
Copy the data in this buffer into the specified table.
Copy the data in this buffer into the specified table.
Attributes
Returns true if there is space remaining in the buffer.
Returns true if there is space remaining in the buffer.
Attributes
Indicate the end of the row and prepare for the next. Returns true if the row was able to fit in the buffer. Otherwise the buffer should be copied to Postgres and cleared before re-adding the row.
Indicate the end of the row and prepare for the next. Returns true if the row was able to fit in the buffer. Otherwise the buffer should be copied to Postgres and cleared before re-adding the row.
If a single row is too big to fit in the buffer, then an IllegalStateException will be thrown to avoid an endless loop.
Attributes
Put an 8-byte floating point column value into the buffer.
Put an 8-byte floating point column value into the buffer.
Attributes
Put an array of 8-byte floating point column value into the buffer.
Put an array of 8-byte floating point column value into the buffer.
Attributes
Put an id column value into the buffer.
Put an id column value into the buffer.
Attributes
Put a signed 4-byte integer column value into the buffer.
Put a signed 4-byte integer column value into the buffer.
Attributes
Put a signed 8-byte integer column value into the buffer.
Put a signed 8-byte integer column value into the buffer.
Attributes
Put a signed 2-byte integer column value into the buffer.
Put a signed 2-byte integer column value into the buffer.
Attributes
Put a string column value into the buffer.
Put a string column value into the buffer.
Attributes
Put an HSTORE column value into the buffer.
Put an HSTORE column value into the buffer.
Attributes
Put a JSON column value into the buffer.
Put a JSON column value into the buffer.
Attributes
Put a JSONB column value into the buffer.
Put a JSONB column value into the buffer.
Attributes
Put a JSON string column value as text into the buffer.
Put a JSON string column value as text into the buffer.
Attributes
Returns the number of bytes remaining in the buffer.
Returns the number of bytes remaining in the buffer.
Attributes
Returns the number of completed rows that are in the buffer.
Returns the number of completed rows that are in the buffer.