Save as Word Document | Find | English | Portugues(Brasil)

Techinical Reference
Data Repository - AnyDataSet

Data Repository - AnyDataSet

Table of contents
1. The IModule Interface
2. Data Repository - AnyDataSet
3. Uploading Documents
4. Grouping data entries in XMLNuke
5. Personalized validation in JavaScript
6. Adding Pieces of JavaScript Code
7. Creating your own XML objects
8. Internationalization with XMLNuke.
9. Processing Events with the Click of a Button.
10. Automatically defining the values of Properties

On this page
Data Repository - AnyDataSet
Reading an AnyDataSet
Filtering the data of an AnyDataSet
Inserting data to an AnyDataSet


Data Repository - AnyDataSet

XMLNuke has several ways to store and recover information from a data repository, whether through a local database (for small amounts of data) or in a relational database like MySQL or Oracle.

It's important to understand that regardless of the method used to access the data, the manipulation method is practically the same (for queries).

AnyDataSet is very flexible because it does not have a predefined database structure, so that each line may contain distinct entries. In any case, it's recommended that you use it for small entries only.

Reading an AnyDataSet

CSharp
AnydatasetFilenameProcessor guestbookFile = 
new AnydatasetFilenameProcessor("guestbook", this._context);
AnyDataSet guestbook = new anydataset.AnyDataSet(guestbookFile);
Iterator it = guestbook.getIterator();
while (it.hasNext())
{
	SingleRow sr = it.moveNext();
	//sr.getField("campo");
}

PHP
// require_once("bin/com.xmlnuke/module.basemodule.class.php");
$guestbookFile = new AnydatasetFilenameProcessor("guestbook", $this->_context);
$guestbook = new AnyDataSet($guestbookFile);
$it = $guestbook->getIterator();
while ($it->hasNext())
{
	$sr = $it->moveNext();
	//$sr->getField("campo");
}

Filtering the data of an AnyDataSet

When obtaining the data from an AnyDataSet with the getIterator() method, you can send an IteratorFilter.

CSharp
IteratorFilter itf = new IteratorFilter();
itf.addRelation("destination_id", Relation.Equal, "valor");
Iterator it = guestbook.getIterator(itf);

PHP
$itf = new IteratorFilter();
$itf->addRelation("destination_id", Relation::Equal, $destination_id);
$it = $configEmail->getIterator($itf);

Inserting data to an AnyDataSet

The process for inserting data to an AnyDataSet is very simple.

CSharp
anydata.appendRow();
anydata.addField("fromname", "nome");
anydata.addField("frommail", "email");
anydata.addField("ip", this._context.ContextValue("REMOTE_ADDR"));
anydata.Save(guestbookFile);

PHP
$anydata->appendRow();
$anydata->addField("fromname", "nome");
$anydata->addField("frommail", "email");
$anydata->addField("ip", $this->_context->ContextValue("REMOTE_ADDR"));
$anydata->Save(guestbookFile);

Previous
The IModule Interface
Next
Uploading Documents