public class DatasourceClient extends Object
Constructor and Description |
---|
DatasourceClient() |
Modifier and Type | Method and Description |
---|---|
String[] |
getColumnNames(String dsName,
String tableName) |
Connection |
getConnection(String dsName)
get Connection for the given datasource
This is to avoid having multiple connection
|
String[] |
getDataSourceNames()
get all data source names available
|
HashMap<String,String> |
getMetaData(String dsName,
String tableName)
retrieves the meta data about the column names in the given table and dsname
|
String[] |
getTableNames(String dsName)
get the tables exists in the data source name provided
|
String |
isNumberFields(String dsName,
String tablename,
String[] field)
if all numeric columns then empty string will be returned else
error message will be returned with name of first occurance of not numeric value
|
ResultSet |
queryDatasource(String query,
Connection connection) |
public String[] getDataSourceNames() throws org.wso2.carbon.reporting.api.ReportingException
org.wso2.carbon.reporting.api.ReportingException
- will occurred if no datasources found.public String[] getTableNames(String dsName) throws org.wso2.carbon.reporting.api.ReportingException, SQLException
dsName
- name of the data sourceorg.wso2.carbon.reporting.api.ReportingException
- will occurred if error occurred while getting connection for data sourceSQLException
- will occurred if any error in the SQL syntaxpublic Connection getConnection(String dsName) throws org.wso2.carbon.reporting.api.ReportingException
dsName
- name of the data sourceorg.wso2.carbon.reporting.api.ReportingException
- will occurred if any datasources found.public String[] getColumnNames(String dsName, String tableName) throws org.wso2.carbon.reporting.api.ReportingException, SQLException
org.wso2.carbon.reporting.api.ReportingException
SQLException
public ResultSet queryDatasource(String query, Connection connection) throws org.wso2.carbon.reporting.api.ReportingException, SQLException
org.wso2.carbon.reporting.api.ReportingException
SQLException
public HashMap<String,String> getMetaData(String dsName, String tableName) throws org.wso2.carbon.reporting.api.ReportingException
dsName
- name of the data sourcetableName
- name of the table in the data sourceorg.wso2.carbon.reporting.api.ReportingException
- will occurred if any sql syntax problem found.public String isNumberFields(String dsName, String tablename, String[] field) throws org.wso2.carbon.reporting.api.ReportingException
dsName
- name of the data sourcetablename
- name of the table in the data sourcefield,
- array of column names of the table which supposed to checked whether it's a numeric fieldorg.wso2.carbon.reporting.api.ReportingException
- will occurred if any sql syntax problem found.Copyright © 2022 WSO2. All rights reserved.