You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2005/10/22 20:28:14 UTC

svn commit: r327680 - /cocoon/blocks/forms/trunk/samples/sql/flow/jdbi.js

Author: sylvain
Date: Sat Oct 22 11:28:11 2005
New Revision: 327680

URL: http://svn.apache.org/viewcvs?rev=327680&view=rev
Log:
Fix SQL sample with rhino+cont

Modified:
    cocoon/blocks/forms/trunk/samples/sql/flow/jdbi.js

Modified: cocoon/blocks/forms/trunk/samples/sql/flow/jdbi.js
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/samples/sql/flow/jdbi.js?rev=327680&r1=327679&r2=327680&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/samples/sql/flow/jdbi.js (original)
+++ cocoon/blocks/forms/trunk/samples/sql/flow/jdbi.js Sat Oct 22 11:28:11 2005
@@ -24,7 +24,13 @@
     var selector = cocoon.getComponent(Packages.org.apache.avalon.excalibur.datasource.DataSourceComponent.ROLE + "Selector");
     var datasource = selector.select(datasource);
     // Wrap datasource as a JDBI ConnectionFactory.
-    this.dbi = new Packages.org.skife.jdbi.DBI(function() { return datasource.getConnection() });
+    this.dbi = new Packages.org.skife.jdbi.DBI(
+        new JavaAdapter(Packages.org.skife.jdbi.ConnectionFactory, {
+            getConnection: function() { return datasource.getConnection() }
+        })
+    );
+    // note: Rhino 1.6 allows to write
+    // this.dbi = new Packages.org.skife.jdbi.DBI(function() { return datasource.getConnection() });
 
     // Plug a statement locator that will use Cocoon's source resolver
     var loadFunc = function(name) {
@@ -38,7 +44,10 @@
             }
             return result;
         };
-    this.dbi.setStatementLocator(loadFunc);
+    
+    this.dbi.setStatementLocator(new JavaAdapter(Packages.org.skife.jdbi.tweak.StatementLocator, { load: loadFunc } ));
+    // note: Rhino 1.6 allows to write
+    // this.dbi.setStatementLocator(loadFunc);
 }
 
 /**