Db prefix + dots in the query problem |
[eluser]GIN[/eluser]
Hi. I'm not sure is that bug or not, but here is another similar problem http://ellislab.com/forums/viewthread/77767/ Anyway, my problem is: I have a db prefix - sg_ I have this active record code: Code: $this->db->select('g.id, g.name, g.eng_name, g.price, g.code, Code: SELECT g.id, g.name, g.eng_name, g.price, g.opt_price, g.code, Look at this section IF(CHAR_LENGTH(g.name)>40, CONCAT(LEFT(g.name, 40), "..sg_."), g.name) as short_name If I have two or more dots - db_prefix appears in short_name (sg_) If I have one dot there - I got syntax error in sql query: IF(CHAR_LENGTH(g.name)>40, CONCAT(LEFT(g.name, 40), sg_"."), g.name) as short_name Other symbols besides dots not makes problem. I think problem in _protect_identifiers method in CI_DB_driver class, but can't understand what happens. What do you think?
[eluser]theprodigy[/eluser]
Instead of: Quote:$this->db->select('g.id, g.name, g.eng_name, g.price, g.code, try Code: $this->db->select('g.id, g.name, g.eng_name, g.price, g.code, EDIT: Change "..." into "& hellip;"(minus the space between & and hellip)
[eluser]GIN[/eluser]
Yes, I understand, but is that normal that I can't use one, two or more dots in sql query?
[eluser]theprodigy[/eluser]
starting on line 1256 of the CI_DB_driver class (in the _protect_identifiers function) Quote:// Break the string apart if it contains periods, then insert the table prefixThen on line 1261: Code: $parts = explode('.', $item);
|
Welcome Guest, Not a member yet? Register Sign In |