Skip to content

escapeLike issue on postgre #159

@cdujeu

Description

@cdujeu

Hi David,

First of all, thanks for your great work. As you maybe already know, Dibi is our historical ORM for the Pydio project, and we love it: doing the job efficiently, and very lightweight (we embed the minified version).
I'm not totally sure this is an issue, or maybe a postgre config or version problem, I must admit I'm not a PG expert. We are encountering an issue with LIKE queries containing an underscore, and I happened to fix this by changing the escapeLike function of the PG driver to replace '' by _ instead of \ .
Which gives for the escapeLike function

function escapeLike($value,$pos){
    $value=pg_escape_string($this->connection,$value);
    $value=strtr($value,array('%'=>'\\%','_'=>'\\_'));
    return($pos<=0?"'%":"'").$value.($pos>=0?"%'":"'");
}

Do you know if it's a bug or something wrong on my -db- side?
Using PG 9.3 BTW.

Cheers
Charles

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions