So far I did not find any tool which could help me to analyze content of some table’s data file. And sometimes it is really useful even necessary to see what was in deleted records.
Therefore I tried to decode data file using program in python. Simple version is already working.
It can find records on data page and show them as decimal, hex and string. Sometimes it is enough.
But I am still working on it. Program is written very stupidly because in hurry…
filename="27565" ##your data file pagelimit=8192 endofitem=pagelimit f=open(filename, "rb") try: while 1==1: page=f.read(pagelimit) header=page[0:23] counter=23 print "header:" i=1 decimal="" heximal="" for h in header: decimal=decimal+str(ord(h))+" " heximal=heximal+hex(ord(h))+" " i=i+1 if (i==9): print decimal print heximal i=1 decimal="" heximal="" print "" print "items:" itemcount=0 while 1==1: counter=counter+1 counternext=counter+3 ##print str(counter)+":"+str(counternext) item=page[counter:counternext] ##print item firstbyte=ord(item[0]) secondbyte=ord(item[1]) rowaddress=firstbyte + ((secondbyte & 0b11111)<<8) if rowaddress==0: break print str(rowaddress)+" "+hex(rowaddress) counter=counternext dataitem=page[rowaddress:endofitem] decimal="" heximal="" stringimal="" i=0 insertxid=0 insertxidstr="" deletexid=0 deletexidstr="" commandid=0 commandidstr="" transid=0 transidstr="" tid1=0 tid2=0 tid3=0 for h in dataitem: stringimal=stringimal+h decimal=decimal+str(ord(h))+" " heximal=heximal+hex(ord(h))+" " if (i>=0) and (i<=3): insertxidstr=hex(ord(h))+" "+insertxidstr insertxid=insertxid+(ord(h)<<(8*i)) elif (i>=4) and (i<=7): deletexidstr=hex(ord(h))+" "+deletexidstr deletexid=deletexid+(ord(h)<<(8*(i-4))) elif (i>=8) and (i<=11): commandidstr=hex(ord(h))+" "+commandidstr commandid=commandid+(ord(h)<<(8*(i-8))) elif (i>=12) and (i<=15): transidstr=hex(ord(h))+" "+transidstr transid=transid+(ord(h)<<(8*(i-12))) elif (i>=16) and (i<=17): ##transidstr=hex(ord(h))+" "+transidstr tid1=tid1+(ord(h)<<(8*(i-16))) elif (i>=18) and (i<=19): ##transidstr=hex(ord(h))+" "+transidstr tid2=tid2+(ord(h)<<(8*(i-18))) elif (i>=20) and (i<=21): ##transidstr=hex(ord(h))+" "+transidstr tid3=tid3+(ord(h)<<(8*(i-20))) i=i+1 print "insert XID:"+str(insertxid)+" ("+insertxidstr+")" print "delete XID:"+str(deletexid)+" ("+deletexidstr+")" print "command ID:"+str(commandid)+" ("+commandidstr+")" print "transaction ID:"+str(transid)+" ("+transidstr+")" print "TID:"+str(tid1)+" "+str(tid2)+" "+str(tid3) print stringimal print decimal print heximal print " " endofitem=rowaddress itemcount=itemcount+1 if (itemcount>5): <span class="hiddenGrammarError" pre="">break break</span> ##break after first page for testing finally: f.close()
Note: this stupid “SPAN” tags by “break” commands are being added by WordPress again and again – please remove it if you want to try this program.