d718c5a372
CI / compile_and_lint (push) Failing after 0s
CI / docker_build (linux/amd64, -linux-amd64-duckdb, duckdb) (push) Failing after 0s
CI / docker_build (linux/arm64, -linux-arm64, minimal) (push) Failing after 2s
CI / docker_build (linux/arm64, -linux-arm64-duckdb, duckdb) (push) Failing after 1s
CI / docker_build (linux/amd64, minimal) (push) Failing after 1s
CI / test (, sqlite, sqlite::memory:) (push) Has been skipped
CI / test (mssql, mssql, mssql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (mysql, mysql, mysql://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / test (oracle, oracle, Driver=Oracle 21 ODBC driver;Dbq=//127.0.0.1:1521/FREEPDB1;Uid=root;Pwd=Password123!) (push) Has been skipped
CI / test (postgres, odbc, Driver=PostgreSQL Unicode;Server=127.0.0.1;Port=5432;Database=sqlpage;UID=root;PWD=Password123!, true) (push) Has been skipped
CI / test (postgres, postgres, postgres://root:Password123!@127.0.0.1/sqlpage) (push) Has been skipped
CI / playwright (push) Has been skipped
CI / docker_build (linux/arm/v7, -linux-arm-v7, minimal) (push) Failing after 0s
CI / hurl_examples (push) Failing after 8s
deploy website / deploy_official_site (push) Failing after 1s
CI / hurl (${{ matrix.example }}) (push) Has been skipped
CI / docker_push (duckdb) (push) Has been cancelled
CI / docker_push (minimal) (push) Has been cancelled
CI / windows_test (push) Has been cancelled
58 lines
2.8 KiB
SQL
58 lines
2.8 KiB
SQL
-- ensure that the component exists and do not render this page if it does not
|
|
select 'redirect' as component, sqlpage.link('component.sql', json_object('component', $component)) as link
|
|
where $component is not null;
|
|
|
|
-- This line, at the top of the page, tells web browsers to keep the page locally in cache once they have it.
|
|
select 'http_header' as component, 'public, max-age=600, stale-while-revalidate=3600, stale-if-error=86400' as "Cache-Control";
|
|
|
|
select 'dynamic' as component, json_patch(json_extract(properties, '$[0]'), json_object(
|
|
'title', coalesce($component || ' - ', '') || 'SQLPage Documentation'
|
|
)) as properties
|
|
FROM example WHERE component = 'shell' LIMIT 1;
|
|
|
|
select 'text' as component, format('SQLPage v%s documentation', sqlpage.version()) as title;
|
|
select '
|
|
If you are completely new to SQLPage, you should start by reading the [get started tutorial](/your-first-sql-website/),
|
|
which will guide you through the process of creating your first SQLPage application.
|
|
|
|
Building an application with SQLPage is quite simple.
|
|
To create a new web page, just create a new SQL file.
|
|
For each SELECT statement that you write, the data it returns will be analyzed and rendered to the user.
|
|
The two most important concepts in SQLPage are **components** and **parameters**.
|
|
|
|
- **components** are small user interface elements that you can use to display your data in a certain way.
|
|
- *top-level* **parameters** are the properties of these components, allowing you to customize their appearance and behavior.
|
|
- *row-level* **parameters** constitute the data that you want to display in the components.
|
|
|
|
To select a component and set its top-level properties, you write the following SQL statement:
|
|
|
|
```sql
|
|
SELECT ''component_name'' AS component, ''my value'' AS top_level_parameter_1;
|
|
```
|
|
|
|
Then, you can set its row-level parameters by writing a second SELECT statement:
|
|
|
|
```sql
|
|
SELECT my_column_1 AS row_level_parameter_1, my_column_2 AS row_level_parameter_2 FROM my_table;
|
|
```
|
|
|
|
This page documents all the components provided by default in SQLPage and their parameters.
|
|
Use this as a reference when building your SQL application.
|
|
For more information about SQLPage variables and [SQLPage functions](/functions),
|
|
read about [the SQLPage data model](/extensions-to-sql).
|
|
|
|
If at any point you need help, you can ask for it on the [SQLPage forum](https://github.com/sqlpage/SQLPage/discussions).
|
|
|
|
If you know some [HTML](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/HTML_basics),
|
|
you can also easily [create your own components for your application](./custom_components.sql).
|
|
' as contents_md;
|
|
|
|
select 'list' as component, 'components' as title;
|
|
select
|
|
name as title,
|
|
description,
|
|
icon,
|
|
sqlpage.link('component.sql', json_object('component', name)) as link
|
|
from component
|
|
order by name;
|