[kronolith] Fwd: Re: [cvs] cvs commit: nag prefs.php
Mike Hardy
mhardy@h3c.com
Sat, 26 Jan 2002 21:19:16 -0800 (PST)
On Sat, 26 Jan 2002, Ilya wrote:
> Mike, I didnt have this table , and dont have structure for it.
> I created the table, and run that grant query. now the error i get is:
> object(db_error)(7) { ["error_message_prefix"]=> string(0) "" ["mode"]=>
> int(1) ["level"]=> int(1024) ["code"]=> int(-19) ["message"]=> string(23)
> "DB Error: no such field" ["userinfo"]=> string(104) "UPDATE
> kronolith_events_seq SET id=LAST_INSERT_ID(id+1) [nativecode=Unknown column
> 'id' in 'field list']" ["callback"]=> NULL }
Interesting - that did get somewhere, so I googled around for a bit and
ran into this thread:
http://aspn.activestate.com/ASPN/Mail/Message/pear-dev/930216
which referenced this (section 3.6 being important):
http://vulcanonet.com/soft/?pack=pear_tut
All of that indicates that it should create the sequence for you, and
grepping through the Kronolith source, its generated from this line:
kronolith/lib/Driver/sql.php:207: $id = $this->db->nextId($this->params['table']);
Looking at the mysql PEAR DB abstraction (/usr/share/php/DB/mysql.php for
me) I see these lines are executed if you don't have the sequence table
yet:
function createSequence($seq_name)
{
$sqn = preg_replace('/[^a-z0-9_]/i', '_', $seq_name);
return $this->query("CREATE TABLE ${sqn}_seq ".
'(id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,'.
' PRIMARY KEY(id))');
}
> its seems i need at least two columns - id and userinfo
> do you know what else need to be in that table? even these two are not
> similar to just kronolith_events table.
I think "userinfo" is just an object field in the error object.
>From the above function - it looks like it just creates a single column in
the table, and it tries to create the table automatically.
I think Chuck has it right then, and it looks like your mysql horde user
doesn't have table creation permissions, or the sequence would have been
created correctly on the fly. Try logging in as the horde user and
manually executing the SQL from the function above - if you can't do it
there, it certainly won't happen on the fly, and that's probably the root
of the problem.
I hadn't ever dived into the Pear stuff at all, but I have to admit, I
think the way they solved the ever-present problem of non-portable
sequences is pretty spiffy. I spend most of my time in Java, and I wish
JDBC had it now that I know about it.
-Mike