Foreign key update problem in temp handler

1 view
Skip to first unread message

Alexander Obuhovich

unread,
Feb 11, 2010, 11:12:29 AM2/11/10
to In-Portal Bugs
There is foreign key update problem in temp handler. When you create sub-item record in temp table, then kDBItem::setTempID() method is called and temporary (negative) ID is assigned to that item. This is done to prevent ID conflicts, when record will be copied to live table later. When that subitem has it's own sub item, then temporary ID is populated to it as well. Later, when data is copied to live table all temporary IDs in all related tables are replaced with live IDs.

product (top item) <- product option (sub item) <- product option value (sub-sub-item)

Here sub-sub-item gets incorrect IDs of sub item.

However there is bug during foreign key (related temporary IDs) replacement code, when in case if subitem doesn't have ForeignKey (that's product option combinations in in-commerce), then all other subitems are not processed resulting temporary ID is copied intact in live table.

--
Best Regards,

http://www.in-portal.com
http://www.alex-time.com
foreign_key_update_problem.patch

Dmitry A.

unread,
Feb 11, 2010, 11:41:30 AM2/11/10
to In-Portal Bugs Team
Thank Alex,

Here is task for this bug:

578: Foreign key update problem in temp handler

http://tracker.in-portal.org/view.php?id=578


DA.

On Feb 11, 10:12 am, Alexander Obuhovich <aik.b...@gmail.com> wrote:
> There is foreign key update problem in temp handler. When you create
> sub-item record in temp table, then kDBItem::setTempID() method is called
> and temporary (negative) ID is assigned to that item. This is done to
> prevent ID conflicts, when record will be copied to live table later. When
> that subitem has it's own sub item, then temporary ID is populated to it as
> well. Later, when data is copied to live table all temporary IDs in all
> related tables are replaced with live IDs.
>

> *product (top item) <- product option (sub item) <- product option value
> (sub-sub-item)*


>
> Here sub-sub-item gets incorrect IDs of sub item.
>
> However there is bug during foreign key (related temporary IDs) replacement
> code, when in case if subitem doesn't have ForeignKey (that's product option
> combinations in in-commerce), then all other subitems are not processed
> resulting temporary ID is copied intact in live table.
>
> --
> Best Regards,
>
> http://www.in-portal.comhttp://www.alex-time.com
>

>  foreign_key_update_problem.patch
> < 1KViewDownload

Reply all
Reply to author
Forward
0 new messages