Package com.gengoai.sql
Class SQLProber
- java.lang.Object
-
- com.gengoai.sql.SQLProber
-
public class SQLProber extends Object
-
-
Constructor Summary
Constructors Constructor Description SQLProber(SQLContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Constraint>
getConstraints(@NonNull Table table)
Gets the table constraints for a given tableList<Constraint>
getConstraints(@NonNull String table)
Gets the table constraints for a given tableList<Column>
getStoredColumns(@NonNull Table table)
Gets the list of columns (non-virtual) for the given table.List<Column>
getStoredColumns(@NonNull String table)
Gets the list of columns (non-virtual) for the given table.Table
getTable(@NonNull String name)
Reverse engineers aTable
definition from the database.List<Index>
getTableIndices(@NonNull Table table)
Retrieves the indices on tableList<Index>
getTableIndices(@NonNull String table)
Retrieves the indices on tableList<String>
getTableNames()
Gets a list of the table names in the databaseList<Column>
getVirtualColumns(@NonNull Table table)
Attempts to the get the virtual columns for a given table.List<Column>
getVirtualColumns(@NonNull String table)
Attempts to the get the virtual columns for a given table.
-
-
-
Constructor Detail
-
SQLProber
public SQLProber(SQLContext context) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
getConstraints
public List<Constraint> getConstraints(@NonNull @NonNull Table table) throws SQLException
Gets the table constraints for a given table- Parameters:
table
- the table- Returns:
- the table constraints
- Throws:
SQLException
- Something went wrong building the table constraints
-
getConstraints
public List<Constraint> getConstraints(@NonNull @NonNull String table) throws SQLException
Gets the table constraints for a given table- Parameters:
table
- the table- Returns:
- the table constraints
- Throws:
SQLException
- Something went wrong building the table constraints
-
getStoredColumns
public List<Column> getStoredColumns(@NonNull @NonNull Table table) throws SQLException
Gets the list of columns (non-virtual) for the given table. Tries to infer the constraints on the columns and whether or not the column is a primary key. In some cases the constraints will not be retrieved on the column, but will be retrievable through a call togetTableIndices(Table)
.- Parameters:
table
- the table name- Returns:
- the table columns
- Throws:
SQLException
- Something went wrong learning about the table
-
getStoredColumns
public List<Column> getStoredColumns(@NonNull @NonNull String table) throws SQLException
Gets the list of columns (non-virtual) for the given table. Tries to infer the constraints on the columns and whether or not the column is a primary key. In some cases the constraints will not be retrieved on the column, but will be retrievable through a call togetTableIndices(Table)
.- Parameters:
table
- the table name- Returns:
- the table columns
- Throws:
SQLException
- Something went wrong learning about the table
-
getTable
public Table getTable(@NonNull @NonNull String name) throws SQLException
Reverse engineers aTable
definition from the database.- Parameters:
name
- the name of the table to reverse engineer- Returns:
- the reverse engineered table
- Throws:
SQLException
- Something went wrong building the table
-
getTableIndices
public List<Index> getTableIndices(@NonNull @NonNull Table table) throws SQLException
Retrieves the indices on table- Parameters:
table
- the table whose indices we want- Returns:
- the list of
Index
on the table - Throws:
SQLException
- something happened trying to query for table indices
-
getTableIndices
public List<Index> getTableIndices(@NonNull @NonNull String table) throws SQLException
Retrieves the indices on table- Parameters:
table
- the table whose indices we want- Returns:
- the list of
Index
on the table - Throws:
SQLException
- something happened trying to query for table indices
-
getTableNames
public List<String> getTableNames() throws SQLException
Gets a list of the table names in the database- Returns:
- the table names
- Throws:
SQLException
- Something went wrong getting the table names
-
getVirtualColumns
public List<Column> getVirtualColumns(@NonNull @NonNull Table table) throws SQLException
Attempts to the get the virtual columns for a given table. Note that it may not be possible to retrieve the generated as statement that accompanies the virtual column.- Parameters:
table
- the table name- Returns:
- the virtual columns
- Throws:
SQLException
- Something went wrong getting the virtual names
-
getVirtualColumns
public List<Column> getVirtualColumns(@NonNull @NonNull String table) throws SQLException
Attempts to the get the virtual columns for a given table. Note that it may not be possible to retrieve the generated as statement that accompanies the virtual column.- Parameters:
table
- the table name- Returns:
- the virtual columns
- Throws:
SQLException
- Something went wrong getting the virtual names
-
-