WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Endpoint
Name:sqlBooleanQuery
Description:The active:sqlBooleanQuery service retrieves information from a relational database (RDBMS) using SQL query processing and returns a Boolean result.
Id:mod-db:sqlBooleanQuery
Category:accessor
Identifier Syntax

sqlBooleanQuery is an accessor using Active URI syntax with the following base identifiers:

Base
active:sqlBooleanQuery

and the following arguments: (for more details on argument passing details see here)

ArgumentRulesTypingDescription
operand
Mandatory
Representation (java.lang.Object)SQL query statement to be executed
configuration
Optional
Representation (java.lang.Object)Connection pool configuration
Request Verbs

The following verb is supported:

Verb
SOURCE
Response

The response representation of this accessor for SOURCE requests is unknown.

This accessor throws no documented exceptions.

Import Requirements

To use sqlBooleanQuery accessor you must import the module urn:org:netkernel:mod:db:

<import>
  <uri>urn:org:netkernel:mod:db</uri>
</import>

When a request with the SOURCE verb is issued to active:sqlBooleanQuery the SQL query specified in the required operand argument is used with the database 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 space.) The response representation is returned as an Boolean.

The value returned is true if at least one row is returned from the query and is false if no rows are returned from the query.

For example, for the table "Users":

FIRSTNAMELASTNAMEAGE
MichaelSmith42
SusanJamison38

the query

SELECT * FROM users WHERE firstname='Michael';

would return true because at least one row matches the SQL WHERE clause. The query

SELECT * FROM users WHERE firstname='Fred';

would return false because no rows match the SQL WHERE clause.

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.

Example

The following code implements the example query illustrated above.

request = context.createRequest("active:sqlBooleanQuery");
request.addArgumentByValue("operand", "SELECT * FROM users WHERE firstname='Michael';")
if (context.issueRequest(request)
  {
  ...
  }