Monday, July 30, 2012

GSoC 2012 - 10th Week Progress

        This is my 10th week of GSoC 2012 project. In last week I implemented support for displaying results for multiple SQL query statements and stored routines with multiple queries. SQL query window can be used to both cases above.

      There were some issues in my previous code. So I first moved into fix one issue. It takes bit more time to fix it than I thought.

Then I moved into next feature implementation. Mainly there were two parts in this feature.
1. Syntax highlighting for SQL in PROCESSLIST table in information_schema database
2. Relations inside mysql database

         For the first task, I used a new public property inside PMA_DisplayResults class which contains all the details of columns which need to be apply syntax highlight effect. So that any other table field also can use this feature. Now the SQL field is syntax highlighted in PROCESSLIST table.

                 Second task is not related to actual relations with foreign keys, it means just link data rows to corresponding pages where possible. As an example, User column of db table in mysql database, can be linked to edit user privileges of corresponding user according to the User column value. A new file called mysql_schema_relation.lib.php has introduced which have a global variable with all the column information of tables which needs to be display as links where possible. From each element of this variable (array), one link can be generated.

$GLOBALS['mysql_schema_relation'] = array(
    'db' => array(        // db table in mysql schema
        'db' => array(    // Db column in db table
            // link_params array contains the get params,
            // if array element is string, value of parameter is set as column value
            // if any of array element is array, url param is the first data of the array and value is second data of the array
            'link_params' => array('db'),
            // This represent the page to link
            'default_page' => 'index.php'
        ),

        'user' => array(    // User column of db table
            'link_params' => array('username'),
            'default_page' => 'server_privileges.php'
        )
    ),

    'proc' => array(
        'db' => array(
            'link_params' => array('db'),
            'default_page' => 'index.php'
        )
    ),

);

    Above array is represented as lowercase string array. So when comparing the strings those need to be convert to lowercase. (strtolower() function can be used.)

            Now there can be see several links inside mysql schema. In my next week I'll implement the feature, linking from information_schema to phpmyadmin schema.

No comments:

Post a Comment