Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 18th, 2004, 06:55 AM
egidy egidy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 166 egidy User rank is Private First Class (20 - 50 Reputation Level)egidy User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 15 h 49 m 31 sec
Reputation Power: 5
How data are stored in FireBird's datapage?

It is known that actual data are stored in form of data records (structure "rhd") (or data record fragments, structure "rhdf") starting from bottom of FireBirds datapage (page of type 5), actually - they are stored in array:
"RHD->rhd_data" (or "RHDF->rhdf_data").

Well the question is - how those data can be retrieved in textual form? There can be at least two issues:

1) What about compression - what it means in this case, What algorithm/functions ("SQZ_decompress" from "sqz.cpp") can I use for decompression (maybe nice sample can be found in "dmp.cpp"); (well - it seems to me that this compression is something very different from e. g. password encryption in Firebird)

2) what about record format - maybe the ..._data corresponds to some format version, some relevant description in field "RDB$FORMATS.RDB$DESCRIPTOR" (for specified relatioon and format version). Is this descriptior necessary for converting "..._data" data array in textual form (as for use in SQL scripts)? How such a transformation can be done.

Generally - is there any tool for extracting textual data directly from "*.fdb" file?

Thanks for any idea in adavnce!


Reply With Quote
  #2  
Old October 18th, 2004, 07:45 AM
hugo2 hugo2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 20 hugo2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 47 m 14 sec
Reputation Power: 0
1) yes, compression and encryption are two different things
2) yes, rdb$descriptor is necessary
x) what do you mean by "extracting textual data" ? Is IBSurgeon the tool you want ?
?) what are you trying to achieve at all ??

Reply With Quote
  #3  
Old October 18th, 2004, 08:11 AM
egidy egidy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 166 egidy User rank is Private First Class (20 - 50 Reputation Level)egidy User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 15 h 49 m 31 sec
Reputation Power: 5
thanks, indeed - IBSurgeon seems to be the tool that I need, I'll try it, however - I'm afraid - can it work against corrupted database file?

Well - actually I need this information for handling corrupted database file.

About "textual data" - I meant the data in form as SQL query result, something similar, by this. Actually - data in rhd_data isn't in such a form (field by field for specified row=record)

Reply With Quote
  #4  
Old October 18th, 2004, 03:30 PM
hugo2 hugo2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 20 hugo2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 47 m 14 sec
Reputation Power: 0
There are many kinds of corruption. IBSurgeon can ignore many of them (because it reads database page by page, and is not concerned about integrity). But IBSurgeon also does not interpret contents of rows, you would have to do a lot of additional work to correctly assign data to columns etc.

Do you want to recover data from already corrupted database, or do you want to be prepared for such accident ? Much much much easier and cheaper would be to prevent corruptions and make regular backups ...

Reply With Quote
  #5  
Old October 19th, 2004, 03:24 AM
egidy egidy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 166 egidy User rank is Private First Class (20 - 50 Reputation Level)egidy User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 15 h 49 m 31 sec
Reputation Power: 5
Yes, I see that IBSurgeon decompress data only, but does the interpretation is so hard? Where can be found such an example (at least in Firebird code - maybe somwhere near the SQL statement preparation, compilation, execution) I think, that one should decompress data into array of bytes and follow the field definitions stored in RDB$DESCRIPTOR in order to make the right transformation betwwen necessary amount of bytes into some human-readable value.

Actually - in could be great to create some insert script directly from database file.

Well - actually I have some scripts for metadata change - all they can be executed whithout any error, however - after some small time after upgrade the signatures of corruption appears and normal read of data appears to be impossible.

Where the mistake can be?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > How data are stored in FireBird's datapage?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT