CodeIgniter Forums
Upgrading "system/database" folder breaks my application - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Upgrading "system/database" folder breaks my application (/showthread.php?tid=15874)

Pages: 1 2 3


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]KeyStroke[/eluser]
Yea that could be it, since the errors I was getting were "unknown column" errors.


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]Colin Williams[/eluser]
Or even something really whacky like `user`.`city_id`.`=`.`city`.`id`

Might be interesting to debug the query and see what's up.


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]TheFuzzy0ne[/eluser]
Hopefully this is a solution to [url="http://ellislab.com/forums/viewthread/105175/"]this thread[/url], started by [url="http://ellislab.com/forums/member/40351/"]SitesByJoe[/url].


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]Colin Williams[/eluser]
I'm not a SQL genius, but is "user.city_id=city.id" valid SQL? Or does it break some SQL conventions? If not, this should probably marked a bug once more info about it is known.


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]TheFuzzy0ne[/eluser]
It's the only way I know of to perform a natural join between two tables.


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]KeyStroke[/eluser]
he meant when there are no spaces between the column names and the equal sign.


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]Colin Williams[/eluser]
Right, KeyStroke. Thanks for clearing it up. That is what I meant.


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]TheFuzzy0ne[/eluser]
Oh, I see. Well it seems to work for me on MySQL 5.


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]KeyStroke[/eluser]
By the way, I was able to reproduce the error with this query:
Code:
$this->db->select('*')->from('user, city')->where('user.city_id=city.id')->get();

Add spaces around the equal sign, and the problem is solved.

Can anyone else verify this?


Upgrading "system/database" folder breaks my application - El Forum - 02-17-2009

[eluser]KeyStroke[/eluser]
Oh wait, I just noticed the problem in the error (DUH!!):
Quote:A Database Error Occurred

Error Number: 1054

Unknown column 'user.city_id=city.id' in 'where clause'

SELECT * FROM (`user`, `city`) WHERE `user`.`city_id=city`.`id`
Notice how it's not placing quotes properly in the query (or so it seems). Is this something to be reported? or is that how active record queries suppose to work?