Menu:

Sponsor

Discover Master of Alchemy, our first iPad/iPhone and iPod touch game!

 

Forum's topics

Latest Files

Archives

Top Rated

Categories

Photo Gallery


RDBMSResolver and AMFPHP - Howto update a DB using deltaPackets

Introducing

In this tutorial we will see how to integrate the RDBMSResolver with a DataSet, Remoting Connector passing through AMFPHP.

The Flash Professional component we will use are:
RDMBSResolver
DataSet
Remoting Connector

1. What is the RDBMSResolver?

The RDBMSResolver component creates an XML update packet that can be easily parsed by into SQL statements for updating a database. The RDBMSResolver component is connected to a DataSet component's DeltaPacket property, sends its own update packet to a connector and communicates them back to the DataSet component.

These are the steps we are going to use in this tutorial:

  1. A Remoting connector component ask data to a MySQL table (using AMFPHP),
  2. the Remoting connector binds its results to a DataSet
  3. The DataSet is connected to a DataGrid component for display data to users.
  4. When data in the Datagrid changes the applyChanges() method within the DataSet component is called and a deltaPacket object which is sent to a RDBMSResolver.
  5. The RDBMSResolver will transform this deltaPacket into an XML packet sent back to PHP through another Remoting connector component.

2. A Demonstration

Here the swf demonstration of what I'm saying

3. Setting up MySQL

Ok, first of all setup a mysql table for storing the songs' data:

CREATE TABLE `songs` (
  `id_song` int(11) NOT NULL auto_increment,
  `artist` char(255) default NULL,
  `title` char(255) NOT NULL default '',
  `genre` char(255) default NULL,
  PRIMARY KEY  (`id_song`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;