public class DatabaseManagement extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MYSQLDialect |
static int |
POSTGRESQLDialect |
| Constructor and Description |
|---|
DatabaseManagement(String configPath) |
| Modifier and Type | Method and Description |
|---|---|
void |
closeConnection() |
org.hibernate.SessionFactory |
createConnection(String cfgDir,
String SourceFile) |
org.hibernate.SessionFactory |
createConnection(String DatabaseUserName,
String DatabasePassword,
String DatabaseDriver,
String DatabaseDialect,
String DatabaseURL,
String DatabaseName) |
String |
getCreateTable(String tablename,
String schemaName)
Get the "Create Table" statement.
|
File |
getFile() |
List<String> |
getListColumnNamesTable() |
HashMap<String,String> |
getMapQueryResult() |
HashMap<String,String> |
getMapSampleTableResult() |
long |
getNumberOfRows(String tablename,
String schemaName) |
List<String> |
getSchemas()
Get the schema's name for the database Postgresql.
|
int |
getSubmitQueryTotalRows() |
List<String> |
getTables(String databaseName,
String schemaName)
Get the table's names for a database.
|
void |
randomSampleOnTable(String tableName,
String schemaName,
String pathFile)
Retrieve 100 rows of a table in a random manner.
|
void |
sampleOnTable(String tableName,
String schemaName,
String pathFile)
Retrieve the first 100 rows of a table.
|
String |
smartCorrectionOnQuery(String OriginalQuery,
int dialect) |
void |
smartSampleOnTable(String tableName,
String schemaName,
String pathFile)
retrieve 100 rows of a table randomly that have the maximum number of
columns not null
|
List<Object> |
submitQuery(String query,
Connection conn,
String pathFile)
method that allows to submit a query.
|
public static final int POSTGRESQLDialect
public static final int MYSQLDialect
public DatabaseManagement(String configPath)
public org.hibernate.SessionFactory createConnection(String DatabaseUserName, String DatabasePassword, String DatabaseDriver, String DatabaseDialect, String DatabaseURL, String DatabaseName) throws IOException
IOExceptionpublic org.hibernate.SessionFactory createConnection(String cfgDir, String SourceFile) throws Exception
Exceptionpublic void closeConnection()
public List<Object> submitQuery(String query, Connection conn, String pathFile) throws Exception
schemaName - : the schema's name of the database postgres. For database
mysql this parameter is null.Exceptionpublic List<String> getTables(String databaseName, String schemaName) throws Exception
schemaName - : the schema's name of the database postgres. For database
mysql this parameter is null.Exceptionpublic List<String> getSchemas() throws Exception
Exceptionpublic String getCreateTable(String tablename, String schemaName) throws Exception
schemaName - : the schema's name of the database postgres. For database
mysql this parameter is null.Exceptionpublic long getNumberOfRows(String tablename, String schemaName) throws Exception
Exceptionpublic void smartSampleOnTable(String tableName, String schemaName, String pathFile) throws Exception
tableName - : the table's nameschemaName - : the schema's name of the database postgres. For database
mysql this parameter is the database name.Exceptionpublic void sampleOnTable(String tableName, String schemaName, String pathFile) throws Exception
tableName - : the table's nameschemaName - : the schema's name of the database postgres. For database
mysql this parameter is the database name.Exceptionpublic void randomSampleOnTable(String tableName, String schemaName, String pathFile) throws Exception
tableName - : the table's nameschemaName - : the schema's name of the database postgres. For database
mysql this parameter is the database name.Exceptionpublic File getFile()
public int getSubmitQueryTotalRows()
public String smartCorrectionOnQuery(String OriginalQuery, int dialect) throws com.adventnet.swissqlapi.sql.parser.ParseException, com.adventnet.swissqlapi.sql.exception.ConvertException
com.adventnet.swissqlapi.sql.parser.ParseExceptioncom.adventnet.swissqlapi.sql.exception.ConvertExceptionCopyright © 2018. All Rights Reserved.