[rt-users] Followup: trouble with creating a new ticket

Jesse Vincent jesse at bestpractical.com
Fri Nov 9 11:27:14 EST 2001


What rev of DBD::mysql do you have installed? there was a bug in some earlier
versions that caused it to fail sort of badly when asked for insert_id.

Also, I'd love to see your patch presented as a unified diff. It would be much
easier for me to eyeball ;)


	Thanks very much,
	Jesse


On Fri, Nov 09, 2001 at 01:22:35PM +0100, Piet Honkoop wrote:
> 
> 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
> 
> 
> 
> 
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-users
> 

-- 
http://www.bestpractical.com/products/rt  -- Trouble Ticketing. Free.




More information about the rt-users mailing list