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 intappendColumns(Object[] input)Appends new rows to the table column-wise.protected voidcloseResultImplementation()Close the result set internally.MonetDBTableColumn[]getAllColumnsMetadata()Gets all columns metadata.voidgetColumnDefaultValues(String[] input)Gets the columns default values in an array.protected voidgetColumnDefaultValuesInternal(String[] input)voidgetColumnDigits(int[] input)Gets the column digits as an integer array.protected voidgetColumnDigitsInternal(int[] input)MonetDBTableColumngetColumnMetadataByIndex(int index)Gets a column metadata by index.MonetDBTableColumngetColumnMetadataByName(String name)Gets a column metadata by name.voidgetColumnNames(String[] input)Gets the columns names as a string array.protected voidgetColumnNamesInternal(String[] input)voidgetColumnNullableIndexes(boolean[] input)Gets the columns nullable indexes as an array.protected voidgetColumnNullableIndexesInternal(boolean[] input)voidgetColumnScales(int[] input)Gets the column scales as an integer array.protected voidgetColumnScalesInternal(int[] input)voidgetColumnTypes(String[] input)Gets the columns types as a string array.protected voidgetColumnTypesInternal(String[] input)voidgetMappings(MonetDBToJavaMapping[] input)Gets the Java mappings as a MonetDBToJavaMapping array.protected voidgetMappingsInternal(MonetDBToJavaMapping[] input)intgetNumberOfColumns()Returns the number of columns in the result set.intgetNumberOfRows()Gets the current number of rows in the table, or -1 if an error in the database has occurred.intgetRoundingMode()Gets the current rounding mode for decimals in this table.StringgetTableName()Gets the table name.StringgetTableSchema()Gets the table schema name.intiterateTable(IMonetDBTableCursor cursor)Iterate over the table using aIMonetDBTableCursorinstance.voidsetRoundingMode(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:AbstractConnectionResultReturns the number of columns in the result set.- Specified by:
getNumberOfColumnsin 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:
getNumberOfRowsin 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:AbstractConnectionResultGets the columns names as a string array.- Specified by:
getColumnNamesin classAbstractConnectionResult- Parameters:
input- The columns names array to fill.- Throws:
MonetDBEmbeddedException- If an error in the database occurred.
-
getColumnTypes
Description copied from class:AbstractConnectionResultGets the columns types as a string array.- Specified by:
getColumnTypesin classAbstractConnectionResult- Parameters:
input- The columns types array to fill.- Throws:
MonetDBEmbeddedException- If an error in the database occurred.
-
getMappings
Description copied from class:AbstractConnectionResultGets the Java mappings as a MonetDBToJavaMapping array.- Specified by:
getMappingsin classAbstractConnectionResult- Parameters:
input- The columns mappings array to fill.- Throws:
MonetDBEmbeddedException- If an error in the database occurred..
-
getColumnDigits
Description copied from class:AbstractConnectionResultGets the column digits as an integer array.- Specified by:
getColumnDigitsin classAbstractConnectionResult- Parameters:
input- The columns digits array to fill.- Throws:
MonetDBEmbeddedException- If an error in the database occurred.
-
getColumnScales
Description copied from class:AbstractConnectionResultGets the column scales as an integer array.- Specified by:
getColumnScalesin 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,
nullif 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,
nullif 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 aIMonetDBTableCursorinstance.- 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:AbstractConnectionResultClose the result set internally.- Specified by:
closeResultImplementationin classAbstractConnectionResult
-