* Split out feature registration. Remove package units from uses clause

git-svn-id: trunk@63106 -
This commit is contained in:
michael 2020-05-01 14:05:13 +00:00
parent d66e94abd3
commit f213c8c84c
6 changed files with 121 additions and 66 deletions

1
.gitattributes vendored
View File

@ -12486,6 +12486,7 @@ tools/lazdatadesktop/lazdatadesktop.lpi svneol=native#text/plain
tools/lazdatadesktop/lazdatadesktop.lpr svneol=native#text/plain tools/lazdatadesktop/lazdatadesktop.lpr svneol=native#text/plain
tools/lazdatadesktop/lazdatadesktop.res -text tools/lazdatadesktop/lazdatadesktop.res -text
tools/lazdatadesktop/querypanel.res -text tools/lazdatadesktop/querypanel.res -text
tools/lazdatadesktop/reglddfeatures.pp svneol=native#text/plain
tools/lazres.lpi svneol=native#text/plain tools/lazres.lpi svneol=native#text/plain
tools/lazres.pp svneol=native#text/pascal tools/lazres.pp svneol=native#text/pascal
tools/lfm_to_lrs.sh svneol=native#text/plain tools/lfm_to_lrs.sh svneol=native#text/plain

View File

@ -19,22 +19,6 @@
*************************************************************************** ***************************************************************************
} }
{
Adding support for new connection types requires implementing a Data Dictionary for your connection type
see fcl-db/src/datadict for many implementations.
When done so, add the unit to the uses clause in the implementation, register it in RegisterDDEngines
and likely add a connection callback to RegisterConnectionCallBacks.
}
{ MS-SQL server connection}
{$IF FPC_FULLVERSION>30001}
{$DEFINE HAVEMSSQLCONN}
{$ENDIF}
{ MySQL 5.6 and 5.7 connections }
{$IF FPC_FULLVERSION>30100}
{$DEFINE HAVEMYSQL5657CONN}
{$ENDIF}
unit frmmain; unit frmmain;
@ -310,29 +294,8 @@ implementation
{ $DEFINE HAVEMSSQLCONN} { $DEFINE HAVEMSSQLCONN}
uses uses
frmselectconnectiontype, frmselectconnectiontype, reglddfeatures,
// Data dictionary support for frmimportdd,frmgeneratesql,fpddsqldb,frmSQLConnect;
fpdddbf, // DBF
{$ifndef win64}
fpddfb, // Firebird
fpddmysql40, // MySQL 4.0
fpddmysql41, // MySQL 4.1
fpddmysql50, // MySQL 5.0
fpddmysql51, // MySQL 5.1
fpddmysql55, // MySQL 5.5
{$ifdef HAVEMYSQL5657CONN}
fpddmysql56, // MySQL 5.6
fpddmysql57, // MySQL 5.7
{$endif HAVEMYSQL5657CONN}
fpddoracle, // Oracle
fpddpq, // PostgreSQL
{$endif}
fpddsqlite3, // SQLite 3
fpddodbc, // Any ODBC supported
{$ifdef HAVEMSSQLCONN}
fpddmssql,
{$endif HAVEMSSQLCONN}
frmimportdd,frmgeneratesql,fpddsqldb,frmSQLConnect,fpstdexports;
{ --------------------------------------------------------------------- { ---------------------------------------------------------------------
TMainform events TMainform events
@ -452,8 +415,9 @@ begin
// //
// Register DD engines. // Register DD engines.
RegisterDDEngines; RegisterDDEngines;
RegisterExportFormats;
// Register standard export formats. // Register standard export formats.
RegisterStdFormats;
FRecentDicts:=TRecentDataDicts.Create(TRecentDataDict); FRecentDicts:=TRecentDataDicts.Create(TRecentDataDict);
FRecentConnections:=TRecentConnections.Create(TRecentConnection); FRecentConnections:=TRecentConnections.Create(TRecentConnection);
FN:=SysToUTF8(GetAppConfigDir(False)); FN:=SysToUTF8(GetAppConfigDir(False));
@ -586,25 +550,7 @@ end;
procedure TMainForm.RegisterDDEngines; procedure TMainForm.RegisterDDEngines;
begin begin
{$ifndef win64} RegisterEngines;
RegisterFBDDEngine;
RegisterMySQL40DDEngine;
RegisterMySQL41DDEngine;
RegisterMySQL50DDEngine;
RegisterMySQL51DDEngine;
RegisterMySQL55DDEngine;
{$ifdef HAVEMYSQL5657CONN}
RegisterMySQL56DDEngine;
RegisterMySQL57DDEngine;
{$endif}
RegisterOracleDDEngine;
RegisterPostgreSQLDDengine;
{$endif}
RegisterSQLite3DDEngine;
RegisterODBCDDengine;
{$IFDEF HAVEMSSQLCONN}
RegisterMSSQLDDEngine;
{$ENDIF}
end; end;
procedure TMainForm.RegisterConnectionCallBacks; procedure TMainForm.RegisterConnectionCallBacks;

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="11"/> <Version Value="12"/>
<General> <General>
<Flags> <Flags>
<SaveOnlyProjectUnits Value="True"/> <SaveOnlyProjectUnits Value="True"/>
<LRSInOutputDirectory Value="False"/> <LRSInOutputDirectory Value="False"/>
<CompatibilityMode Value="True"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<AutoCreateForms Value="False"/> <AutoCreateForms Value="False"/>
<Title Value="Lazarus Data Desktop"/> <Title Value="Lazarus Data Desktop"/>
<Scaled Value="True"/> <Scaled Value="True"/>
@ -27,13 +27,13 @@
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local> <local>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local> </local>
<FormatVersion Value="2"/> <FormatVersion Value="2"/>
<Modes Count="1"> <Modes Count="1">
<Mode0 Name="default"> <Mode0 Name="default">
<local> <local>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local> </local>
</Mode0> </Mode0>
</Modes> </Modes>
@ -65,7 +65,7 @@
<MinVersion Minor="1" Release="1" Valid="True"/> <MinVersion Minor="1" Release="1" Valid="True"/>
</Item8> </Item8>
</RequiredPackages> </RequiredPackages>
<Units Count="13"> <Units Count="14">
<Unit0> <Unit0>
<Filename Value="lazdatadesktop.lpr"/> <Filename Value="lazdatadesktop.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -143,6 +143,10 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/> <ResourceBaseClass Value="Frame"/>
</Unit12> </Unit12>
<Unit13>
<Filename Value="reglddfeatures.pp"/>
<IsPartOfProject Value="True"/>
</Unit13>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -8,9 +8,10 @@ uses
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, frmmain, dicteditor, DBFLaz, frmimportdd, Forms, frmmain, dicteditor, DBFLaz, frmimportdd,
frmgeneratesql, SQLDBLaz, lazdatadict, RunTimeTypeInfoControls, frmSQLConnect, frmgeneratesql, RunTimeTypeInfoControls, frmSQLConnect,
ddfiles, frmselectconnectiontype, ddfiles, frmselectconnectiontype,
lazdatadeskstr, lazdbexport, fraquery, fradata, fraconnection; lazdatadeskstr, fraquery, fradata, fraconnection,
reglddfeatures;
{$R *.res} {$R *.res}

View File

@ -0,0 +1,103 @@
unit reglddfeatures;
{
Adding support for new connection types requires implementing a Data Dictionary for your connection type
see fcl-db/src/datadict for many implementations.
When done so, add the unit to the uses clause in the implementation, register it in RegisterDDEngines
and likely add a connection callback to RegisterConnectionCallBacks.
}
{ MS-SQL server connection}
{$IF FPC_FULLVERSION>30001}
{$DEFINE HAVEMSSQLCONN}
{$ENDIF}
{ MySQL 5.6 and 5.7 connections }
{$IF FPC_FULLVERSION>30100}
{$DEFINE HAVEMYSQL5657CONN}
{$ENDIF}
{$IFDEF VER3_0_4}
{$DEFINE HAVEMYSQL5657CONN}
{$ENDIF}
{$mode objfpc}{$H+}
interface
uses
// Data dictionary support for database types
fpdddbf, // DBF
{$ifndef win64}
fpddfb, // Firebird
fpddmysql40, // MySQL 4.0
fpddmysql41, // MySQL 4.1
fpddmysql50, // MySQL 5.0
fpddmysql51, // MySQL 5.1
fpddmysql55, // MySQL 5.5
{$ifdef HAVEMYSQL5657CONN}
fpddmysql56, // MySQL 5.6
fpddmysql57, // MySQL 5.7
{$endif HAVEMYSQL5657CONN}
fpddoracle, // Oracle
fpddpq, // PostgreSQL
{$endif}
fpddsqlite3, // SQLite 3
fpddodbc, // Any ODBC supported
{$ifdef HAVEMSSQLCONN}
fpddmssql,
{$endif HAVEMSSQLCONN}
// code generators
{$IF FPC_FULLVERSION>=30200}
fpcgfieldmap,
fpcgtypesafedataset,
{$ENDIF}
fpcgSQLConst,
fpcgdbcoll,
fpcgCreateDBF,
fpcgtiOPF,
// data Export
fpstdExports,
fpxmlxsdexport,
fpdbexport
;
procedure registerengines;
procedure RegisterExportFormats;
implementation
procedure RegisterExportFormats;
begin
RegisterXMLXSDExportFormat;
RegisterStdFormats;
end;
procedure registerengines;
begin
{$ifndef win64}
RegisterFBDDEngine;
RegisterMySQL40DDEngine;
RegisterMySQL41DDEngine;
RegisterMySQL50DDEngine;
RegisterMySQL51DDEngine;
RegisterMySQL55DDEngine;
{$ifdef HAVEMYSQL5657CONN}
RegisterMySQL56DDEngine;
RegisterMySQL57DDEngine;
{$endif}
RegisterOracleDDEngine;
RegisterPostgreSQLDDengine;
{$endif}
RegisterSQLite3DDEngine;
RegisterODBCDDengine;
{$IFDEF HAVEMSSQLCONN}
RegisterMSSQLDDEngine;
{$ENDIF}
end;
end.