nedich / txquery

Automatically exported from code.google.com/p/txquery
Other
2 stars 2 forks source link

Delphi 6 compilation error - ftWideMemo not supported prior to Delphi 2006 #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. TxQuery 2.4.7
2. Delphi 6
3. compile Xqd6.dpk

What is the expected output? What do you see instead?

Expected:
Successful compile.

Instead:
[Error] xquery.pas(1146): Undeclared identifier: 'ftWideMemo'

What version of the product are you using? On what operating system?
Delphi 6 Pro update 4
TxQuery v2.4.7
Win7 x64 Ultimate / WinXP x86

Please provide any additional information below.

Clearly this version was modified (as a stated goal) for unicode support. Has 
support for older compilers been abandoned? The ftWideMemo was introduced in 
Delphi 2006 so everything prior to that should be broken even though there ARE 
packages for them. I hope that this is just an oversite and not a choice.

Thanks for keeping this project alive.

Original issue reported on code.google.com by rob...@milliganworld.com on 14 May 2012 at 4:44

GoogleCodeExporter commented 9 years ago

I propose these modifications:
=============================================================

Modify file xq_flag.inc

{$IFDEF VER160}      // Delphi 8
{$DEFINE LEVEL4}
{$DEFINE LEVEL5}
{$DEFINE LEVEL6}
{$DEFINE LEVEL7}
{$DEFINE DELPHI8}
{$DEFINE DELPHI}
{$ENDIF}

{$IFDEF VER170}      // Delphi 9
{$DEFINE LEVEL4}
{$DEFINE LEVEL5}
{$DEFINE LEVEL6}
{$DEFINE LEVEL7}
{$DEFINE DELPHI2005}
{$DEFINE DELPHI}
{$ENDIF}

{$IFDEF VER180}      // Delphi 10
   {$IFDEF VER185}
      {$DEFINE Delphi2007}
   {$ELSE}
      {$DEFINE Delphi2006}
   {$ENDIF}
{$DEFINE LEVEL4}
{$DEFINE LEVEL5}
{$DEFINE LEVEL6}
{$DEFINE LEVEL7}
{$DEFINE DELPHI7}
{$DEFINE DELPHI}
{$ENDIF}

{$IFDEF VER190}
{$DEFINE Delphi2007Net}
{$ENDIF}

{$IFDEF VER200}      // Delphi 12
{$DEFINE Delphi2009}
{$DEFINE LEVEL4}
{$DEFINE LEVEL5}
{$DEFINE LEVEL6}
{$DEFINE LEVEL7}
{$DEFINE DELPHI7}
{$DEFINE DELPHI}
{$ENDIF}

{$IFDEF VER210}      // Delphi 14
{$DEFINE Delphi2010}
{$DEFINE LEVEL4}
{$DEFINE LEVEL5}
{$DEFINE LEVEL6}
{$DEFINE LEVEL7}
{$DEFINE DELPHI7}
{$DEFINE DELPHI}
{$ENDIF}

{$IFDEF VER220}      // Delphi 15
{$DEFINE DelphiXE}
{$DEFINE LEVEL4}
{$DEFINE LEVEL5}
{$DEFINE LEVEL6}
{$DEFINE LEVEL7}
{$DEFINE DELPHI7}
{$DEFINE DELPHI}
{$ENDIF}

{$IFDEF VER230}      // Delphi 16
{$DEFINE DelphiXE2}
{$DEFINE LEVEL4}
{$DEFINE LEVEL5}
{$DEFINE LEVEL6}
{$DEFINE LEVEL7}
{$DEFINE DELPHI7}
{$DEFINE DELPHI}
{$ENDIF}

{$IFDEF Delphi1}       {$DEFINE Delphi1Up}       {$ENDIF}
{$IFDEF Delphi2}       {$DEFINE Delphi2Up}       {$ENDIF}
{$IFDEF Delphi3}       {$DEFINE Delphi3Up}       {$ENDIF}
{$IFDEF Delphi4}       {$DEFINE Delphi4Up}       {$ENDIF}
{$IFDEF Delphi5}       {$DEFINE Delphi5Up}       {$ENDIF}
{$IFDEF Delphi6}       {$DEFINE Delphi6Up}       {$ENDIF}
{$IFDEF Delphi7}       {$DEFINE Delphi7Up}       {$ENDIF}
{$IFDEF Delphi8}       {$DEFINE Delphi8Up}       {$ENDIF}
{$IFDEF Delphi2005}    {$DEFINE Delphi2005Up}    {$ENDIF}
{$IFDEF Delphi2006}    {$DEFINE Delphi2006Up}    {$ENDIF}
{$IFDEF Delphi2007}    {$DEFINE Delphi2007Up}    {$ENDIF}
{$IFDEF Delphi2007Net} {$DEFINE Delphi2007NetUp} {$ENDIF}
{$IFDEF Delphi2009}    {$DEFINE Delphi2009Up}    {$ENDIF}
{$IFDEF Delphi2010}    {$DEFINE Delphi2010Up}    {$ENDIF}
{$IFDEF DelphiXE}      {$DEFINE DelphiXEUp}      {$ENDIF}
{$IFDEF DelphiXE2}     {$DEFINE DelphiXE2Up}     {$ENDIF}
=============================================================
Modify file: xquery.pas

   TxqStringField.GetValue
   ...
  {$IFDEF Delphi2006Up}
  end else if (SourceField.DataType = ftWideString) or (SourceField.DataType = ftWideMemo) then begin
    Result := GetData(@Buffer);
    If Result Then
      Value := Buffer;
  {$ENDIF}
  ...

  TxqStringField.SetAsstring
  ...
  {$IFDEF Delphi2006Up}
  end else if (SourceField.DataType = ftWideString) or (SourceField.DataType = ftWideMemo) then begin
    FillChar(Buffer, FDataSize, 0);
    L := Length(Value);
    Move(Value[1], Buffer, L * SizeOf(WideChar));
    SetData(@Buffer);
  {$ENDIF}
  ...

and  

  TCustomxQuery._ReadRecord
  ...
            {$IFDEF Delphi2006Up}
            end else if (FieldDefs[I].DataType = ftWideString) or (FieldDefs[I].DataType = ftWideMemo) then begin
              Wvs := vs;
              Move(Wvs[1], (Buffer + vField.FFieldOffset)^, IMin(FldDef.Size, Length(Wvs)) * SizeOf(WideChar));
            {$ENDIF}
  ...
=============================================================

Original comment by rob...@milliganworld.com on 14 May 2012 at 6:02