add getDBConnection().
This commit is contained in:
parent
1515cc96af
commit
760e361b3f
1 changed files with 13 additions and 1 deletions
|
@ -48,7 +48,8 @@ public class GlobalObject extends ScriptableObject {
|
||||||
String[] globalFuncs = {
|
String[] globalFuncs = {
|
||||||
"renderSkin", "renderSkinAsString", "getProperty",
|
"renderSkin", "renderSkinAsString", "getProperty",
|
||||||
"authenticate", "createSkin", "format", "encode",
|
"authenticate", "createSkin", "format", "encode",
|
||||||
"encodeXml", "encodeForm", "stripTags"
|
"encodeXml", "encodeForm", "stripTags",
|
||||||
|
"getDBConnection"
|
||||||
};
|
};
|
||||||
|
|
||||||
defineFunctionProperties(globalFuncs, GlobalObject.class, 0);
|
defineFunctionProperties(globalFuncs, GlobalObject.class, 0);
|
||||||
|
@ -195,6 +196,17 @@ public class GlobalObject extends ScriptableObject {
|
||||||
return new Skin(str, app);
|
return new Skin(str, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DatabaseObject getDBConnection(String dbsource) throws Exception {
|
||||||
|
if (dbsource == null)
|
||||||
|
throw new RuntimeException ("Wrong number of arguments in getDBConnection(dbsource)");
|
||||||
|
DbSource dbsrc = app.getDbSource (dbsource.toLowerCase ());
|
||||||
|
if (dbsrc == null)
|
||||||
|
throw new RuntimeException ("DbSource "+dbsource+" does not exist");
|
||||||
|
DatabaseObject db = new DatabaseObject (dbsrc, 0);
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue