WordPress.org

Ready to get started?Download WordPress

Forums

PostgreSQL for WordPress (PG4WP)
[resolved] Issue with SimpleField plugin (5 posts)

  1. gabrielstuff
    Member
    Posted 1 year ago #

    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/

  2. gabrielstuff
    Member
    Posted 1 year ago #

    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.

  3. gabrielstuff
    Member
    Posted 1 year ago #

    Finnaly had to replace with this :

    line 423:

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

    line 433:

    $pattern = '/[0-9a-zA-Z_]+ID(?=(?:[^"\']|"[^"\']*")*$)/';
  4. gabrielstuff
    Member
    Posted 1 year ago #

    Thanks !

  5. vitorio
    Member
    Posted 12 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.