Page 1 of 1

Driver disable without "Zeos.inc"

Posted: 12.07.2021, 16:23
by nakisen
Hi,

I want to disable some database drivers. But I don't want to do this with "Zeos.inc". I could not do this with the codes I added in "project1.inc" in my sample project. Can I disable drivers with "project1.inc"?

Code: Select all

unit Unit1;

interface

{$I project1.inc}

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ZSqlUpdate, Data.DB, ZAbstractRODataset,
  ZAbstractDataset, ZDataset, ZAbstractConnection, ZConnection;

type
  TForm1 = class(TForm)
    ZQuery1: TZQuery;
    ZUpdateSQL1: TZUpdateSQL;
    ZConnection1: TZConnection;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

end.

Code: Select all

project1.inc content

{.$DEFINE ZEOS_DISABLE_MYSQL}
{$DEFINE ZEOS_DISABLE_POSTGRESQL}
{.$DEFINE ZEOS_DISABLE_DBLIB}
{$DEFINE ZEOS_DISABLE_ADO}
{.$DEFINE ZEOS_DISABLE_INTERBASE}
{.$DEFINE ZEOS_DISABLE_FIREBIRD}
{$DEFINE ZEOS_DISABLE_SQLITE}
{$DEFINE ZEOS_DISABLE_ORACLE}
{$DEFINE ZEOS_DISABLE_ASA}
{$DEFINE ZEOS_DISABLE_SQLANY}
{.$DEFINE ZEOS_DISABLE_POOLED}
{$DEFINE ZEOS_DISABLE_OLEDB}
{$DEFINE ZEOS_DISABLE_ODBC}
{$DEFINE ZEOS_DISABLE_PROXY}
{$DEFINE ZEOS_PROXY_USE_INTERNAL_PROXY}

Re: Driver disable without "Zeos.inc"

Posted: 13.07.2021, 08:02
by marsupilami
Hello nakisen,

it ist possible to disable drivers but not with your project1.inc. It all depends on the compilation of your project. Project1.inc is only included by Unit1.pas but not by other units - so it has no effect on other units. If you want to disable drivers without modifying Zeos.inc, you can do it this way:
  1. Add the Zeos source paths to the search path of your project. Zeos source paths are zeos\src\core, zeos\src\parsesql, zeos\src\plain, zeos\src\dbc and zeos\src\comnponent.
  2. Add the defines for disabling Zeos drivers to your project defines in the project options.
Adding the Zeos source paths will make sure that Zeos will be recomiled for your project. Adding the defines to the project options, will make sure that Zeos gets recompiled with those defines enabled.
I suggest you set the unit output path to be somewhere in your project folder. Otherwise the recompiled units will be littering the Zeos sources and might get picked up by other projects. Also keep in mind that this will increase compile time for your project because the zeos units will be recompiled every time.

Best regards,

Jan

Re: Driver disable without "Zeos.inc"

Posted: 13.07.2021, 15:28
by nakisen
Thanks