# 2. Adapters

Adapters are the backbone of the UI Components.\
\
**1. SQL Runner Adapter**

The SQL Runner Adapter holds the connection to a database, we can run an SQL Query by calling the execAsync function.\
\
execAsync(query: string) -> Promise\<result>  run an SQL and receive the result.

{% hint style="success" %}
How to use SQL Runner?

We can use it in the script of JavaScript Runner to perform a query. For example, we can write a script to run a query and get the result to render.\
\
sql\_runner.execAsync("select 1").then((result)=>{

&#x20;   data\_table.value = result;\
})
{% endhint %}

\
**2. JavaScript Runner Adapter.**\
\
The JavaScript Runner Adapter can be linked with UI components to handle its events.

{% hint style="success" %}
The JavaScript Runner can only run JavaScript. It's an isolation context, there are a few built-in functions:

* alert(string): show an alert dialog.
* prompt(string): show a dialog with input.
* confirm(string): show a confirmation dialog.

You can also access all the UI component objects in the script referenced by their names.
{% endhint %}
