
Different results of OpenSchema() with different drivers?
Hi folks, (VC++ 6, ADO)
I need to access the legacy database (FoxPro 2.5 dbf's), and I need
also to convert it programmatically to SQL database. I try to
generate SQL scripts as a first step.
I tried to use different drivers for accessing dbf files and the
result of OpenSchema() were different, concerning the data types of
table items. See the comparison at the end of the message.
I tried "Microsoft Visual FoxPro Driver", vfpodbc.dll from
15.6.1998, version 6.00.816700. I tried also "Microsoft FoxPro
Driver (*.dbf), FoxPro 2.6" or "Microsoft dBase Driver (*.dbf),
dBase III", ODBCJT32.DLL from 13.5.1998, version 3.51.171300.
I saw somewhere a message that "Visual FoxPro Driver" should be
replacement for the other drivers. However, I did observe fatal
errors when used the "Visual" driver under Windows NT (see the "Bug in
Visual FoxPro driver (ver. 6.00.816700)?" article).
To illustrate the differences, here is an example of some
information got for the same columns in the same table (physically
the same dbf file). Only the TABLE_NAME, TABLE_CATALOG items, and
items with null (VT_NULL) values were omitted. The number in [square
brackets] state the field index in the collection returned by
OpenSchema(), the names of the fields were got via the Name property
of the collection fields, the values via Value and decoded by the
same routines (to be more readable).
Results got via "Visual FoxPro Driver":
[03] COLUMN_NAME = "hran2"
[07] COLUMN_HASDEFAULT = false
[09] COLUMN_FLAGS = WRITEUNKNOWN, ISFIXEDLENGTH,
[10] IS_NULLABLE = false
[11] DATA_TYPE = DBTYPE_NUMERIC
[15] NUMERIC_PRECISION = 3 (i4)
[16] NUMERIC_SCALE = 0 (i2)
[27] DESCRIPTION = ""
Results got via "dBase Driver" are the same as results got via
"FoxPro Driver", which is not surprising as both the drivers reside
in the same DLL:
[03] COLUMN_NAME = "HRAN2"
[07] COLUMN_HASDEFAULT = false
[09] COLUMN_FLAGS = WRITEUNKNOWN, ISFIXEDLENGTH,
ISNULLABLE, MAYBENULL,
[10] IS_NULLABLE = true
[11] DATA_TYPE = DBTYPE_R8
[15] NUMERIC_PRECISION = 15 (i4)
[28] ORDINAL = 17 (i4)
Firstly, I would like to point out the case of COLUMN_NAME value --
which I do not consider a problem. The "Visual FoxPro Driver" also
does not return the ORDINAL item, the "dBase Driver"--on the other
hand--does not return DESCRIPTION (set to apparently default empty
value), no problem.
What may be the problem is the different value of the IS_NULLABLE,
of the COLUMN_FLAGS, and namely a different DATA_TYPE. Could anyone
comment this?
Thanks for help,
Petr
--
Petr Prikryl, SKIL s.r.o., e-mail: skil(at)stbk.mcs.cz
Please, don't reply via e-mail as more people share the
address. Do reply via net news.