Implemented getFieldList
This commit is contained in:
parent
0bb8884365
commit
d1cf4d4351
1 changed files with 6 additions and 18 deletions
|
@ -103,9 +103,7 @@ public class RealDatabaseConnector implements DatabaseConnector {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String actionUrlBuilder(String action){
|
private String actionUrlBuilder(String action){
|
||||||
String urlBuilder = actionUrlBuilder(login, password, url, action);;
|
String urlBuilder = actionUrlBuilder(login, password, url, action);
|
||||||
if(action.compareTo("tablelist")==0)
|
|
||||||
urlBuilder+= "&d="+database;
|
|
||||||
return urlBuilder;
|
return urlBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,9 +130,9 @@ public class RealDatabaseConnector implements DatabaseConnector {
|
||||||
this.database = database;
|
this.database = database;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getList(String listName){
|
private List<String> getList(String urlQuerry){
|
||||||
try {
|
try {
|
||||||
String response = httpRequest(actionUrlBuilder(listName));
|
String response = httpRequest(urlQuerry);
|
||||||
if(response==null)
|
if(response==null)
|
||||||
return null;
|
return null;
|
||||||
JSONArray jsonArray = new JSONArray(response);
|
JSONArray jsonArray = new JSONArray(response);
|
||||||
|
@ -152,25 +150,15 @@ public class RealDatabaseConnector implements DatabaseConnector {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDatabases(){
|
public List<String> getDatabases(){
|
||||||
return getList("dblist"); // TODO Redefine as public static final
|
return getList(actionUrlBuilder("dblist")); // TODO Redefine as public static final
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Real getTables
|
|
||||||
public List<String> getTables(){
|
public List<String> getTables(){
|
||||||
return getList("tablelist"); // TODO Redefine as public static final
|
return getList(actionUrlBuilder("tablelist")+"&d="+database); // TODO Redefine as public static final
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Real getFields
|
|
||||||
public List<String> getFields(String table){
|
public List<String> getFields(String table){
|
||||||
if(database==null) return null; // if database is not chosen return null
|
return getList(actionUrlBuilder("fieldlist")+"&d="+database+"&t="+table); // TODO Redefine as public static final
|
||||||
|
|
||||||
List<String> stringList = new ArrayList<String>();
|
|
||||||
stringList.add("Field 1");
|
|
||||||
stringList.add("Field 2");
|
|
||||||
stringList.add("Field 3");
|
|
||||||
stringList.add("Field 4");
|
|
||||||
stringList.add("Field 5");
|
|
||||||
return stringList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Real getRows
|
// TODO Real getRows
|
||||||
|
|
Loading…
Reference in a new issue