afuna (
afuna) wrote in
dw_dev_training2009-10-25 12:02 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[site community profile]](https://www.dreamwidth.org/img/comm_staff.png)
Entry tags:
jtalkid vs dtalkid vs jitemid vs ditemid
One of the minor things that has always confused me, and I always forget to ask about, is the difference between the very similarly named "ditemid" and "jitemid" (ditto for "dtalkid" and "jtalkid"). Whenever I need to use these, I have to look for code similar to what I am working on, or look up the function definitions in cgi-bin/LJ/Comment.pm and cgi-bin/LJ/Entry.pm.
I was looking through code and stumbled across a comment that cleared things right up:
So! Noting here what I have gleaned:
itemid = entry
talkid = comment
j* = journal
== the per-journal internal id for the entry/comment. This is the value stored in the database. The "j" is to distinguish it from old-style itemids. In a much earlier iteration, LJ entry ids were shared among all users -- DW doesn't have any old-style itemids, and I suspect much of the earlier support is gone.
d* = display
== the display id. This is the value that you see in URLs, etc. It is combined with a random number, to make sure that bots cannot just iterate over all entries by adding +1 to the previous entry id.
If you want to get into specifics, ditemid = jitemid*256+anum.
I was looking through code and stumbled across a comment that cleared things right up:
# - ditemid -- display itemid (with anum)
So! Noting here what I have gleaned:
itemid = entry
talkid = comment
j* = journal
== the per-journal internal id for the entry/comment. This is the value stored in the database. The "j" is to distinguish it from old-style itemids. In a much earlier iteration, LJ entry ids were shared among all users -- DW doesn't have any old-style itemids, and I suspect much of the earlier support is gone.
d* = display
== the display id. This is the value that you see in URLs, etc. It is combined with a random number, to make sure that bots cannot just iterate over all entries by adding +1 to the previous entry id.
If you want to get into specifics, ditemid = jitemid*256+anum.
no subject