Archive for March 27th, 2009
Sorting lists: adding items
Comments enabled. I *really* need your comment
This is article 3 of 6 on linked lists in MySQL:
- Sorting lists
- Sorting lists: moving items
- Sorting lists: adding items
- Sorting lists: deleting items
- Sorting lists: moving blocks
- Sorting lists: deleting blocks
In this article I'll cover inserting items into the linked list.
This is quite a simple task, but has some issues we will need to handle.
When we insert a new item A
after an existing item B
in the linked list, we need to do the following:
- Insert the new item and set its
parent
toB
- Update the
B
's child'sparent
toA
This seems OK, but what if we want the id
of A
to be autogenerated?
Read the rest of this entry »