Package nl.cwi.monetdb.embedded.tables
Class MonetDBTable
java.lang.Object
nl.cwi.monetdb.embedded.env.AbstractConnectionResult
nl.cwi.monetdb.embedded.tables.MonetDBTable
- All Implemented Interfaces:
Closeable
,AutoCloseable
public final class MonetDBTable extends AbstractConnectionResult
Java representation of a MonetDB table. It's possible to perform several CRUD operations using the respective
provided interfaces.
- Author:
- Pedro Ferreira
-
Method Summary
Modifier and Type Method Description int
appendColumns(Object[] input)
Appends new rows to the table column-wise.protected void
closeResultImplementation()
Close the result set internally.MonetDBTableColumn[]
getAllColumnsMetadata()
Gets all columns metadata.void
getColumnDefaultValues(String[] input)
Gets the columns default values in an array.protected void
getColumnDefaultValuesInternal(String[] input)
void
getColumnDigits(int[] input)
Gets the column digits as an integer array.protected void
getColumnDigitsInternal(int[] input)
MonetDBTableColumn
getColumnMetadataByIndex(int index)
Gets a column metadata by index.MonetDBTableColumn
getColumnMetadataByName(String name)
Gets a column metadata by name.void
getColumnNames(String[] input)
Gets the columns names as a string array.protected void
getColumnNamesInternal(String[] input)
void
getColumnNullableIndexes(boolean[] input)
Gets the columns nullable indexes as an array.protected void
getColumnNullableIndexesInternal(boolean[] input)
void
getColumnScales(int[] input)
Gets the column scales as an integer array.protected void
getColumnScalesInternal(int[] input)
void
getColumnTypes(String[] input)
Gets the columns types as a string array.protected void
getColumnTypesInternal(String[] input)
void
getMappings(MonetDBToJavaMapping[] input)
Gets the Java mappings as a MonetDBToJavaMapping array.protected void
getMappingsInternal(MonetDBToJavaMapping[] input)
int
getNumberOfColumns()
Returns the number of columns in the result set.int
getNumberOfRows()
Gets the current number of rows in the table, or -1 if an error in the database has occurred.int
getRoundingMode()
Gets the current rounding mode for decimals in this table.String
getTableName()
Gets the table name.String
getTableSchema()
Gets the table schema name.int
iterateTable(IMonetDBTableCursor cursor)
Iterate over the table using aIMonetDBTableCursor
instance.void
setRoundingMode(int roundingMode)
Sets the current rounding mode for decimals in this table, from the rounding modes in the BigDecimal class.Methods inherited from class nl.cwi.monetdb.embedded.env.AbstractConnectionResult
checkMetadataArrayLength, close, getConnection, getRandomIdentifier
-
Method Details
-
getNumberOfColumns
Description copied from class:AbstractConnectionResult
Returns the number of columns in the result set.- Specified by:
getNumberOfColumns
in classAbstractConnectionResult
- Returns:
- Number of columns
- Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
getNumberOfRows
public int getNumberOfRows()Gets the current number of rows in the table, or -1 if an error in the database has occurred.- Specified by:
getNumberOfRows
in classAbstractConnectionResult
- Returns:
- The number of rows in the table.
-
getColumnNamesInternal
- Throws:
MonetDBEmbeddedException
-
getColumnTypesInternal
- Throws:
MonetDBEmbeddedException
-
getMappingsInternal
- Throws:
MonetDBEmbeddedException
-
getColumnDigitsInternal
- Throws:
MonetDBEmbeddedException
-
getColumnScalesInternal
- Throws:
MonetDBEmbeddedException
-
getColumnNullableIndexesInternal
- Throws:
MonetDBEmbeddedException
-
getColumnDefaultValuesInternal
- Throws:
MonetDBEmbeddedException
-
getTableSchema
Gets the table schema name.- Returns:
- The table schema name
-
getTableName
Gets the table name.- Returns:
- The table name
-
getRoundingMode
public int getRoundingMode()Gets the current rounding mode for decimals in this table.- Returns:
- The current rounding mode for decimals in this table.
-
setRoundingMode
public void setRoundingMode(int roundingMode)Sets the current rounding mode for decimals in this table, from the rounding modes in the BigDecimal class. It has to be value between BigDecimal.ROUND_HALF_UP and BigDecimal.ROUND_HALF_EVEN.- Parameters:
roundingMode
- The roundingMode mode value to set, between BigDecimal.ROUND_HALF_UP and BigDecimal.ROUND_HALF_EVEN
-
getColumnNames
Description copied from class:AbstractConnectionResult
Gets the columns names as a string array.- Specified by:
getColumnNames
in classAbstractConnectionResult
- Parameters:
input
- The columns names array to fill.- Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
getColumnTypes
Description copied from class:AbstractConnectionResult
Gets the columns types as a string array.- Specified by:
getColumnTypes
in classAbstractConnectionResult
- Parameters:
input
- The columns types array to fill.- Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
getMappings
Description copied from class:AbstractConnectionResult
Gets the Java mappings as a MonetDBToJavaMapping array.- Specified by:
getMappings
in classAbstractConnectionResult
- Parameters:
input
- The columns mappings array to fill.- Throws:
MonetDBEmbeddedException
- If an error in the database occurred..
-
getColumnDigits
Description copied from class:AbstractConnectionResult
Gets the column digits as an integer array.- Specified by:
getColumnDigits
in classAbstractConnectionResult
- Parameters:
input
- The columns digits array to fill.- Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
getColumnScales
Description copied from class:AbstractConnectionResult
Gets the column scales as an integer array.- Specified by:
getColumnScales
in classAbstractConnectionResult
- Parameters:
input
- The columns scales array to fill.- Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
getColumnNullableIndexes
Gets the columns nullable indexes as an array.- Parameters:
input
- The columns nullable indexes array to fill- Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
getColumnDefaultValues
Gets the columns default values in an array.- Parameters:
input
- The columns default values array to fill- Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
getColumnMetadataByIndex
Gets a column metadata by index.- Parameters:
index
- The column index (starting from 1)- Returns:
- The column metadata,
null
if index not in bounds - Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
getColumnMetadataByName
Gets a column metadata by name.- Parameters:
name
- The column name- Returns:
- The column metadata,
null
if not found - Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
getAllColumnsMetadata
Gets all columns metadata.- Returns:
- An array instance of columns metadata
- Throws:
MonetDBEmbeddedException
- If an error in the database occurred.
-
iterateTable
Iterate over the table using aIMonetDBTableCursor
instance.- Parameters:
cursor
- The iterator with the business logic- Returns:
- The number of rows iterated
- Throws:
MonetDBEmbeddedException
- If an error in the database occurred
-
appendColumns
Appends new rows to the table column-wise.- Parameters:
input
- An array of columns to append- Returns:
- The number of rows appended
- Throws:
MonetDBEmbeddedException
- If an error in the database occurred
-
closeResultImplementation
protected void closeResultImplementation()Description copied from class:AbstractConnectionResult
Close the result set internally.- Specified by:
closeResultImplementation
in classAbstractConnectionResult
-