Worked on the mysql variable retrieval foundation.
This commit is contained in:
1 parent
933c400922
commit
2e715a4d08
5 files changed
+27
-2
No files matched your search
+14
-2
@@ -1,5 +1,6 @@
|
||||
#include "Global.h"
|
||||
#include "Exception.h"
|
||||
#include "__mysql.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace jet {
|
||||
@@ -41,7 +42,11 @@ namespace jet {
|
||||
} if(variable.ifNext("@")) {
|
||||
// TODO: should only allow environment variables. Allow substitution.
|
||||
} else {
|
||||
return variables[renderVariableName(name, variable)];
|
||||
coreutils::MString splitName = renderVariableName(name, variable);
|
||||
splitName.split(".");
|
||||
if(splitName.getList().size() == 1)
|
||||
return variables[splitName[0]];
|
||||
return getSessionVariable(splitName);
|
||||
}
|
||||
throw coreutils::Exception("expected variable name or type designator.");
|
||||
} if(variable.ifNext("#[")) {
|
||||
@@ -64,5 +69,12 @@ namespace jet {
|
||||
renderVariableName(name, variable);
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
coreutils::ZString Global::getSessionVariable(coreutils::MString &splitName) {
|
||||
if(sessions.find(splitName[0]) == sessions.end())
|
||||
throw coreutils::Exception("requested session is not available in variable.");
|
||||
sessions[splitName[0]]->getColumnValue(splitName[1]);
|
||||
return splitName[1];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user