cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Noels <stev...@outerthought.org>
Subject Re: Database.js
Date Thu, 21 Aug 2003 08:57:09 GMT
Christopher Oliver wrote:

> I just checked in a fix for this. The problem was that it wasn't using FOM.

Looking good, thanks.

I have another question of connection handling and flowscript execution. 
My script currently looks like this:

function form(form) {

     var model = form.getModel();

     var formurl = cocoon.parameters["event-id"];

     pipeline = "registration/" + formurl + "/showform";

     form.show(pipeline, formHandler);

	var conn = getConnection("foo");
	
	try {
	
	    if (checkRecordInDatabase(model.email, conn) == true) {
	
	    	pipeline = "registration/" + formurl + "/duplicate";
	    	cocoon.sendPage(pipeline, {"email": model.email});
	
	    }
	    else {
	
		    var registration = new Registration(model.fname, model.lname,
		    	model.company, model.address, model.city, model.zip, model.country,
		    	model.tel, model.fax, model.email);
		    addRecord(registration, conn);
		
		   	pipeline = "registration/" + formurl + "/success";
	        cocoon.sendPage(pipeline, registration.asHashMap());
	
	   	}
	} finally {

	   	conn.close();
	    form.finish();
	}
}

... so basically I have two possible outcomes of my try{} block, each 
calling another pipeline. I'm worried that the flowscript only executes 
upto that sendPage, never reaching the conn.close() in the finally{} 
block. Or does it?

</Steven>
-- 
Steven Noels                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at            http://blogs.cocoondev.org/stevenn/
stevenn at outerthought.org                stevenn at apache.org


Mime
View raw message