ypomonh wrote:
I'm trying to see how ScriptableConnection works so I have a basic flow:
importPackage(Packages.org.apache.cocoon.components.flow.javascript.ScriptableConnection);
var db = Database.getConnection("myConnection");
var queryVal = cocoon.parameters["rid"];
var startRow = 0;
var maxRows = 100;
row = db.query("select * from my_table where rid = ?", queryVal,
startRow, maxRows);
print (row.rowCount);
but I get the error:
org.mozilla.javascript.EcmaError: "Database" is not defined
Am I missing something..? How should I define "Database"..?
The ScriptableConnection class is part of the petstore block, so you
should look at that block's samples to see how they use it. Looking
briefly at it, it appears they import another JS file which itself
defines the helper classes:
cocoon.load("resource://org/apache/cocoon/components/flow/javascript/Database.js");
You'll need to make sure you have the petstore block jar in your build
of course.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]