Exemple #1
0
YBORM_DECL ElementTree::ElementPtr
xmlize_row(const Row &row, const String &entry_name)
{
    ElementTree::ElementPtr entry = ElementTree::new_element(entry_name);
    Row::const_iterator it = row.begin(), end = row.end();
    for (; it != end; ++it)
        entry->sub_element(mk_xml_name(it->first, _T("")),
                it->second.nvl(Value(String(_T("")))).as_string());
    return entry;
}
Exemple #2
0
bool Database::add(std::string tablename, string keyValue, Row &object)
{
	Table* table = getTable(tablename);

	if (table == NULL || get(tablename, keyValue) != NULL) return false;

	Row* row = new Row(object.begin(), object.end());

	row->insert(make_pair("key", keyValue));
	table->insert(row);

	return true;
}
Exemple #3
0
bool Database::modify(std::string tablename, std::string keyValue, Row &object)
{
	Row* row = get(tablename, keyValue);

	if (row == NULL)
	{
		return false;
	}

	for (Row::iterator i = object.begin(), temp; i != object.end(); i++)
	{
		temp = row->find(i->first);
		if (temp != row->end())
		{
			temp->second = i->second;
		}
		else
		{
			row->insert(make_pair(i->first, i->second));
		}
	}

	return true;
}