Monday, June 1, 2009

BDE to DBX Data Pump - Small updates

In the comments of BDE to DBX Blog Post I was made aware of three bugs in the BDEToDBXDataPump application.


I have fixed 2 of the 3 and made a blind attempt at the remaining one, since I can't reproduce.


The updates can be found in my googlecode SVN

The bug is most likely in an incorrect mapping here of currency fields. All of the mappings are done through a constant. See the code below, by my comments you can
tell how good I felt about it :-)



//Mapping Best Guess in 10 minutes of work, so I suspect there
//are problems but you could also change this to find tune for your
//specific mapping needs.
FieldTypeMap : Array[TFieldType] of Integer =
( {ftUnknown} TDBXDataTypes.UnknownType, {ftString} TDBXDataTypes.AnsiStringType, {ftSmallint} TDBXDataTypes.Int16Type, {ftInteger} TDBXDataTypes.Int32Type, {ftWord} TDBXDataTypes.UInt16Type, // 0..4
{ftBoolean} TDBXDataTypes.BooleanType, {ftFloat} TDBXDataTypes.DoubleType, {ftCurrency} TDBXDataTypes.BcdType, {ftBCD} TDBXDataTypes.BcdType, {ftDate}TDBXDataTypes.DateType , {ftTime} TDBXDataTypes.TimeType, {ftDateTime} TDBXDataTypes.DateTimeType, // 5..11
{ftBytes}TDBXDataTypes.BytesType , {ftVarBytes} TDBXDataTypes.VarBytesType, {ftAutoInc} TDBXDataTypes.AutoIncSubType, {ftBlob} TDBXDataTypes.BlobType, {ftMemo} TDBXDataTypes.MemoSubType, {ftGraphic} TDBXDataTypes.BlobType, {ftFmtMemo} TDBXDataTypes.MemoSubType, // 12..18
{ftParadoxOle}TDBXDataTypes.UnknownType , {ftDBaseOle}TDBXDataTypes.UnknownType, {ftTypedBinary}TDBXDataTypes.BlobType, {ftCursor}TDBXDataTypes.UnknownType, {ftFixedChar}TDBXDataTypes.CharArrayType, {ftWideString} TDBXDataTypes.WideStringType, // 19..24
{ftLargeint}TDBXDataTypes.Int64Type, {ftADT}TDBXDataTypes.AdtType , {ftArray}TDBXDataTypes.ArrayType , {ftReference}TDBXDataTypes.UnknownType, {ftDataSet}TDBXDataTypes.UnknownType, {ftOraBlob}TDBXDataTypes.BlobType, {ftOraClob} TDBXDataTypes.BlobType, // 25..31
{ftVariant} TDBXDataTypes.UnknownType, {ftInterface}TDBXDataTypes.UnknownType, {ftIDispatch}TDBXDataTypes.UnknownType, {ftGuid}TDBXDataTypes.CharArrayType, {ftTimeStamp} TDBXDataTypes.DateTimeType, {ftFMTBcd} TDBXDataTypes.BcdType, // 32..37
{ftFixedWideChar} TDBXDataTypes.WideStringType, {ftWideMemo} TDBXDataTypes.UnknownType, {ftOraTimeStamp} TDBXDataTypes.OracleTimeStampSubType, {ftOraInterval}TDBXDataTypes.OracleIntervalSubType, // 38..41
{ftLongWord} TDBXDataTypes.Uint32Type, {ftShortint} TDBXDataTypes.Int16Type, {ftByte} TDBXDataTypes.Int8Type, {ftExtended} TDBXDataTypes.DoubleType, {ftConnection} TDBXDataTypes.UnknownType, {ftParams}TDBXDataTypes.UnknownType, {ftStream}TDBXDataTypes.UnknownType); //42..48


Hopefully my stab in the dark on the remaining issue of change ftCurrency to map to TDBXDatatypes.BCDType instead of CurrencyType is correct. I based it on the comments in dbxCommon.pas


///Delphi Currency data type in System unit.
/// Internally managed as a TDBXDataTypes.BCDType
///

CurrencyType = 25;



Anyway if anyone has any problems with BDEtoDBXDatapump please let me know by
posting an issue on Google Code that way I fix them. Please include the source and destination table/database types as it may be critical to figuring out the mapping problem.