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

Quoted wildcards in associations #12

Closed
signaturefish opened this issue Jan 30, 2011 · 5 comments
Closed

Quoted wildcards in associations #12

signaturefish opened this issue Jan 30, 2011 · 5 comments

Comments

@signaturefish
Copy link

Good afternoon,

I'm building a couple of projects that back on to idiorm/paris at the moment, and I seem to have hit a bug in the code that manages associations between Models. Essentially, when I attempt a "has_many_through()" call that should succeed, PDO throws an exception that indicates that somewhere along the line, something is quoting the SQL query incorrectly.

At some point, the system attempts a "SELECT table.* FROM table JOIN...", which is quoted as "table"."*", which fails because * is not a recognised column in that table. I can reproduce the bug in both MySQL and PostgreSQL (where both libraries otherwise perform very well, incidentally).

Example code can be found at my friend Aquarion's server, here: http://cenote.gkhs.net/~aquarion/idiormtest/ - that's running on MySQL.

We suspect, as the URL indicates, that the bug itself is likely in idiorm, but we're only really seeing its effects through paris. Feel free to move this issue to the idiorm issue-list if you prefer, of course.

@j4mie
Copy link
Owner

j4mie commented Jan 30, 2011

Hi,

Thanks for this report. The test cases are brilliant, and allowed me to track down the bug straight away.

It was a problem with Idiorm, but I'll leave the ticket here as it will require an update to Paris' tests to fix completely.

The problem was that Idiorm wasn't correctly checking for the wildcard ("*") when quoting column names. I've added in a simple check for this, and pushed it to the develop branch.

https://github.com/j4mie/idiorm/tree/develop

Would you might trying this out and ensuring that it fixes your issue before I merge it into the master branch?

Thanks again!

@signaturefish
Copy link
Author

Hello,

That looks like a fix, yes. The code in the develop branch does the Right Thing under PHP/PostgreSQL. I'm waiting for aquarion to test the develop branch under MySQL, but if it works for you I suspect we can call it fixed.

Thanks for the prompt reply

@j4mie
Copy link
Owner

j4mie commented Jan 30, 2011

Thanks. For the record, I've tested this on SQLite too.

@aquarion
Copy link

I've now tested that on MySQL and it's fine too. Thanks

@j4mie
Copy link
Owner

j4mie commented Jan 30, 2011

Just tagged version 1.1.1 of Idiorm (fixing the bug) and Paris (updating incorrect tests).

Thanks again for the report.

Jamie

j4mie added a commit that referenced this issue Nov 7, 2012
* develop:
  Update changelog
  Fix incorrect tests, see issue #12
schmod pushed a commit to schmod/dakota that referenced this issue Jan 23, 2013
This issue was closed.
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

3 participants