From f31a830945e0b5a4f314fbb71d1eeaa1fcd9c4c0 Mon Sep 17 00:00:00 2001 From: lovasoa Date: Sun, 28 Dec 2025 03:06:07 +0100 Subject: [PATCH] add links to /extensions-to-sql it's still hard to get a clear understanding of how variables work in sqlpage when getting started https://github.com/sqlpage/SQLPage/issues/1166 --- examples/official-site/documentation.sql | 9 ++++++--- examples/official-site/functions.sql | 6 ++++-- .../official-site/your-first-sql-website/tutorial.md | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/official-site/documentation.sql b/examples/official-site/documentation.sql index b4bbed93..e848f351 100644 --- a/examples/official-site/documentation.sql +++ b/examples/official-site/documentation.sql @@ -12,11 +12,11 @@ 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](get%20started.sql), +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. +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**. @@ -24,7 +24,7 @@ The two most important concepts in SQLPage are **components** and **parameters** - *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: +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; @@ -38,6 +38,9 @@ SELECT my_column_1 AS row_level_parameter_1, my_column_2 AS row_level_parameter_ 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), diff --git a/examples/official-site/functions.sql b/examples/official-site/functions.sql index 5b8f4a8d..ad91cfa7 100644 --- a/examples/official-site/functions.sql +++ b/examples/official-site/functions.sql @@ -24,6 +24,8 @@ Thus, they require all the parameters to be known at the time the query is sent Function parameters cannot reference columns from the rest of your query. The only case when you can call a SQLPage function with a parameter that is not a constant is when it appears at the top level of a `SELECT` statement. For example, `SELECT sqlpage.url_encode(url) FROM t` is allowed because SQLPage can execute `SELECT url FROM t` and then apply the `url_encode` function to each value. + +For more information about how SQLPage functions are evaluated, and data types in SQLPage, read [the SQLPage data model documentation](/extensions-to-sql). ' as contents_md where $function IS NULL; select 'list' as component, 'SQLPage functions' as title where $function IS NULL; @@ -53,7 +55,7 @@ select from sqlpage_function_parameters where "function" = $function ORDER BY "index"; -select +select 'button' as component, 'sm' as size, 'pill' as shape; @@ -63,4 +65,4 @@ select sqlpage.set_variable('function', name) as link from sqlpage_functions where $function IS NOT NULL -order by name; \ No newline at end of file +order by name; diff --git a/examples/official-site/your-first-sql-website/tutorial.md b/examples/official-site/your-first-sql-website/tutorial.md index 6faaaf1c..582a9463 100644 --- a/examples/official-site/your-first-sql-website/tutorial.md +++ b/examples/official-site/your-first-sql-website/tutorial.md @@ -194,5 +194,6 @@ If you prefer to host your website yourself, you can use a cloud provider or a V - Check out [learnsqlpage.com](https://learnsqlpage.com) by Nick Antonaccio for an in-depth tutorial with many examples - Read the [SQLPage documentation](/documentation.sql) to learn about all the components available in SQLPage +- Read about [SQLPage's extensions to SQL](/extensions-to-sql) for a specification of the SQL syntax you can use in SQLPage, the data types used when exchanging data with the browser and with the database, a clear explanation of how *SQLPage variables* and *SQLPage functions* work. - Join the [SQLPage community](https://github.com/sqlpage/SQLPage/discussions) to ask questions and share your projects - If you like videos better, check this series that shows how to build and deploy your app from scratch [SQLPage on Youtube](https://www.youtube.com/playlist?list=PLTue_qIAHxAf9fEjBY2CN0N_5XOiffOk_) \ No newline at end of file