Support » Plugin: PostgreSQL for WordPress (PG4WP) » Issue with SimpleField plugin

  • Resolved gabrielstuff

    (@gabrielstuff)


    Hi !

    First : Great work.
    Unfortunately some preg_match break compatibility with simplefield plugin ( here)

    The issue is here :

    $pattern = '/[0-9a-zA-Z_]+ID/';
    $sql = preg_replace($pattern, '"$0"', $sql);

    While the pg4wp plugin try to handle some particular case on line 431 of the driver_pgsql.php file it escape the value instead of leaving it as it is.

    Well, I just found out … So I will post the solution later today 🙂

    In order to test, just add some meta to a post with the value GroupIDA

    You’ll see you can add it but you can not delete it !

    Great job anyway !

    http://wordpress.org/extend/plugins/postgresql-for-wordpress/

Viewing 4 replies - 1 through 4 (of 4 total)
  • ok found one solution :

    replace the pattern by :

    $pattern = '/[0-9a-zA-Z_]+ID(?=(?:[^"\']|"[^"\']*")*$)/';

    Unfortunately I did not notice that one previous regexp break the sql statement. The bad one is :

    $pattern = '/ID([^ ])/';

    line 423.

    Finnaly had to replace with this :

    line 423:

    $pattern = '/ID(?=(?:[^"\']|"[^"\']*")*$)([^ ])/';

    line 433:

    $pattern = '/[0-9a-zA-Z_]+ID(?=(?:[^"\']|"[^"\']*")*$)/';

    Thanks !

    I’ve got a similar problem -> here
    Your modification didn’t solve it. Your patterns makes WordPress displaying a 404 page instead of my content. Strange.

    Found another solution bypassing the parser for my specific code using:

    if(strpos($sql, '/*+NO_PARSE */') === false)
    			$sql = pg4wp_rewrite( $sql);

    in the wpsql_query function (line 131).
    Then I use this comment on each SQL command I make, as I’m coding native PostGreSQL code.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Issue with SimpleField plugin’ is closed to new replies.