On Thu, May 17, 2007 at 08:19:25PM -0600, Brian Edginton wrote:
> Where does this value come from? I can't see any real correlation between it
> and any of the other information that gets dumped.
You'll notice that each database-oriented class in record.h has a field
called RecType, a uint8_t.
This comes from the rectype fields found in the various protocol structures
in protostructs.h. It appears to be a record type number, but I'm not
entirely sure. See the comments in protostructs.h beside the rectype fields.
What I do know is that writing a record with the wrong rectype may fail,
and it shows up most prominently in the GUI backup. You can do a
"tar tzvf filename" on one of the backup files stored under
~/.barry/backup and you'll see each file is a record with the name
being the record ID and the record type.
The parsing of the RecType is not done in record.cc, as it is not part
of the record data itself, but the encapsulating protocol. Look
in packet.cc for DBPacket::Parse() for how this is handled for
database records.
Hope that helps... any questions, please ask. :-)
Oh, and to answer your original question, each record.h class will have
a "default" rectype... this is hard coded currently, in a static
class function. The purpose of this is to allow a programmer to create
a record class from scratch. When doing backups, you know what the
record's rectype is, and can save it and write it back, but when creating
a brand new calendar record, for example, the application should not
need to know what to use, so the library "knows" what is commonly used.
The app can then do:
Calendar cal;
cal.SetIds(Calendar::GetDefaultRecType(), newRecordID);
To setup the record properly.
And now that you mention it, I see Calendar has a bug... it's not
initializing its RecType properly. Good thing you asked! :-)
- Chris
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Barry-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/barry-devel