afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] dw_dev_training2009-10-25 12:02 pm
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:
# - 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.
yvi: Kaylee half-smiling, looking very pretty (Default)

[personal profile] yvi 2009-10-26 01:36 pm (UTC)(link)
Also, there's 'nodeid', at least in the database.