Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has() filter escapes SQL syntax #101

Closed
exodus4d opened this issue Apr 12, 2020 · 1 comment
Closed

has() filter escapes SQL syntax #101

exodus4d opened this issue Apr 12, 2020 · 1 comment

Comments

@exodus4d
Copy link

Hi Christian :)
After update 0d7754a [29 Oct 2019] -> v1.6.0, I get a SQL Syntax error.
Looks like Cortex escapes SQL reserved words like select, from, where, ...
I´m pretty sure, we have talked about it a while ago, and you fixed it (0d7754a works fine).

SELECT `id`, 
    `name`
FROM  
     `structure` 
WHERE  
    `systemid` = ? AND   
     `active` = ? AND (
        EXISTS(
            `select` `id` `from` `corporation_structure` `where` ( ( `corporationid` = ? ) ) AND    ( 
                     `corporation_structure`.`structureid`=`structure`.`id`
             )))

Model

$structure = $this->rel('structures');
$structure->has('structureCorporations', [
    0 => '( corporationId = :corporationId )',
     ':corporationId' => 12345
]);
$structures = $structure->find([
    0 => 'systemId = :systemId and active = :active',
    ':systemId' =>12, 
    ':active' => true
 ])
@exodus4d
Copy link
Author

Issue should be fixed in the current master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant