[firebird-support] Is it save to append some data at end of the binary firebird database file?
Hello, My main intend is to add some version information to a firebird database file, since I will use firebird as embedded database and installers/update mechanism will need this information. The information should be available platform independent and I would prefer a solution not needing any database access. I figured out it is possible to simply append manually some ascii data at the end of the db file (see picture attached). This would be my preferred solution. It seems to work (I can still read and write to the database and even manipulate the database structure). But maybe this is only luck? So my question is: · Is it save to do this? · Do you suggest another method instead of my? * * Of course it is reasonable to store the version information inside the database in a special table, I think. But a kind of release-script could read this information, append it to the binary db file and any installer/updater does not need to search inside the database. Thank you in advance. Semjon Mössinger [Non-text portions of this message have been removed]
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
On Tue, Dec 1, 2015 at 7:42 AM, 'Moessinger, Semjon' s.moessin...@pi.ws [firebird-support] wrote: > > > > My main intend is to add some version information to a firebird database > file, since I will use firebird as embedded database and installers/update > mechanism will need this information. > Not a great idea. Unusual, imaginative, but probably catastrophic. When Firebird needs to add more data, it will append some number of blocks to the end of the file. I don't remember the algorithm exactly, but the space will be some number of disk blocks that work out to full pages. On a good day, your information will be overwritten. On a bad day, the allocation will fail or become misaligned and make the database unusable. > > > The information should be available platform independent and I would > prefer a solution not needing any database access. > Maybe distribute a separate file? Good luck, Ann > >
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
RE: [firebird-support] Is it save to append some data at end of the binary firebird database file?
The same could be accomplished by creating a “Application_SchemaVersion” SP which would return the necessary details. The advantage would be that no search thru the domain would be required. Sean From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] Sent: December 3, 2015 2:06 AM To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] Is it save to append some data at end of the binary firebird database file? Hi Semjon I had a similar need so what I do is I create a Domain CREATE DOMAIN "FDBVersion_1.80.1451" AS SMALLINT; Then I delete this and create a new one every time there is a new version. I use the partial string "FDBVersion_" to look for an existing Domain. Hope this helps Kind regards Bhavbhuti On 01/12/2015 06:12 pm, 'Moessinger, Semjon' s.moessin...@pi.ws<mailto:s.moessin...@pi.ws> [firebird-support] wrote: Hello, My main intend is to add some version information to a firebird database file, since I will use firebird as embedded database and installers/update mechanism will need this information. The information should be available platform independent and I would prefer a solution not needing any database access. I figured out it is possible to simply append manually some ascii data at the end of the db file (see picture attached). This would be my preferred solution. It seems to work (I can still read and write to the database and even manipulate the database structure). But maybe this is only luck? So my question is: · Is it save to do this? · Do you suggest another method instead of my? * * Of course it is reasonable to store the version information inside the database in a special table, I think. But a kind of release-script could read this information, append it to the binary db file and any installer/updater does not need to search inside the database. Thank you in advance. Semjon Mössinger [Non-text portions of this message have been removed] -- Thanking you. Yours Faithfully, For Venus Software Operations Mr. Bhavbhuti Nathwani ___ Softwares for Indian Businesses at: http://www.venussoftop.com venussof...@gmail.com<mailto:venussof...@gmail.com> venussof...@mail.ru<mailto:venussof...@mail.ru> ___ Please note: We reserve complete rights for policy changes in the future and the same will be applicable immediately as and when made. Attachments may get corrupted before reaching you, in such a situation please let us know and we will resend you the same at the earliest. We do not take any responsibility for data loss of any type and kind. Data safety remains the sole the responsibility of the users of our softwares. ___ Internet email confidentiality: This message may contain information that may be privileged or confidential. If you are not the addressee nor are you responsible for the delivery of the message to the addressee indicated in this email, then you may not copy or deliver this email to anyone and you should notify the sender by reply email and then destroy this message. Please reply email immediately to this message with REMOVE in the subject, if you or your employer do not consent to email of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of my firm shall be understood as neither given nor endorsed by my company.
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
On 03/12/2015 14:48, Christian Gütter n...@guetter.org [firebird-support] wrote: Or, if you are a big fan of abusing file formats, you might want to try to append the information to your executable file. In Windows this is /not /an abuse, executable files have provision for version metadata ("resource") and you're /supposed/ to use it properly. Pity this doesn't apply portably to all file types, innit. -- Tim Ward
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
Hi, > I figured out it is possible to simply append manually some ascii > data at the end of the db file (see picture attached). This would be > my preferred solution. It seems to work (I can still read and write > to the database and even manipulate the database structure). But > maybe this is only luck? This will only work until Firebird needs to extend the database file and then all kinds of bad things might happen. I would rather store this information in a separate configuration file. Or, if you are a big fan of abusing file formats, you might want to try to append the information to your executable file. The last time I tried this (years ago on Windows), it worked without problems. Cheers, Christian
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
On Windows, all files can have alternative streams with additional data. It is a form of hidden metadata that is attached to the main filename. Mark - Reply message - Van: "Tim Ward t...@telensa.com [firebird-support]" Aan: Onderwerp: [firebird-support] Is it save to append some data at end of the binary firebird database file? Datum: do, dec. 3, 2015 15:52 On 03/12/2015 14:48, Christian Gütter n...@guetter.org [firebird-support] wrote: Or, if you are a big fan of abusing file formats, you might want to try to append the information to your executable file. In Windows this is not an abuse, executable files have provision for version metadata ("resource") and you're supposed to use it properly. Pity this doesn't apply portably to all file types, innit. -- Tim Ward
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
Tim Ward wrote: > In Windows this is not an abuse, executable files have > provision for version metadata ("resource") and you're supposed > to use it properly. Pity this doesn't apply portably to all file types, > innit. True, but if you just append the info to the exe file, it is an abuse ;-) And there are no restrictions with regard to the information you want to store. Cheers, Christian
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
Mark Rotteveel wrote: > On Windows, all files can have alternative streams with additional > data. It is a form of hidden metadata that is attached to the main filename. True, but the alternate data streams get lost when the file is stored on a non-NTFS drive, sent via FTP/E-Mail etc. So depending on how the software of the OP is released, this might not work well. Anyway, rereading the original post, I realized that he is looking for a platform independent solution, so my focus on Windows did not help anyway. Cheers, Christian
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
On 04/12/2015 00:07, Christian Gütter n...@guetter.org [firebird-support] wrote: > In Windows this is not an abuse, executable files have > provision for version metadata ("resource") and you're supposed > to use it properly. Pity this doesn't apply portably to all file types, innit. True, but if you just append the info to the exe file, it is an abuse ;-) And there are no restrictions with regard to the information you want to store. There are no restrictions doing it properly with resources - you don't have to just use the VERSIONINFO resource (although you should, as vast numbers of other tools understand it), you can add whatever custom resources you like. -- Tim Ward
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
What you can do is inspect Firebird structure and search for an unused area. Documentation about this can be found at http://www.firebirdsql.org/manual/fb-internals.html By example if you check http://www.firebirdsql.org/manual/fbint-standard-header.html Pag_checksum: Two bytes, unsigned. Bytes 0x02 - 0x03. Checksum for the whole page. No longer used, always 12345, 0x3039. Databases using ODS8 on Windows NT do have a valid checksum here. You can use this safely (?) Em 03/12/2015 22:19, Christian Gütter n...@guetter.org [firebird-support] escreveu: Mark Rotteveel wrote: > On Windows, all files can have alternative streams with additional > data. It is a form of hidden metadata that is attached to the main filename. True, but the alternate data streams get lost when the file is stored on a non-NTFS drive, sent via FTP/E-Mail etc. So depending on how the software of the OP is released, this might not work well. Anyway, rereading the original post, I realized that he is looking for a platform independent solution, so my focus on Windows did not help anyway. Cheers, Christian --
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
That is very dangerous to do, the same bytes might be reused differently in a newer ODS. Either use a normal Firebird table to store version info, or do it outside of the database. Do not hack things in the internal structure. Mark - Reply message - Van: "Fabiano Kureck fabi...@sci10.com.br [firebird-support]" Aan: Onderwerp: [firebird-support] Is it save to append some data at end of the binary firebird database file? Datum: vr, dec. 4, 2015 11:08 What you can do is inspect Firebird structure and search for an unused area. Documentation about this can be found at http://www.firebirdsql.org/manual/fb-internals.html By example if you check http://www.firebirdsql.org/manual/fbint-standard-header.html Pag_checksum: Two bytes, unsigned. Bytes 0x02 - 0x03. Checksum for the whole page. No longer used, always 12345, 0x3039. Databases using ODS8 on Windows NT do have a valid checksum here. You can use this safely (?) Em 03/12/2015 22:19, Christian Gütter n...@guetter.org [firebird-support] escreveu: Mark Rotteveel wrote: > On Windows, all files can have alternative streams with additional > data. It is a form of hidden metadata that is attached to the main filename. True, but the alternate data streams get lost when the file is stored on a non-NTFS drive, sent via FTP/E-Mail etc. So depending on how the software of the OP is released, this might not work well. Anyway, rereading the original post, I realized that he is looking for a platform independent solution, so my focus on Windows did not help anyway. Cheers, Christian --
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
Fabiano Kureck suggested sticking application version information in the checksum slot of the page header. Mark Rotteveel quite correctly responded. > > > That is very dangerous to do, the same bytes might be reused differently > in a newer ODS. Either use a normal Firebird table to store version info, > or do it outside of the database. Do not hack things in the internal > structure. > The page header is not a good place to stick information. It does change to support new features. However, the database header page has a place that you might be able to use. The format of the header page is defined in ods.h. The first part is fixed. The second part is a string of "clumplets" which are groups of attribute-length-data triplets. By design, Firebird skips over clumplets it doesn't understand. You could write a program that adds a new clumplet of a type undefined by Firebird to hold your version information. It wouldn't survive a gbak backup/restore cycle. The discussion was about finding portable mechanism to identify the application version of a database. Are you aware that databases are not portable across machines with different endian characteristics? Good luck, Ann > > > > -- >
Re: [firebird-support] Is it save to append some data at end of the binary firebird database file?
Hi, i am really surprised – why reinvent the wheel? All people use table with version information and this work years. Table have benefit – you can include version description (what’s new). At application start or installer – you check if db is up to date or if instaler is not older than database itself. If db is older then do backup and restore and try to patch it with new script. If all are succesfull then update version info. If not, then mark it as broken. regards, Karol Bieniaszewski From: mailto:firebird-support@yahoogroups.com Sent: Friday, December 04, 2015 6:07 PM To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] Is it save to append some data at end of the binary firebird database file? Fabiano Kureck suggested sticking application version information in the checksum slot of the page header. Mark Rotteveel quite correctly responded. That is very dangerous to do, the same bytes might be reused differently in a newer ODS. Either use a normal Firebird table to store version info, or do it outside of the database. Do not hack things in the internal structure. The page header is not a good place to stick information. It does change to support new features. However, the database header page has a place that you might be able to use. The format of the header page is defined in ods.h. The first part is fixed. The second part is a string of "clumplets" which are groups of attribute-length-data triplets. By design, Firebird skips over clumplets it doesn't understand. You could write a program that adds a new clumplet of a type undefined by Firebird to hold your version information. It wouldn't survive a gbak backup/restore cycle. The discussion was about finding portable mechanism to identify the application version of a database. Are you aware that databases are not portable across machines with different endian characteristics? Good luck, Ann --