This project has retired. For details please refer to its
Attic page .
ScriptableConnection (Cocoon API 2.1.12-dev [March 20 2012])
org.apache.cocoon.components.flow.javascript
Class ScriptableConnection
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.apache.cocoon.components.flow.javascript.ScriptableConnection
All Implemented Interfaces: Serializable , org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable
public class ScriptableConnection extends org.mozilla.javascript.ScriptableObject
Wraps a JDBC connection and provides an API similar to JSTL
A ScriptableConnection provides two methods:
query([String] stmt, [Array] parameters, [Number] startRow, [Number] maxRows, [Function] fun)
update([String] stmt, [Array] parameters)
If the fun
argument is provided to query
it
will be called for each row returned (the row object will be passed as its
argument). For example:
var db = Database.getConnection(...);
var queryVal = ...;
var startRow = 0;
var maxRows = 100;
db.query("select * from table where column = ?",
[queryVal],
startRow,
maxRows,
function(row) {
print("column = " + row.column);
});
If fun
is undefined, an object containing the following
properties will be returned instead:
[Array] rows - an array of row objects
[Array] rowsByIndex - An array with an array per row of column values
[Array] columnNames - An array of column names
[Number] rowCount - Number of rows returned
[Boolean] limitedByMaxRows - true if not all rows are included due to matching a maximum value
A ScriptableConnection is also a wrapper around a real JDBC Connection and thus
provides all of methods of Connection as well
Version:
CVS $Id: ScriptableConnection.html 1304258 2012-03-23 10:09:27Z ilgrosso $
See Also: Serialized Form
Fields inherited from class org.mozilla.javascript.ScriptableObject
DONTENUM, EMPTY, PERMANENT, READONLY
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
Method Summary
static void
finishInit (org.mozilla.javascript.Scriptable proto)
Object
get (int index,
org.mozilla.javascript.Scriptable start)
Object
get (String name,
org.mozilla.javascript.Scriptable start)
String
getClassName ()
boolean
has (int index,
org.mozilla.javascript.Scriptable start)
boolean
has (String name,
org.mozilla.javascript.Scriptable start)
static org.mozilla.javascript.Scriptable
jsConstructor (org.mozilla.javascript.Context cx,
Object [] args,
org.mozilla.javascript.Function ctorObj,
boolean inNewExpr)
Object
jsFunction_query (String sql,
Object params,
int startRow,
int maxRows,
Object funObj)
int
jsFunction_update (String sql,
Object params)
void
put (String name,
org.mozilla.javascript.Scriptable start,
Object value)
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, callMethod, callMethod, defineClass, defineClass, defineClass, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, hasInstance, hasProperty, hasProperty, isSealed, put, putProperty, putProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setParentScope, setPrototype
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
ScriptableConnection
public ScriptableConnection ()
ScriptableConnection
public ScriptableConnection (org.mozilla.javascript.Scriptable parent,
Connection conn)
getClassName
public String getClassName ()
Specified by: getClassName
in interface org.mozilla.javascript.Scriptable
Specified by: getClassName
in class org.mozilla.javascript.ScriptableObject
finishInit
public static void finishInit (org.mozilla.javascript.Scriptable proto)
jsConstructor
public static org.mozilla.javascript.Scriptable jsConstructor (org.mozilla.javascript.Context cx,
Object [] args,
org.mozilla.javascript.Function ctorObj,
boolean inNewExpr)
throws Exception
Throws:
Exception
jsFunction_query
public Object jsFunction_query (String sql,
Object params,
int startRow,
int maxRows,
Object funObj)
throws org.mozilla.javascript.JavaScriptException
Throws:
org.mozilla.javascript.JavaScriptException
jsFunction_update
public int jsFunction_update (String sql,
Object params)
throws org.mozilla.javascript.JavaScriptException
Throws:
org.mozilla.javascript.JavaScriptException
get
public Object get (String name,
org.mozilla.javascript.Scriptable start)
Specified by: get
in interface org.mozilla.javascript.Scriptable
Overrides: get
in class org.mozilla.javascript.ScriptableObject
has
public boolean has (String name,
org.mozilla.javascript.Scriptable start)
Specified by: has
in interface org.mozilla.javascript.Scriptable
Overrides: has
in class org.mozilla.javascript.ScriptableObject
has
public boolean has (int index,
org.mozilla.javascript.Scriptable start)
Specified by: has
in interface org.mozilla.javascript.Scriptable
Overrides: has
in class org.mozilla.javascript.ScriptableObject
get
public Object get (int index,
org.mozilla.javascript.Scriptable start)
Specified by: get
in interface org.mozilla.javascript.Scriptable
Overrides: get
in class org.mozilla.javascript.ScriptableObject
put
public void put (String name,
org.mozilla.javascript.Scriptable start,
Object value)
Specified by: put
in interface org.mozilla.javascript.Scriptable
Overrides: put
in class org.mozilla.javascript.ScriptableObject
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.