diff options
| -rw-r--r-- | project2/sqlIterate.cpp | 3 | ||||
| -rw-r--r-- | project2/sqlView.cpp | 40 | ||||
| -rw-r--r-- | project2/view.cpp | 3 | 
3 files changed, 6 insertions, 40 deletions
diff --git a/project2/sqlIterate.cpp b/project2/sqlIterate.cpp index e80e1ee..6e8ecab 100644 --- a/project2/sqlIterate.cpp +++ b/project2/sqlIterate.cpp @@ -4,7 +4,6 @@  #include "rdbmsDataSource.h"  #include "column.h"  #include <string.h> -#include <syslog.h>  #include <libxml++/nodes/textnode.h>  #include "xmlObjectLoader.h"  #include "environment.h" @@ -37,7 +36,7 @@ void _SqlIterate::execute(const ApplicationEngine * ep, const PerRowValues * par  		query = new ODBC::SelectCommand(ep->dataSource<_RdbmsDataSource>(dataSource)->getReadonly(), sql);  	}  	BOOST_FOREACH(Parameters::value_type p, parameters) { -		query->bindParamS(p.second->bind, p.second->value()); +		query->bindParamS(p.second->bind, p.second->value);  	}  	while (query->fetch()) {  		executeChildren(ep, this); diff --git a/project2/sqlView.cpp b/project2/sqlView.cpp index 7995ca9..bd743e9 100644 --- a/project2/sqlView.cpp +++ b/project2/sqlView.cpp @@ -16,9 +16,6 @@ _SqlView::_SqlView(const xmlpp::Element * p) :  	sql(xmlChildText(p, "sql")),  	query(NULL)  { -	Loaders loaders; -	_View::AddLoaders(loaders, subViews); -	_LoaderBase::collectAll(loaders, "project2", p, true, true);  }  _SqlView::~_SqlView() @@ -34,7 +31,6 @@ _SqlView::getCurrentValue(const Glib::ustring & id) const  void _SqlView::execute(xmlpp::Element * par, const ApplicationEngine * ep, const _View * parent) const  { -	typedef std::map<std::string, xmlpp::Element *> Columns;  	if (!query) {  		query = new ODBC::SelectCommand(ep->dataSource<_RdbmsDataSource>(dataSource)->getReadonly(), sql);  	} @@ -43,48 +39,16 @@ void _SqlView::execute(xmlpp::Element * par, const ApplicationEngine * ep, const  	}  	xmlpp::Element * set = par->add_child(name);  	while (query->fetch()) { -		Columns columns;  		unsigned int cols = query->columnCount();  		xmlpp::Element * record = set->add_child(recordName);  		for (unsigned int col = 0; col < cols; col += 1) { -			const Glib::ustring & nameattr = (*query)[col].name; -			char * name, * attr = NULL; -			switch (sscanf(nameattr.c_str(), "%a[^_]_%as", &name, &attr))  -			{ -				case 0: -					fprintf(stderr, "non-sense column name\n"); -					return; // Make me an exception -					break; -				case 1: -					attr = NULL; -					break; -			} +			xmlpp::Element * ch = record->add_child((*query)[col].name);  			char * buf = NULL;  			(*query)[col].writeToBuf(&buf);  			if (buf) { -				if (attr) { -					if (strcmp(attr, ".") == 0) { -						record->set_attribute(name, buf); -					} -					else { -						Columns::iterator i = columns.find(attr); -						if (i != columns.end()) { -							i->second->set_attribute(name, buf); -						} -					} -				} -				else if (strcmp(name, "value") == 0) { -					record->set_child_text(buf); -				} -				else { -					xmlpp::Element * ch = record->add_child(name); -					ch->set_child_text(buf); -					columns[name] = ch; -				} +				ch->set_child_text(buf);  				free(buf);  			} -			free(name); -			free(attr);  		}  		executeChildren(record, ep, this);  	} diff --git a/project2/view.cpp b/project2/view.cpp index e2ea7d9..c0f239f 100644 --- a/project2/view.cpp +++ b/project2/view.cpp @@ -9,6 +9,9 @@ _View::_View(const xmlpp::Element * p) :  	_SourceObject(p),  	recordName(p->get_attribute_value("recordname"))  { +	Loaders loaders; +	_View::AddLoaders(loaders, subViews); +	_LoaderBase::collectAll(loaders, "project2", p, true, true);  }  _View::~_View()  | 
