In the design of algorithm database, the Order_value is used to sort, and the concrete realization is
* * Note that the following discussion is for a topic, that is, for a tree!
If you add a new sticker that order_value=0
If the order_value is bigger than the parent sticker Order_value
If there is a hypothesis for next_value, then the new post
Order_value for the parent (Order_value+next_value)/2;
If there are so new posts of Order_value for the father of the order_value+1000
In other words, if a is affixed to the post, if A is a copybook, the order_value of A is order_value (parent) +1000,
It's not a order_value, it's a bigger than a, and the new order_value is half the size!
Sort implementation: ORDER BY groupid,order_value Desc
* * Skills if you want to achieve a more level can add a little more than +100000, that should be better
Deficiencies:
1: Use two fields to sort with a bit slower speed
2: Using Order_value is a floating-point number, using float is not estimated, or using double
3: Can only realize the theoretical infinity layer actually more than 10 layers using float problem, use double may not
4: Insert is needed to find the next Order_value
Dim OrderValue, NextValue as Double
sql = "Select Gorders where gid=" & GId & "and goders>" & Gorders & "ORDER by Goders"
Rs1. Open sql, CONN1, adopenforwardonly, adlockoptimistic ' queries larger than the parent
Order_value
If (rs1. EOF and Rs1. BOF) Then
Gorders = gorders + 256
Glayer = Glayer + 1
Else
NextValue = Rs1 ("Gorders")
If (nextvalue-gorders) > 1 Then
Gorders = Int ((gorders + nextvalue)/2)
Glayer = Glayer
Else
' Gorders,glayer like a reply.
End If
End If
End Sub