Subject | Re: [firebird-support] C-ISAM files to firebird DB |
---|---|
Author | Wolfgang Rohdewald |
Post date | 2008-07-05T13:13:38Z |
On Samstag, 5. Juli 2008, Maurizio wrote:
it into a new file, basically something like
char record[2048];
int fdin=isopen(infilename,ISINPUT+ISEXCLLOCK);
int fdout=isopen/isbuild...
while (!isread(fdin,record,ISNEXT))
iswrite(fdout,record);
isclose(fdin);
isclose(fdout);
(add error handling as needed)
and how they are encoded.
look at the hexdump of the .dat file. Define fields like
create table isam external file 'isam.dat' (
field1 char(6);
field3 char;
recordseparator char; -- this is a LF (hex 0A)
);
such that the field sizes match. Then you can write SQL code
or UDF code as necessary for converting the single fields.
Or you could add such conversion code to the C program mentioned
above. The easiest way might be to convert everything into strings.
--
Wolfgang
> i ask you what do you mean for " rebuild the C-ISAM file " ,write a little C program that reads every record and writes
it into a new file, basically something like
char record[2048];
int fdin=isopen(infilename,ISINPUT+ISEXCLLOCK);
int fdout=isopen/isbuild...
while (!isread(fdin,record,ISNEXT))
iswrite(fdout,record);
isclose(fdin);
isclose(fdout);
(add error handling as needed)
> and i think that what you suggested works only if i can have the fieldthen you will have to guess where fields start and end
> types
> of the record , but unfortunately i don't have it .
and how they are encoded.
look at the hexdump of the .dat file. Define fields like
create table isam external file 'isam.dat' (
field1 char(6);
field3 char;
recordseparator char; -- this is a LF (hex 0A)
);
such that the field sizes match. Then you can write SQL code
or UDF code as necessary for converting the single fields.
Or you could add such conversion code to the C program mentioned
above. The easiest way might be to convert everything into strings.
--
Wolfgang