CodeIgniter Forums
bug on DB_driver Codeigniter 2.0 - 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: bug on DB_driver Codeigniter 2.0 (/showthread.php?tid=39419)



bug on DB_driver Codeigniter 2.0 - El Forum - 03-10-2011

[eluser]Unknown[/eluser]
dear all,

i think there is a bug on DB_driver.php on function list_fields, on line 825
Code:
if (FALSE === ($sql = $this->_list_columns($table)))
        {...}

imho, we cannot pass $table as is, because _list_columns function is like this :
Code:
function _list_columns($table = '')
{
  return "SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = '".$table."'";    
}
It will return nothing if we set dbprefix on database.php and we put table name without the prefix when calling list_fields function, so i'll change it to
Code:
if (FALSE === ($sql = $this->_list_columns($this->_protect_identifiers($table, TRUE, NULL, FALSE))))

Hope this helps guys