SQL Pass-thru

SQL Pass-thru enables users to execute custom defined queries. This screen is different from SQL Pass-thru configuration in that it is accessible to all users and only query execution is possible.

Queries list

The Queries list provides a list of queries defined in SlashDB. Only queries for which a logged-in user has execute permission will be listed.

Run

The button will execute the selected query.

Query ID

This column contains the name of the query.

Description

This column provides a quick description of the query.

Database

This column shows in which database the query will execute.

The Search field allows users to search all queries setup in SlashDB. To conduct a search, input the search terms in the field and the queries list will automatically filter down to the matching results. Columns Query ID, Description and Database will be searched.

JSON button

The JSON button located in the top right corner of the page works just like the buttons located in the Database list. The button allows users to view the query list in the JSON format. To return to HTML view, click the browser's back button.

Executing query

Once the play button is clicked the query box will appear and allow users to execute the query. If you query accepts parameters, a text-box form will also display.

Click the Execute button to send the query for execution. Alternatively, you can click on a generated URL to get results in a new window in desired format.

SQL Pass-Thru queries accept parameters if SQL in query definition contains placeholders.

Usage:

/query/[query_id]
/query/[query_id]/[param1_name]/[param1_value]/[param2_name]/[param2_value]

Examples:

/query/customers-in-city/city/Paris.json - this query takes one parameter named "city" and in this example "city" has value "Paris".


Query results

Query results will appear at the bottom of the screen when a query is successfully executed.

Object

Result rows can be presented in XML (with XSD), JSON and CSV.

Examples:

/query/customers-in-city/city/Paris.json - SQL Pass-Thru query result in JSON.

Array

In cases when you need only certain columns from your query result you can add a segment to the URL with comma separated names of columns.

Usage:

/query/[query_id]/[columnA],[columnB],[columnC]

Value Type: comma separated list of valid column names

Examples:

/query/customers-in-city/city/Paris/FirstName,LastName.json - the output will contain only columns FirstName and LastName (State and Phone were excluded).


url string substitution

This feature allows to replace part of the url with string defined in query parameter.
Visit this documentation page for detailed explanation.


limit and offset

This feature allows to limit and skip rows of returned data. Visit Visit this documentation page for detailed explanation.


count

When using this query string argument in request the response will contain also additional header SlashDB-All-Record-Count that tells what's the total count of rows returned by the query. Useful when using limit and offset with.

Usage:

?count

Response Header:

SlashDB-All-Record-Count:2

Value type: (no value)

Default: (not used)

Examples:

/query/customers-in-city/city/Paris.json?count - response contains header with total number of rows returned by query (header SlashDB-All-Record-Count: 2)

/query/customers-in-city/city/Paris.json?count&limit=1 - like above example but with additional limit=1, header SlashDB-All-Record-Count still is 2, even though we're using limit.

$ curl -v 'https://demo.slashdb.com/query/customers-in-city/city/Paris.json?count&limit=1'
* Hostname was NOT found in DNS cache
*   Trying 50.19.250.51...
* Connected to demo.slashdb.com (50.19.250.51) port 443 (#0)

[...]

> GET /query/customers-in-city/city/Paris.json?count&limit=1 HTTP/1.1
> User-Agent: curl/7.35.0
> Host: demo.slashdb.com
> Accept: */*
>
< HTTP/1.1 200 OK
* Server nginx/1.4.6 (Ubuntu) is not blacklisted
< Server: nginx/1.4.6 (Ubuntu)
< Date: Thu, 12 Jul 2018 15:00:22 GMT
< Content-Type: application/json
< Content-Length: 139
< Connection: keep-alive
< SlashDB-All-Record-Count: 2
<
[
    {
        "LastName": "Bernard",
        "State": null,
        "FirstName": "Camille",
        "Phone": "+33 01 49 70 65 65"
    }
]

XML

nil visible

This feature allows to force showing empty tags.

Usage:

?nil_visible=[True_or_False]

Value type: boolean (True or False)

Default: False

Examples:

/query/customers-in-city/city/Paris.xml - not showing empty tags by default

/query/customers-in-city/city/Paris.xml?nil_visible=False - not showing empty tags

/query/customers-in-city/city/Paris.xml?nil_visible=True - showint empty tags


xmlType

This feature allows to adjust XML output.

Usage:

?xmlType=[name_of_xml_type]

Value type: string

Value options:

Default: (not used)

Examples:

/query/customers-in-city/city/Paris.xml?xmlType=adPersistXML - rendering XML in Persistance Format.

results matching ""

    No results matching ""