Yet again, the wizards add something new to the hat for us to pull out!
Quick question - will this approach allow for mapping of parent->child
relationships - where both parent and child (and maybe "grand children"?)
are updated on the same form?!
Thanks.
PS The fragment does not show this, but I assume there is some simple
way to map between database fields and form fields when filling out
the form? Or is this already catered for in the CForms aspect?
>>> [EMAIL PROTECTED] 2005/10/10 11:50 AM >>>
Bertrand Delacretaz wrote:
> Le 7 oct. 05, à 15:31, Upayavira a écrit :
>
>> ...I believe there are some new ways being played with for database
>> access in cforms. Using jdbi (I believe). Hopefully we'll hear more
>> soon...
>
>
> I believe I've seen it, actually...so yes, we hope to hear more soon ;-)
Yup. This is something I'm working on for my current project and which
should land this week in the SVN.
Basically, JDBI allows to access JDBC using List and Map rather than
ResultSet, and I added List and Map implementations that wrap a CForms
repeater and container, respectively.
This allows to write things like:
var form = new Form("myform.xml");
// Get a Map view on the form
var formMap = form.asMap();
// Load a Map representing a customer from the database
var customer = jdbi.query("select * from customer where id = :id", { id:
cocoon.request.getParameter("id") });
// Fill the form
formMap.putAll(customer);
form.showForm("viewform");
if (form.isValid) {
// Update customer
jdbi.update("update customer set name = :name, email = :email where
id = :id", formMap);
}
Et voilà: for simple CRUD needs, direct mapping from database table to
form without complex O/R mapping tools.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://people.apache.org/~sylvain http://www.anyware-tech.com
Apache Software Foundation Member Research & Technology Director
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
[EMAIL PROTECTED]
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their
support.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]