Mailing List Archive



Back to the month index Back to the list index

Web Master (huntsman@www.nisu.flinders.edu.au)
Thu, 24 Apr 1997 11:44:16 +0930 (CST)


Message-Id: <199704240214.LAA17331@www.nisu.flinders.edu.au>
Date: Thu, 24 Apr 1997 11:44:16 +0930 (CST)
From: Web Master <huntsman@www.nisu.flinders.edu.au>
Subject: Re: [mSQL] Fixing foobar'd .dat file

On 23 Apr, Brian T. O'Neill wrote:
> Ok, i have a foobar'd .dat file from a fs getting filled up in msql1.x

You mean fubar - and hopefully not, 'cos that translates to 'f----d up
beyond all [repair][recovery][recognition]'

> i'm writing a perl program to parse the file, only problem i'm having is that
> i don't know how the int's are stored... they show up as 2<9C><BF><F1> or
> such... i figured they are packed or something of that sort, anyone care to
> toss me a hint on how to get the int data out of it? any help would be
> greatly appreciated...
>
> thanks in advance,

Integers are usually stored in binary representation so if you view the
file with a hex type viewer you will surely get hex values. In msql,
integers are stored as 4 byte values so you'll need to convert hex-dec.

On my machine (Linux, Intel) the most significant byte is the LAST of
the four bytes; other machines may vary - so the integer 5 is
represented as

05 00 00 00

Likewise a time value of 859123800 is represented as

58 30 35 33

If you convert 859123800 to hex, you'll find it is 33353058

It appears that msql 1.n uses binary 01 to separate fields in a record,
so you better watch out for that when you are parsing your damaged file.

Good luck...

-- 
David Robley

WEBMASTER | http://www.nisu.flinders.edu.au/ NATIONAL INJURY SURVEILLANCE UNIT | Phone +61 8 8374 0970 ADELAIDE, SOUTH AUSTRALIA | Fax +61 8 8374 0702

-------------------------------------------------------------------------- To remove yourself from the Mini SQL mailing list send a message containing "unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing "info msql-list" to majordomo@bunyip.com for info on monthly archives of the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!