From: Alfred A. <al...@an...> - 2005-10-10 08:02:18
|
The text sizes in different versions of Access are different (8-bit characters vs. 16-bit characters) and MDB reports the *actual*sizes okay. How to interpret them when creating the database description is a different thing. I solved this problem by dividing it by two if Jet version is 4 here is a code snippet: /* * col_size contains column size; * if it comes from JET4 database, divide it by two * otherwise kep it as is, for it might be okay :-? */ if (IS_JET4(mdb)) col_size /= 2; >Date: Sun, 09 Oct 2005 15:22:05 -0600 >To: mdb...@li... >From: "Michael D. Petersen" <ra...@dr...> >Subject: [mdb-dev] mdb-schema field size > >I am using mdb-schema to export an Access 2000 database. All is working >well expect the field sizes of the text fields are all twice as large as >they should be in the mdb-schema output. For example, I have two text >fields, one length 5 and the other 255 as reported by Access. However, the >schema output (mysql backend) is: > >DROP TABLE Table1; >CREATE TABLE Table1 > ( > TextField5 varchar (10), > TextField255 varchar (510) >); > >The content of the test file is (mdb-export): >TextField5,TextField255 >"abcde","LotsOfData" > >Is this a bug? A character set issue? Is there a work-around already >designed into mdbtools? The problem is that MySQL doesn't like the varchar >fields being larger than 255 (it wants a BLOB instead) when importing the >schema file. Also, it allocates twice the size than necessary. When >viewing the .mdb file with a hex editor all the field contents are contiguous: > > 1afe0 00 00 02 00 ff fe 61 62 63 64 65 ff fe 4c 6f 74 ......abcde..Lot > 1aff0 73 4f 66 44 61 74 61 15 00 09 00 02 00 02 00 03 sOfData......... > >Therefore, there doesn't seem to be a reason why the size should come up >double what Access says it is, unless I'm misunderstanding something here >(entirely possible...). > >I have recreated this problem using a very simple Access database generated >from scratch (above). I have also tried using mdbtools compiled on >Cygwin(Win2k) and Linux, both from the CVS sources, with the same >results. The field sizes are also independent of the backend selected in >mdb-schema. > >Thanks for the help, >Michael > > |