PRE, POST, POST_NO

The hooks for these methods are available to be executed prior or after the INSERT, UPDATE or DELETE queries. The methods can generate a SQL code depending on which user is connected. The methods are used often in the .mql files, many examples of their use can be found in the /opt/masonsql/htdocs/ directory tree.

Group Name Method Name Arguments DescriptionSorted ascending
  PRE_INSERT    
  PRE_DELETE    
  POST_INSERT    
  POST_UPDATE    
  POST_DELETE    
  POST_NO_INSERT    
  POST_NO_UPDATE    
  POST_NO_DELETE    
    $DUP_KEY $Params->{'dup_key'}
    $DUP_KEY $Params->{'dup_key'}
    $DUP_KEY $Params->{'dup_key'}
    $ROW A contents of a record.
    $ROW A contents of a record.
    $ROW A contents of a record.
    $ROW A contents of a record.
    $PARAMS A parameters for the prepared query must be added to the \%params
    $PARAMS A parameters for the prepared query must be added to the \%params
    $PARAMS A parameters for the prepared query must be added to the \%params
    $PARAMS A parameters for the prepared query must be added to the \%params
    $PARAMS A parameters for the prepared query must be added to the \%params
    $PARAMS A parameters for the prepared query must be added to the \%params
    $PARAMS A parameters for the prepared query must be added to the \%params
    $PARAMS A parameters for the prepared query must be added to the \%params
    $PARAMS A parameters for the prepared query must be added to the \%params
    $KEY A primary key value.
    $KEY A primary key value.
    $KEY A primary key value.
    $KEY A primary key value.
    $KEY A primary key value.
    $KEY A primary key value.
    $KEY A primary key value.
    $KEY A primary key value.
    $FIELDS_INSERT Is a hash pointer.
    $FIELDS_UPDATE Is a hash pointer.
    $FIELDS_INSERT Is a hash pointer.
The $FIELDS, $VALUES and $LIST_VALUES are extracted from the $FIELDS_INSERT.
    $FIELDS_UPDATE Is a hash pointer.
The $UPDATES and $LIST_VALUES are extracted from the $FIELDS_UPDATE.
POST_     The POST methods are called after the main query was executed.
POST_NO_     The POST_NO methods are called when the main query was not executed.
PRE_     The PRE methods are called before the main query is executed.
  PRE_UPDATE   The PRE_DELETE, DELETE are also called just before PRE_UPDATE if any of the fields from DELETE_IF_FIELD_EMPTY is to be updated with an empty value.

Compared to the use of editable views it is easier to manage code, inside the MasonSQL .mql files.
The sql rules that must be used with the editable views are complicated, hard to understand even by DBAs and consequently not practical.
Topic revision: r6 - 22 Apr 2018, GuidoBrugnara
This site is powered by FoswikiCopyright (©) Leader.IT - Italy P.I. IT01434390223 Privacy policy & use of cookies