发布

  • **Clean URLs:**

    frostbyte_neo 发布于 2025-02-14 22:38:28 +00:00 | 896 次提交 在此版本后已推送到 main

    Now, you can access your pages without the extra “.sql” suffix. For example, if you’ve got a file called page.sql, simply use:

    https://example.com/page
    

    The previous behavior is preserved, so adding “.sql” still works. A big shout‑out to @guspower for their contributions!

    Complete Routing Rewrite:
    We’ve reworked our request routing system from top to bottom to make things smoother and more predictable for every request.


    HTTP Basic Authentication in fetch:
    SQLPage’s sqlpage.fetch function now supports HTTP Basic Authentication. Quickly call external APIs that require a username and password. For example:

    SELECT sqlpage.fetch(
      'https://api.example.com/data',
      JSON_OBJECT(
        'auth', JSON_OBJECT('username', 'user', 'password', 'pass')
      )
    );
    

    Learn more in the fetch documentation.

    Smarter fetch errors & Headers Defaults:
    When your HTTP request definition is off, you’ll now get clearer error messages—especially if there are unknown fields. Plus, the headers parameter is now optional: if omitted, SQLPage sends a default User‑Agent header that includes the SQLPage version.


    • Table CSS Fixes:
      We fixed a bug that prevented proper CSS classes from being added to table cells. Your tables now look as polished as you expect.

    • Native Number Formatting:
      Numeric values in tables are automatically formatted to your visitor’s locale. That means thousands separators, correct decimal points, and sorting that respects numeric order—without any extra work from you.
      Example:

      SELECT 'table' AS component, 'Sales Data' AS title;
      SELECT amount AS 'Total Sales' FROM sales;
      

      Not a formatted string in the database—just pure, locale‑sensitive output.

    • Enhanced Card Layouts:
      Creating custom layouts with the card component is now easier:

      • The embed property automatically appends the _sqlpage_embed parameter to render your page as an embeddable fragment.
      • When an embedded page is rendered, the shell component is replaced by shell-empty to avoid duplicate headers and metadata.
    • Auto‑Submit Forms:
      Add the new auto_submit parameter to your forms, and watch them auto‑submit on any field change—perfect for instant filters on dashboards.
      Example:

      SELECT 'form' AS component, 'Filter Results' AS title, true AS auto_submit;
      SELECT 'date' AS name;
      
    • Dynamic Options for Dropdowns:
      Use the new options_source parameter to load dropdown options dynamically from another SQL file. Great for autocomplete on huge option lists!
      Example:

      SELECT 'form' AS component, 'Select Country' AS title, 'countries.sql' AS options_source;
      SELECT 'country' AS name;
      
    • Markdown in Field Descriptions:
      With the new description_md property, you can now render markdown in form field descriptions to better guide your users.

    • Improved Header Error Messages:
      If you accidentally use a header component (like json or cookie) after sending data, you’ll now see a more helpful error message.


    • ApexCharts Upgrade:
      We’ve updated ApexCharts to v4.4.0. Expect smoother charts with bug fixes for your visualizations.

    • Tabler Icons & CSS:
      Enjoy a refreshed look with Tabler Icons updated to v3.30.0 and the CSS framework upgraded to Tabler 1.0.0. More icons, better consistency, and a sleeker interface.


    • Enhanced CSV Error Messages:
      We improved error messages when a CSV import fails (using a copy statement and file upload).
    • Postgres CSV Bug Fix:
      A pesky bug causing subsequent requests to fail after a CSV import error on PostgreSQL is now fixed. (See Issue #788 for details.)

    Upgraded SQL Parser (v0.54):
    Our sqlparser is now at v0.54, offering enhanced support for advanced SQL syntax. New additions include:

    • INSERT...SELECT...RETURNING:
      INSERT INTO users (name, email)
      SELECT :name, :email
      WHERE :name IS NOT NULL
      RETURNING 'redirect' AS component, 'user.sql?id=' || id AS link;
      
    • PostgreSQL’s overlaps operator:
      SELECT 'card' AS component;
      SELECT event_name AS title, start_time || ' - ' || end_time AS description
      FROM events
      WHERE (start_time, end_time) overlaps ($start_filter::timestamp, $end_filter::timestamp);
      
    • MySQL’s INSERT...SET syntax:
      INSERT INTO users
      SET name = :name, email = :email;
      

    New Function: sqlpage.headers
    Easily manage and inspect HTTP headers with the brand‑new sqlpage.headers function.

    下载附件