|Description:||The active:sqlPSUpdate service is used to execute SQL INSERT, UPDATE and DELETE prepared statements which will add, change or delete data in a database with parameterized fields.|
sqlPSUpdate is an accessor using Active URI syntax with the following base identifiers:
and the following arguments: (for more details on argument passing details see here)
|Representation (java.lang.Object)||SQL update statement to be executed|
|Representation (java.lang.Object)||Connection pool configuration|
0 ... infinity
|Representation (java.lang.Object)||Prepared Statement Parameter (order dependent)|
The following verb is supported:
The response representation of this accessor for SOURCE requests is unknown.
This accessor throws no documented exceptions.
To use sqlPSUpdate accessor you must import the module urn:org:netkernel:mod:db:
When a request with the SOURCE verb is issued to
the SQL query specified in the required operand argument is used with
connection pool specified in the optional configuration argument.
(If the configuration argument is not supplied then the service issues a
request for the resource
res:/etc/ConfigRDBMS.xml in the current
The argument operand is requested by the service as a DeterminateStringRepresentation which allows the supplied representation type to be any of the forms that can be transrepted to a DeterminateString.
Parameters in the prepared statement SQL are denoted by a question mark ?. For example
UPDATE users SET haircolor = ? WHERE age < ? AND eyecolor=?;
Parameters are order dependent. Each delimited parameter must be provided as a param argument on the request. The java class type of the param argument is determined during the preparation of the statement with the database. The param argument will be SOURCEd with a Java class determined by the JDBC PreparedStatement using the ParameterMetadata. It is essential that the supplied parameter either be of the correct type, or is transreptable to the correct type.
By default, the response representation is returned as an HDS structure in which a resultset node contains a row node for each row returned by the query.
The response representation takes the same form as documented for active:sqlUpdate
The following code implements an example prepared statement update with one parameter.
request = context.createRequest("active:sqlPSUpdate"); request.addArgumentByValue("operand", "DELETE FROM users WHERE age=?;") request.addArgumentByValue("param", 42); hds = context.issueRequest(request);