On 11.05.2007 15:15, ypomonh wrote:
I'm searching an easy way to query a given datasource (defined in) from
within a flow (javascript). Not using an ORM framework but even plain JDBC.
Have tried to use
org.apache.cocoon.components.flow.javascript.ScriptableConnection:
importPackage(Packages.org.apache.cocoon.components.flow.javascript.ScriptableConnection);
var db = Database.getConnection("mydatasource");
var queryVal = cocoon.parameters["rid"];
var startRow = 0;
var maxRows = 100;
row = db.query("select * from report_parameter_map where report_id =
?", queryVal, startRow, maxRows);
print (row.rowCount);
but get : "'Database' is not defined" ?
Is there a simpler way to query a given datasource from within a flow
(javascript)?
This stuff is only part of the petstore block and so probably rarely
used and even less documented. To make it work you can have a look into
the petstore samples. Following the flow script there you need to import
Database.js and not the ScriptableConnection directly:
cocoon.load("resource://org/apache/cocoon/components/flow/javascript/Database.js");
But I guess there are more standard ways to do it. Hadn't we a simple
JDBC scripting framework in Cocoon? IIRC Sylvain and Bertrand should
best. I hope they can help.
Joerg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]