Generating an ODB file via PHP

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Ne0DeiS
Posts: 2
Joined: Mon Jan 14, 2008 4:43 pm

Generating an ODB file via PHP

Post by Ne0DeiS »

Hello there.

I'm trying to write an ODB generator in PHP. My main problem is in finding how the data file (which is stored in the database folder) is structured.
As far as i can see the file looks like
[FILE HEADER]
[ROWSET_STARTING_CHAR][ROWSET_INFO][FIELD_1][FIELD_2].....[FIELD_N]
[ROWSET_STARTING_CHAR][ROWSET_INFO][FIELD_1][FIELD_2].....[FIELD_N]
....

I understand how the different datatypes are stored but i have trouble finding what informations are contained in the file header and the rowset infos. If anyone had any idea it would be really helpfull as without those informations, i just can't create anything usable.

Things that seems not possible in the rowset_info
- length of the rowset => in a file with 10+ rows of equal length, the rowset infos were varying
- date of the record => a file in which all data were recorded the same day, rowset infos were varying
- a mixt of the two previous => a file in which all data were recorded the same days, two different lines were having the same infos whereas their fields contained different values

Code: Select all

              Rowset Field values                                                           Rowset infos
01 00 00 00 00 01 ff ff ff ff ff c9 11 80 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48
01 00 00 00 01 01 ff ff ff ff ff c9 15 68 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 20 00 00 00 70 00 00 00 98
01 00 00 00 02 01 ff ff ff ff ff c9 38 90 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48
01 00 00 00 03 01 ff ff ff ff ff c9 3c 78 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 48 00 00 00 e8 00 00 01 38
01 00 00 00 04 01 ff ff ff ff ff c9 fb e0 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e8
01 00 00 00 05 01 ff ff ff ff ff c9 ff c8 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 c0 00 00 01 10 00 00 00 98
01 00 00 00 06 01 ff ff ff ff ff ca 22 f0 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e8
01 00 00 00 07 01 ff ff ff ff ff ca 26 d8 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 98 00 00 01 d8 00 00 02 78
01 00 00 00 08 01 ff ff ff ff ff d2 39 40 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 88
01 00 00 00 09 01 ff ff ff ff ff d2 3d 28 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 01 60 00 00 01 b0 00 00 01 d8
01 00 00 00 0a 01 ff ff ff ff ff d2 60 50 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 88
01 00 00 00 0b 01 ff ff ff ff ff d2 64 38 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 01 88 00 00 02 28 00 00 01 38
01 00 00 00 0c 01 ff ff ff ff ff d3 23 a0 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 28
01 00 00 00 0d 01 ff ff ff ff ff d3 27 88 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 02 00 00 00 02 50 00 00 01 d8
01 00 00 00 0e 01 ff ff ff ff ff d3 4a b0 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 28
01 00 00 00 0f 01 ff ff ff ff ff d3 4e 98 00 00 00 00 00 00 00 00 00	00 00 00 00 00 00 01 38 00 00 03 b8 00 00 04 f8
First column are the field values stored in the files. There are 2 fields per rowset (an integer, and a time). Each field value starts with 01.
Second column is what i previously called rowset infos.
See that some lines seems to work by couple (0-2, 4-6, 8-10 and so on), and that those lines are only the pair ones.
The odd one seems to work differently as you can see that their hexa values are much higher.
Still i have no clue on what i should think about this
Last edited by Ne0DeiS on Mon Jan 14, 2008 5:49 pm, edited 1 time in total.
User avatar
Villeroy
Volunteer
Posts: 31264
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Generating an ODB file via PHP

Post by Villeroy »

The self containing type of database container has nothing to do with open document format (ODF). It includes binary data, generated by this database engine: http://hsqldb.org/ . OOo includes a special version of this engine. It should be possible to use the hsql API to generate tables and wrap them in a Base container without having OOo installed.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ne0DeiS
Posts: 2
Joined: Mon Jan 14, 2008 4:43 pm

Re: Generating an ODB file via PHP

Post by Ne0DeiS »

I can't use anything else but PHP to generate the data file. Servers on which my script will be used will not necesserly have HSQLDB installed. That why i need to understand how it works. I guess i'll have to ask the structure of this file on HSQLDB website :s


edit :
After looking at the coupled lines, i found out that the values is always calculated the same way, by adding +A0 (+160 in decimal). I only have to guess why :s
Post Reply