unit TDatenbank;
interface
uses
System.SysUtils, System.Classes, SQLServerUniProvider, UniProvider,
MySQLUniProvider, Data.DB, DBAccess, Uni,
vcl.Forms,
vcl.Dialogs,
FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf, FireDAC.Stan.Def,
FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.MySQL, FireDAC.Phys.MySQLDef,
FireDAC.VCLUI.Wait, FireDAC.Comp.Client, FireDAC.Comp.DataSet, System.JSON,
FireDAC.Comp.BatchMove, FireDAC.Comp.BatchMove.JSON, FireDAC.Stan.StorageJSON,
FireDAC.Comp.BatchMove.DataSet, FireDAC.Phys.MSSQL, FireDAC.Phys.MSSQLDef,
FireDAC.Phys.ODBCBase, TLogic_Unit, FireDAC.Stan.StorageXML,
FireDAC.Stan.StorageBin, MemData;
type
TDB_Modul =
class(TDataModule)
Qry_Properties: TFDQuery;
//Das ist die angesprochene Query
MyConnect: TFDConnection;
MSConnect: TFDConnection;
FDPhysMSSQLDriverLink1: TFDPhysMSSQLDriverLink;
MySQLDriver: TFDPhysMySQLDriverLink;
FDStanStorageXMLLink1: TFDStanStorageXMLLink;
FDStanStorageBinLink1: TFDStanStorageBinLink;
DS_Properties: TUniDataSource;
procedure DataModuleCreate(Sender: TObject);
procedure MyConnectLost(Sender: TObject);
procedure MyConnectError(ASender, AInitiator: TObject;
var AException:
Exception);
procedure MSConnectLost(Sender: TObject);
procedure MSConnectError(ASender, AInitiator: TObject;
var AException:
Exception);
procedure MyConnectAfterConnect(Sender: TObject);
private
FCountConnect: integer;
public
procedure Get_Properties( AStream: TStream);
//Hier ist die Select-Anweisung
procedure LostConnection(Sender: TObject; Component: TComponent; ConnLostCause: TConnLostCause;
var RetryMode: TRetryMode);
function Connect (Connection: TFDConnection; FileName:
string): boolean;
function DisConnect (Connection: TFDConnection): boolean;
function Insert_Properties (Einstellung, Wert, Kommentar:
string): integer;
function Update_Properties (prop_id: integer; Einstellung, Wert, Kommentar:
string): boolean;
function Read_Einstellungswert(Einstellung:
string):
string;
end;
Type
TMxSQL =
class//Für alle anderen Abfragen des Clients wird jeweils ein Object von TMxSQL erzeugt
private
{ Private-Deklarationen }
function Get_BNumbers (BNumber, LNumber, TNumber, VDLeister, Kunde:
string; VDate_von, VDate_bis: TDate):
string;
public
{ Public-Deklarationen }
procedure ExecQuery (
query: TFDQuery;
var Cols: TCols;
var Rows: TRows; AddRows: integer);
procedure Get_Buyer(Lieferschein:
string; AStream: TStream);
procedure JSArray_TRows (JS_ArrayString:
string;
var Cols: TCols;
var Rows: TRows);
procedure Get_TNumber (
var Cols: TCols;
var Rows: TRows; BNumber:
string);
procedure Get_Order (
var Cols: TCols;
var Rows: TRows; BNumber:
string);
procedure Get_WeeklyStock (
var AStream: TMemorySTream);
procedure Get_SData(BNumber, TNumber, VDLeister, Kunde, BestellNr:
string; VDate_von, VDate_bis: TDate; AStream: TStream);
procedure Get_BData(BestellNr:
string; LStream: TStream);
procedure Get_VData(BNumber:
string; LStream: TStream);
function Write_TNum_MySQL (Cols: TCols; Rows: TRows): boolean;
function Write_TNum_MsSQL (Cols: TCols; Rows: TRows): boolean;
function Write_order (BestNr, LNumber, Empfaenger:
string): boolean;
function Exist_BNumber (BNumber:
string): boolean;
function QryToStream (
Query: TFDQuery): TMemoryStream;
end;
var
DB_Modul: TDB_Modul;
//Über dieses Object ist die Query immer zu erreichen
implementation