loadobjectList fails if column doesn't exist - Joomla! Forum - community, help and support


i have component has been functioning since j1.5.
am trying upgrade 3.0
i have process trying add or drop column table.
just checking table existence of column first.
this has worked fine in j 3.0 when tries execute select query gives me 500 exception.
here current code, have commented out older setquery statement , added jdatabasedriver method both give me same exception.

code: select all

        //drop column profile fields
//$this->_db->setquery("select $this->name #__classifiedsredux_profile 1");
$query = $this->_db->getquery(true);
$query->select($this->name)
 ->from('#__classifiedsredux_profile')
 ->where( 1 );
$this->_db->setquery($query);
            $this->_db->loadobjectlist();
            if (!$this->_db->geterrornum()) {
               $this->_db->setquery("alter table #__classifiedsredux_profile drop `$this->name`");
               $result = $this->_db->execute();
            }

hi,

why don't use method gettablecolumns instead of select can fail ?
http://api.joomla.org/joomla-platform/d ... blecolumns
then check if column exist





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support