[rt-users] Followup: trouble with creating a new ticket
Piet Honkoop
piet at wirehub.net
Fri Nov 9 07:22:35 EST 2001
As reported earlier, I had problems with setting up rt 2.0.8_02
Relevant software:
FreeBSD 4.4-stable
Mysql: 3.23.43
RT: 2.0.8_02
DBIx::SearchBuilder 0.47
mod_perl 1.26
What I found out in the end was that for some reason the id field was not
treated correctly. Below is an excerpt from the mysql log where it tries
to insert a ticket. The ticket gets created all right but the
last_insert_id from mysql is never picked up.
Coming from the mysql log:
34 Query INSERT INTO Tickets (Starts, Type,
Priority, Status, Queue, Owner, InitialPriority, FinalPriority, Subject,
Creator, LastUpdatedBy, Created, TimeLeft, TimeWorked, LastUpdated, Due)
VALUES ('2001-11-09 09:41:53', 'ticket', '0', 'new', '1', '2', '0', '0',
'g1', '3', '3', '2001-11-09 09:41:53', '', '', '2001-11-09 09:41:53',
'2001-11-09 09:41:53')
34 Query SELECT * FROM Tickets WHERE id =
'4294967330'
34 Query UPDATE Tickets SET
EffectiveId='4294967330' WHERE id=NULL
After an extensive search (I can find my way around in perl code, but
that's about it...), I found:
DBIx/SearchBuilder/Handle/mysql.pm
The following changes made:
47c47,48
< return (undef);
---
> warn "Error with Insert: ". $self->dbh->errstr;
> #return (undef);
51c52
< $self->{'id'}=$self->dbh->{'mysql_insertid'};
---
> #$self->{'id'}=$self->dbh->{'mysql_insertid'};
54c55
< unless ($self->{'id'}) {
---
> # unless ($self->{'id'}) {
56,57c57,58
< }
< warn "$self no row id returned on row creation" unless
($self->{'id'});
---
> #}
> warn "$self no row id returned on row creation" unless
($self->{'id'}) ;
(admitted, this is the crude way). suppress the warning/return undef and
force the darn thing to get the last_insert_id() after an insert...
But once that was in place, I got the following result:
50 Query INSERT INTO Tickets (Starts, Type, Priority,
Status,
Queue, Owner, FinalPriority, InitialPriority, Subject, Creator,
LastUpdatedBy,
Created, TimeLeft, TimeWorked, LastUpdated, Due) VALUES ('2001-11-09
09:59:59',
'ticket', '0', 'new', '1', '2', '0', '0', 'blabla', '3', '3', '2001-11-09
09:59:
59', '', '', '2001-11-09 09:59:59', '2001-11-09 09:59:59')
50 Query SELECT LAST_INSERT_ID()
50 Query SELECT * FROM Tickets WHERE id = '2'
50 Query UPDATE Tickets SET EffectiveId='2' WHERE
id='2'
Now everything is working, but of course the origin of trouble lies
elsewhere (otherwise nothing would have worked once it uses
DBIx::SearchBuilder).
Where should I start looking where to find the true origin of this
problem?
P.
--
=========================================================================
Wirehub! Internet BV tel. +31 10 2448344
Westzeedijk 487 fax. +31 10 2448300
3024 EL Rotterdam http://www.wirehub.net
More information about the rt-users
mailing list