From a09e370e57891079160dbf4d6ab4bc165b3a329b Mon Sep 17 00:00:00 2001 From: brad Arant Date: Wed, 25 Sep 2024 20:10:19 -0700 Subject: [PATCH] Working on whilerow. --- __whilerow.cpp | 33 +++++++++++++++++++++++++++++++++ __whilerow.h | 19 +++++++++++++++++++ testjet.jet | 4 +++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 __whilerow.cpp create mode 100644 __whilerow.h diff --git a/__whilerow.cpp b/__whilerow.cpp new file mode 100644 index 0000000..e38cae0 --- /dev/null +++ b/__whilerow.cpp @@ -0,0 +1,33 @@ +#include "__whilerow.h" +#include "Exception.h" +#include + +namespace jet { + + __whilerow::__whilerow(coreutils::ZString &in, coreutils::MString &parent, Global &global) : Tag(in, parent, global) { + + if(!variableDefined("host")) + throw coreutils::Exception("host must be specified for mysql tag."); + if(!variableDefined("database")) + throw coreutils::Exception("database must be specified for mysql tag."); + if(!variableDefined("user")) + throw coreutils::Exception("user must be specified for mysql tag."); + if(!variableDefined("password")) + throw coreutils::Exception("password must be specified for mysql tag."); + + while ((count != 0) && sql[sqlsession].row) { + processContainer(container); + + sql[sqlsession].row = mysql_fetch_row (sql[sqlsession].result); + sql[sqlsession].fieldlen = mysql_fetch_lengths (sql[sqlsession].result); + + --count; + } + + + + + + } + +} diff --git a/__whilerow.h b/__whilerow.h new file mode 100644 index 0000000..a56cb67 --- /dev/null +++ b/__whilerow.h @@ -0,0 +1,19 @@ +#ifndef ____whilerow_h__ +#define ____whilerow_h__ + +#include "Tag.h" +#include "ZString.h" +#include "MString.h" + +namespace jet { + + class __whilerow : public Tag { + + public: + __whilerow(coreutils::ZString &in, coreutils::MString &parent, Global &global); + + }; + +} + +#endif diff --git a/testjet.jet b/testjet.jet index c703888..8a3e218 100755 --- a/testjet.jet +++ b/testjet.jet @@ -5,7 +5,9 @@ $[nonexistant] select * from testdata - $[1.id] $[1.text] $[1.value] + + $[1.id] $[1.text] $[1.value] +