sql variables work now.
This commit is contained in:
parent
e655173a8f
commit
9977ca188c
@ -85,8 +85,7 @@ namespace jet {
|
||||
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];
|
||||
return sessions[splitName[0]]->getColumnValue(splitName[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -53,7 +53,14 @@ namespace jet {
|
||||
coreutils::ZString __mysql::getColumnValue(coreutils::ZString column) {
|
||||
if(column == "#")
|
||||
return NbrOfRows;
|
||||
return NbrOfRows;
|
||||
MYSQL_FIELD *field;
|
||||
for(int ix = 0; ix < qFields; ++ix) {
|
||||
field = mysql_fetch_field_direct(result, ix);
|
||||
if(column.equals((char *)field->name)) {
|
||||
return coreutils::ZString(row[ix], fieldLength[ix]);
|
||||
}
|
||||
}
|
||||
throw coreutils::Exception("column does not exist in session result.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
namespace jet {
|
||||
|
||||
__sql::__sql(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
|
||||
__sql::__sql(coreutils::ZString &in, coreutils::MString &parent, Global &global) : Tag(in, parent, global) {
|
||||
output = false;
|
||||
if(!hasContainer)
|
||||
throw coreutils::Exception("sql tag must have a container.");
|
||||
|
2
__sql.h
2
__sql.h
@ -8,7 +8,7 @@ namespace jet {
|
||||
class __sql : public Tag {
|
||||
|
||||
public:
|
||||
__sql(coreutils::ZString &in, coreutils::MString &out, Global &global);
|
||||
__sql(coreutils::ZString &in, coreutils::MString &parent, Global &global);
|
||||
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@ int main(int argc, char **argv) {
|
||||
coreutils::MString out;
|
||||
jet::__jet *jet = new jet::__jet(data, out, global);
|
||||
delete jet;
|
||||
std::cout << out;
|
||||
std::cout << "----------------------\n" << out;
|
||||
}
|
||||
catch(coreutils::Exception e) {
|
||||
std::cout << "Error caught: " << e.text << std::endl;
|
||||
|
@ -5,12 +5,11 @@
|
||||
$[nonexistant]
|
||||
<mysql host="localhost" database="barant" user="barant" password="uversa" sessionid="1">
|
||||
<sql sessionid="1">select * from testdata</sql>
|
||||
$[1.text]
|
||||
$[1.value]
|
||||
$[1.id] $[1.text] $[1.value]
|
||||
</mysql>
|
||||
<set name="ix" value="1" />
|
||||
<set name="theexpr" expr="SUBSTRING('abcdefg', 1, 3)" />
|
||||
<set name=\"theexpr2\" expr=\"5+3\" />
|
||||
<set name="theexpr2" expr="5+3" />
|
||||
theexpr=($[theexpr])
|
||||
theexpr2($[theexpr2])
|
||||
<set name="varname$[ix]" value="vardata" scope="global" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user