-
Notifications
You must be signed in to change notification settings - Fork 61
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
fix handling of numeric values for SQLite in comparisons #207
Conversation
looks sane. do we have a test for this? would be good, probably in the phpcr-api-tests to ensure proper and consistent working over all implementations. |
we do not have a test yet .. |
hmm the strange thing is that the following test case also works with master:
another aspect which I am not sure on if its part of the spec but Jackrabbit does not match a string value on an integer property. So maybe when using the comparison operators we actually always have to check the type. that being said, maybe we should add an option to make this optional (in the dynamic typeing spirit of PHP) even if we add this. |
but without this patch, the phpcr benchmark fails when I do the following change:
|
did you run the local test with all dbal transports? making it optional is a problem. it destroys portability. and its these little things that will drive people nuts when moving from dbal to jackrabbit implementation. so we should better be strict i guess. we could maybe rewrite all queries to jackrabbit to relax on this - or ask the jackrabbit people if this is intentional. |
no, I only ran the tests locally with SQLite but the changes I have done should only affect SQLite. |
@dbu do you have any other idea here? it seems the bug only effects phpcr_benchmarks but not when I do "the same" in phpcr api tests .. |
return "(xpath('//sv:property[@sv:name=\"" . $property . "\"]/sv:value[1]/text()', CAST($alias.props AS xml), ".$this->sqlXpathPostgreSQLNamespaces()."))[1]::text::int"; | ||
$expression = "(xpath('//sv:property[@sv:name=\"" . $property . "\"]/sv:value[1]/text()', CAST($alias.props AS xml), ".$this->sqlXpathPostgreSQLNamespaces()."))[1]::text::int"; | ||
} elseif ($this->platform instanceof MySqlPlatform) { | ||
$expression = $this->sqlXpathExtractValue($alias, $property); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to have a method here when it only works for mysql? and it looks like the BC way would be to do this for all platforms we did not previously handle, not only msql. (not sure if users could sneak oracle or such in and if that previously worked)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't support Oracle yet .. I am sure we will need to do some explict code for each RDBMS we support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or in other words .. right now I rather have the code explicitly say which code path is for what RDBMS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed.
no idea really why that would be different. maybe different data or different schema. i guess sqlite does not autodiscover types like elasticsearch does, so that it would matter whether the first thing looks numeric? |
@lsmith77 what is the state of this PR? i voiced some concerns about the clarity of messages, but we can move that into an issue and maybe fix later. the tests are green, should we merge this? |
I was unable to create a failing test with the current behavior in phpcr-api-tests .. but in the benchmarks it was failing without this change .. |
bizar. well it certainly is not wrong, just a bit more complex. shall we just merge? |
should we merge this? is there a regression risk involved? |
no .. I do not see any regression with my tests at least. but its irritating to not be able to reproduce the issue in a phpcr api test. |
yeah that is strange. but do we merge or do you want to keep it open? |
for now imho lets just keep it open until someone can figure this out .. i mean the issue is that the issue I am noticing in the phpcr benchmarks .. doesnt seem to exist inside the phpcr api .. so in effect this PR is fixing a non existent issue ..? |
how does this relate to #226 ? both are about numbers in queries... /cc @dantleech |
do we merge or close or keep this around? if we decide to not do anything, we should at least remove this from the milestone, and also close #206 to have only one issue around for this. |
lets kill it .. |
fixes #206