diff --git a/Global.cpp b/Global.cpp
index e57e7e6..0fca745 100644
--- a/Global.cpp
+++ b/Global.cpp
@@ -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]);
}
}
diff --git a/__mysql.cpp b/__mysql.cpp
index d867893..d641b55 100644
--- a/__mysql.cpp
+++ b/__mysql.cpp
@@ -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.");
}
}
diff --git a/__sql.cpp b/__sql.cpp
index 8511bcc..296af54 100644
--- a/__sql.cpp
+++ b/__sql.cpp
@@ -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.");
diff --git a/__sql.h b/__sql.h
index 634e2c3..5873513 100644
--- a/__sql.h
+++ b/__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);
};
diff --git a/jet-2.0 b/jet-2.0
index 0c45f83..476ab51 100755
Binary files a/jet-2.0 and b/jet-2.0 differ
diff --git a/jet-2.0.cpp b/jet-2.0.cpp
index 9f81aa7..2efcf7a 100644
--- a/jet-2.0.cpp
+++ b/jet-2.0.cpp
@@ -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;
diff --git a/testjet.jet b/testjet.jet
index 05b08c0..c703888 100755
--- a/testjet.jet
+++ b/testjet.jet
@@ -5,12 +5,11 @@
$[nonexistant]
select * from testdata
- $[1.text]
- $[1.value]
+ $[1.id] $[1.text] $[1.value]
-
+
theexpr=($[theexpr])
theexpr2($[theexpr2])