[jonah] I want to fix DB Error: constraint violation error.

Zachary Denison zacharydenison at yahoo.com
Wed Feb 16 13:19:13 PST 2005


Hello,

I just checked out jonah from the cvs today (I have
the latest horde etc... from cvs) and am trying to
debug a problem in jonah where you try to add a new
rss feed and you get a constraint violation.  this
problem seems to affect only adding new rss feeds.  I
seem to have found the cause of the problem but I am
not sure where to begin the fixing of it.  If you
could give me a small pointer where to start, I can
fix it.  Also what is the proper way to submit a
change like this to you so that you can commit it so
that everyone benefits from it, I am assuming that
posting a diff to the entire list is not the best
way.. 

I seem to have localized the problem to:

~jonah/lib/News/sql.php

        if (empty($info['channel_id'])) {

----> here the value is 0, this is correct.

            $info['channel_id'] =
$this->_db->nextId('jonah_channels');

----> here the value is set to that of one which
already exists in the table, instead of returning
1+(the last channel_id) -- here is where I need some
help, how is nextId determining the next id, because
mysql_insert_id should not work here... since we
havent inserted anything.  If you can point me in the
right direction, I would love to fix this bug.

            if (is_a($info['channel_id'],
'PEAR_Error')) {
                Horde::logMessage($info['channel_id'],
__FILE__, __LINE__, PEAR_LOG_ERR);
                return $info['channel_id'];





		
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 


More information about the jonah mailing list