Formulaic Density By Sura Chart - warwickfoster/qurantools GitHub Wiki

File: app/formulae/export_full_gloss_list.php

Purpose

The PHP script you provided is designed to generate SQL statements for updating the FORMULA FULL GLOSS column in the FORMULA-LIST table. The script extracts distinct formulas and their full gloss definitions from the table and creates SQL statements to update the FORMULA FULL GLOSS column with the corresponding values.

How it Works

  1. Authentication and Authorization

    • The script requires authentication and authorization using the auth/auth.php file.
    • Only administrators have access to this page.
  2. Database Query

    • The script performs a SQL query to select distinct formulas and their full gloss definitions from the FORMULA-LIST table.
    • It filters the results to include only formulas with non-empty full gloss definitions.
  3. SQL Statement Generation

    • For each row in the result set, the script generates an SQL statement to update the FORMULA FULL GLOSS column for the corresponding formula.
    • The statement uses db_quote() to escape the values properly.
  4. Output

    • The script displays the generated SQL statements in HTML paragraphs.
    • It also displays a message indicating that the task is done.

Usage

  • The script should be run by an administrator.
  • The generated SQL statements can be copied and executed in a database management tool.

Benefits

  • Automates the process of generating SQL statements for updating full gloss definitions.
  • Ensures data consistency by updating all formulas with their full gloss definitions.

Note

  • The script assumes that the FORMULA-LIST table exists with the necessary columns.
  • The db_query(), db_rowcount(), db_return_row(), and db_quote() functions are assumed to be available in the library/functions.php file.