sqlUpdateBlobsqlUpdateBlob
Make SQL Updates to a Blob field in an RDBMS table
Home > Books > NetKernel API and Services Reference > Accessor Listing > RDBMS Accessors and Utilities > sqlUpdateBlob

Rate this page:
Really useful
Satisfactory
Not helpful
Confusing
Incorrect
Unsure
Extra comments:


Module

urn:org:ten60:netkernel:mod:db

The sqlUpdateBlob accessor is exported by the urn:org:ten60:netkernel:mod:db module. Import this module to gain access to the accessor.

Syntax

URI
active:sqlUpdateBlob

ArgumentRulesDescription
operandMandatory the <sql> query document
configurationOptional optional configuration document

Example Usage

DPML

<instr>
  <type>sqlUpdateBlob</type>
  <operand>
    <sql>INSERT INTO table VALUES ('name_of_my_blob',?);</sql>
  </operand>
  <param>var:myblob</param>
  <configuration>/myconfiguration/configRDBMS.xml</configuration>
  <target>var:result</target>
</instr>

NetKernel Foundation API

req=context.createSubRequest("active:sqlUpdateBlob");
req.addArgument("operand", [resource representation, aspect, or URI] );
result=context.issueSubRequest(req);

Purpose

The sqlUpdateBlob accessor enables a binary resource to be stored in an RDBMS table blob field. An SQL update prepared statement is constructed and the resource specified in the param argument is inserted into the first '?' substution field of the query.

In the example shown above, table has two columns, a varchar name and a blob. The SQL statement creates a new row using the INSERT statement, the question mark is substituted for the var:myblob binarystream.

sqlUpdateBlob may use INSERT and UPDATE SQL operations.

Configuration

By default the configuration will be read from ffcpl:/etc/ConfigRDBMS.xml. The document provides a driver and connection URI (see example below). Alternatively,the configuration can be provided in an optional <configuration> argument - this may be either a URI to a config document or a literal configuration document.

<config>
  <rdbms>
    <jdbcDriver>com.mysql.jdbc.Driver</jdbcDriver>
    <jdbcConnection> jdbc:mysql://localhost/mydatabase?user=myusername&amp;password=mypassword </jdbcConnection>
  </rdbms>
</config>
For more details on the configuration see the Mod DB Guide.
© 2003-2007, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.