SQL Address Book example

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

SQL Address Book example

Alessandro  Vernet
Administrator
We made the Address Book example available in the examples a few days
ago. This example shows how you can build a form with XForms and have
the data for the form stored in a relational database.

A few days ago, I put the example in its own Persistence category. I
subsequently thought that it was not quite worth creating a new
category just for one example. So you will now find the SQL Address
Book along the other XForms examples.

The structure of the example is quite simple:

1. view.xhtml implements the UI with XForms. The XForms calls services
with <xforms:submission>.
2. Services are implemented in service-get.xpl, service-add.xpl, and
service-delete.xpl. They are used by view.xhtml to read the content of
the database, add a new entry, and delete an entry.
3. In turn each service uses the SQL processor to communicate with the database.

One issue still pending was the initialization of the database. The
SQL Address Book uses a table, which needs to be created for the
example to work. Since we would like the examples to work out of the
box, this table needs to be created automatically if it does not
exist.

This is a fairly unique requirement, as in general you will already
have the table created in your database. The files in the
sub-directory "init-database" take care of this, and all the services
(service-get.xpl, service-add.xpl, and service-delete.xpl) start by
calling the init-database/init-database.xpl.

I hope the example is simple enough and will be helpful to those who
want (or rather need!) to persist data in a relational database.

Alex
--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: SQL Address Book example

Erik Bruchez
Administrator
Just a precision on this:

This SQL example already existed, but when we changed the directory
layout for the resources a few weeks back, we only moved a subset of the
examples to the new layout (basically the most important examples). Over
time we will probably migrate more examples.

-Erik

Alessandro Vernet wrote:

> We made the Address Book example available in the examples a few days
> ago. This example shows how you can build a form with XForms and have
> the data for the form stored in a relational database.
>
> A few days ago, I put the example in its own Persistence category. I
> subsequently thought that it was not quite worth creating a new
> category just for one example. So you will now find the SQL Address
> Book along the other XForms examples.
>
> The structure of the example is quite simple:
>
> 1. view.xhtml implements the UI with XForms. The XForms calls services
> with <xforms:submission>.
> 2. Services are implemented in service-get.xpl, service-add.xpl, and
> service-delete.xpl. They are used by view.xhtml to read the content of
> the database, add a new entry, and delete an entry.
> 3. In turn each service uses the SQL processor to communicate with the
> database.
>
> One issue still pending was the initialization of the database. The
> SQL Address Book uses a table, which needs to be created for the
> example to work. Since we would like the examples to work out of the
> box, this table needs to be created automatically if it does not
> exist.
>
> This is a fairly unique requirement, as in general you will already
> have the table created in your database. The files in the
> sub-directory "init-database" take care of this, and all the services
> (service-get.xpl, service-add.xpl, and service-delete.xpl) start by
> calling the init-database/init-database.xpl.
>
> I hope the example is simple enough and will be helpful to those who
> want (or rather need!) to persist data in a relational database.
>
> Alex
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws