Pelzini

This is the code documentation for the Pelzini project

class MysqlOutputter

Outputs the tree as MySQL

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-03-29
**/
class NewClassName extends MysqlOutputter {
    
    /**
    * Returns the number of rows affected in the last query
    **/
    protected function affected_rows ($res) {
        // Method code goes here
    }
    
    /**
    * Returns the autogenerated id created in the last query
    **/
    protected function insert_id () {
        // Method code goes here
    }
    
    /**
    * Returns an array of the tables in this database
    **/
    protected function get_table_list () {
        // Method code goes here
    }
    
    /**
    * Converts an internal type into the database-specific SQL type.
    * The defined internal types are:
    *   - serial: a number that automatically increments whenever a record is added
    *   - smallnum: a small number. needs to be able to hold at least 32,767 possible values (e.g. a 16-bit signed integer)
    *   - largenum: a large number. needs to be the same size or larger than a serial type
    *   - string: a character field long enough to hold identifiers of objects (e.g. function names)
    *   - text: a field that can hold arbitary pieces of text larger than 65536 chars in length.
    **/
    protected function get_sql_type (string $internal_type_name) {
        // Method code goes here
    }
    
    /**
    * Should return a multi-dimentional array of the column details
    * Format:
    * Array [
    *   [0] =&gt; Array [
    *      'Field' =&gt; field name
    *      'Type' =&gt; field type, (e.g. 'serial', 'smallnum' or 'identifier')
    *      'NotNull' =&gt; nullable?, (true or false)
    *      'Key' =&gt; indexed?, ('PRI' for primary key)
    *      ]
    *    [1] =&gt; ...
    *    [n] =&gt; ...
    **/
    protected function get_column_details ($table_name) {
        // Method code goes here
    }
    
    /**
    * Should return a multi-dimentional array of the index details
    * Format:
    * Array [
    *   [0] =&gt; Array [
    *      'Fields' =&gt; array of field names
    *      ]
    *   [1] =&gt; ...
    *   [n] =&gt; ...
    **/
    protected function get_index_details ($table_name) {
        // Method code goes here
    }
    
    /**
    * Gets the query that alters a column to match the new SQL definition
    **/
    protected function get_alter_column_query ($table, $column_name, $new_type, $not_null) {
        // Method code goes here
    }
    
    /**
    * Creates a table
    **/
    protected function create_table ($table_name, $dest_table) {
        // Method code goes here
    }
    
    /**
    * The database engine should start a transaction. If transactions are not supported, it should do nothing.
    **/
    protected function start_transaction () {
        // Method code goes here
    }
    
    /**
    * The database engine should commit a transaction. If transactions are not supported, it should do nothing.
    **/
    protected function commit_transaction () {
        // Method code goes here
    }
    
    /**
    * The database engine should rollback a transaction. If transactions are not supported, it should do nothing.
    **/
    protected function rollback_transaction () {
        // Method code goes here
    }
    
    /**
    * Fetches a row from the database (assoc)
    **/
    protected function fetch_assoc ($res) {
        // Method code goes here
    }
    
    /**
    * Fetches a row from the database (numerical)
    **/
    protected function fetch_row ($res) {
        // Method code goes here
    }
    
    /**
    * Connects to the db
    **/
    public function __construct ($username, $password, $server, $database) {
        // Method code goes here
    }
    
    /**
    * Closes connection to the db
    **/
    public function __destruct () {
        // Method code goes here
    }
    
    /**
    * Connects to the MySQL database
    **/
    protected function connect () {
        // Method code goes here
    }
    
    /**
    * Executes a MySQL query
    **/
    protected function query ($query) {
        // Method code goes here
    }
    
    /**
    * Safens some input
    **/
    protected function sql_safen (string $input) {
        // Method code goes here
    }
    
}
?>