Skip to content

[BUG] PHQL statement with CAST AND CONVERT (maybe others) functions are badly converted into SQL #2229

Closed
@jimjim2a

Description

@jimjim2a

Hello,

Since 1.3.0 this PHQL query that used to work properly, doesn't now :

<?php
$di = new \Phalcon\DI\FactoryDefault();

class X extends \Phalcon\DI\Injectable
{
    public function x()
    {
        $manager = $this->getDI()->getModelsManager();
        $manager->executeQuery("SELECT id FROM Article WHERE CAST(mycolumn AS date)='2014-02-01'");
    }
}

$x = new X;
$x->setDI($di);
$x->x();

This produces this PDO query :

SELECT "article"."id" FROM "public"."article" WHERE CAST("article"."mycolumn" AS ) = '2014-02-01'

I tested with another SQL function as CONVERT and it produces exactly the same issue.

I don't know if it is important or not, but my RDBMS is PostgreSql.

I have opened a discussion about this issue in the forum by the way ( http://forum.phalconphp.com/discussion/1863/phql-wrong-conversion-of-cast-and-convert-method-maybe-more- )

Thanks a lot !

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions