sql_alter

The sql_alter() function is used to send an ALTER type SQL command to the database server to modify the structure of the database.

The function accepts 3 parameters:

$q is the query string (without the term "ALTER") to be executed

$serveur,

$option

Note: This function directly assumes an SQL formatted command, so it is important to respect the SQL standards. It is possible in future versions of SPIP, that the $q parameter will accept a more structured table as input in order to simplify porting to other systems.

The "TradRub" plugin includes in its installation procedure an instruction to add the "id_trad" column to the spip_rubriques table by using the maj_tables() function provided for such a purpose, then adds an index on that same column using sql_alter():