Plugin Directory

Changeset 1712379


Ignore:
Timestamp:
08/11/2017 11:18:56 PM (9 years ago)
Author:
hawk__
Message:

Integrated some corrections

Location:
postgresql-for-wordpress/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • postgresql-for-wordpress/trunk/pg4wp/driver_pgsql.php

    r969858 r1712379  
    9090    {
    9191        $pg_connstr = $GLOBALS['pg4wp_connstr'].' dbname='.$dbname;
    92 
    93         $GLOBALS['pg4wp_conn'] = pg_connect($pg_connstr);
     92       
     93        if( !empty($GLOBALS['pg4wp_connstr']))
     94            $GLOBALS['pg4wp_conn'] = pg_connect($pg_connstr);
    9495       
    9596        if( $GLOBALS['pg4wp_conn'])
     
    226227                $pattern = '/SELECT\s+([^\s]+)\s+(FROM.+)/';
    227228                $sql = preg_replace( $pattern, 'SELECT COUNT($1) $2', $sql);
     229            }
     230            elseif( false !== strpos($sql, '@@SESSION.sql_mode'))
     231            {
     232                $sql = 'SELECT \'\';';
    228233            }
    229234           
     
    386391            $logto = 'SHOWTABLES';
    387392            $sql = 'SELECT tablename FROM pg_tables WHERE schemaname = \'public\';';
     393        }
     394        // Rewriting SHOW FULL COLUMN (fix provided by rafaelbernard : https://gist.github.com/rafaelbernard/0249b7b665562cbab080)
     395        elseif( 0 === strpos($sql, 'SHOW FULL COLUMN'))
     396        {
     397            $logto = 'SHOWFULL';
     398            $sql = str_replace( 'SHOW FULL COLUMNS FROM ', 'SELECT column_name FROM information_schema.columns WHERE table_name = ', $sql);
     399            $sql = str_replace( '`', "'", $sql );
    388400        }
    389401        // Rewriting optimize table
  • postgresql-for-wordpress/trunk/readme.txt

    r969858 r1712379  
    6666
    6767== Changelog ==
     68
     69* Corrected a strange behavior where effective connection may happen a second time
     70* Ignore '@@SESSION.sql_mode'
    6871
    6972= 1.3.1 =
Note: See TracChangeset for help on using the changeset viewer.