Delphi-PRAXiS
Seite 1 von 2  1 2   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   Delphi Fibplus Batch Datenimport Problem (https://www.delphipraxis.net/153293-fibplus-batch-datenimport-problem.html)

manfred_h 28. Jul 2010 09:45

Datenbank: Firebird • Version: 2.1 • Zugriff über: Fibplus

Fibplus Batch Datenimport Problem
 
Hallo zusammen

in meiner Anwendung besteht die Möglichkeit Daten mit verschiedenen
Computer manuell abzugleichen. Dies funktioniert auch einwandfrei.
Neu ist die Datenbank erweitert worden und nun bestehen Probleme Daten die von der "alten" DB sind in die neue zu integrieren.

Der Import erfolgt so:


> z.B. anstelle von
alt: ( Q_TEST ist in neu nicht vorhanden )
Code:
  sql_string_table   := ( 'INSERT INTO HOTEL ( ID, C_NO, CITY, TEL, FAX, EMAIL, HOMEPAGE, Q_TEST )' +
                           'values ( :ID, :C_NO, :CITY, :TEL, :FAX, :EMAIL, :HOMEPAGE, :Q_TEST )');
  //
neu: ( zusätzlich sind die Felder POS_LAT, POS_LNG )
Code:
  sql_string_table   := ( 'INSERT INTO HOTEL ( ID, C_NO, CITY, POS_LAT, POS_LNG, TEL, FAX, EMAIL, HOMEPAGE )' +
                           'values ( :ID, :C_NO, :CITY, :POS_LAT, :POS_LNG, :TEL, :FAX, :EMAIL, :HOMEPAGE )');
danach ( ein Auszug )
Delphi-Quellcode:
      with Q_import do
      begin
        Close;
        SQL.Text :=( sql_string_table );
        BatchInputRawFile(db_dir + 'exchange\'+ file_name + '.fibplus');
        frm_import_export.log_window_1.Lines.Add('***   Import  ***');
        frm_import_export.log_window_1.Lines.Add(db_dir + 'exchange\');
        frm_import_export.log_window_1.Lines.Add(file_name + '.fibplus');
        Close;
        frm_import_export.ProgressBar_imp_exp.Position := 30;
        if sql_string_table_d > '' then
        begin
          SQL.Text :=( sql_string_table_d );
          BatchInputRawFile(db_dir + 'exchange\'+ file_name +'_d.fibplus');
          frm_import_export.log_window_1.Lines.Add(file_name + '_d.fibplus');
          Close;
        end;
        frm_import_export.ProgressBar_imp_exp.Position := 60;
Die Fehlermeldung schlussendlich ist folgende:
Zitat:

First chance exception at $7555B727. Exception class EFIBInterBaseError with message 'DM.Q_import:
Arithmetic overflow or division by zero has occurred.Arithmetic exception, numeric overflow, or string truncation.
Bin für Tipps dankbar
Manfred

alex517 28. Jul 2010 13:54

AW: Fibplus Batch Datenimport Problem
 
Hab BatchInput/BatchOutput selbst noch nicht verwendet deshalb nur eine Vermutung.
Das Import-File hat noch die alte Struktur und passt deshalb zum nicht zum neuen Insert-Statement.
Entweder ein zum Import-File passendes Insert-Statement verwenden oder
evtl. oder hilft das weiter:
devguide1.pdf
Zitat:

Batch processing
Delphi-Quellcode:
procedure BatchOutputRawFile(const FileName:string;Version:integer=1);
procedure BatchToQuery(ToQuery:TFIBQuery; Mappings:TStrings);
The Version parameter is responsible for format compatibility with old file versions, created
by FIBPlus BatchOutputXXX method. If Version = 1, FIBPlus uses an old principle of work
with file versions: the external file keeps data ordered by SQL query fields. It is supposed that on
reading data saved by the BatchInputRawFile method, parameters will have the same order in the
reading SQL. The number of TpFIBQuery fields (the source of the data) must coincide to the
number of TpFIBQuery parameters which will read the data. For string fields it is important to
have the same length for the field being written and for the reading parameter whereas their
names can differ.
If Version = 2, FIBPlus uses a new principle of writing data. Besides the data, the file also
keeps system information about fields (name, type and length). On reading the data, it will be
chosen by similar names. The order and number of fields in the writing TpFIBQuery can differ
from those of parameters in the reading TpFIBQuery. Their types and length can also differ.
Only names must coincide.

manfred_h 28. Jul 2010 14:35

AW: Fibplus Batch Datenimport Problem
 
Hallo Alex

verwende bereits FIBPlus BatchOutputXXX method Version = 2
Zitat:

Entweder ein zum Import-File passendes Insert-Statement verwenden
Habe ich auch schon versuch erhalte aber trotzdem die Fehlermeldung:
Zitat:

First chance exception at $7555B727. Exception class EFIBInterBaseError with message 'DM.Q_import:
Arithmetic overflow or division by zero has occurred.Arithmetic exception, numeric overflow, or string truncation.
Danke auf jeden Fall für Deinen Tipp.

Shalom
Manfred

mkinzler 28. Jul 2010 14:37

AW: Fibplus Batch Datenimport Problem
 
Stimmen die Codepage/locale Einstellungen?

manfred_h 28. Jul 2010 15:44

AW: Fibplus Batch Datenimport Problem
 
Zitat:

Zitat von mkinzler (Beitrag 1038126)
Stimmen die Codepage/locale Einstellungen?

:oops: Sorry wo kann ich das nachschauen...
Habe bei der DB Anbindung meines Wissens nichts geändert.
Ausser der Umstellung von Firebird 1.5 auf 2.1.

mkinzler 28. Jul 2010 15:46

AW: Fibplus Batch Datenimport Problem
 
Was steht den bei der Connection drinnen und was bei den Feldern in der DB?

manfred_h 28. Jul 2010 15:52

AW: Fibplus Batch Datenimport Problem
 
Zitat:

Zitat von mkinzler (Beitrag 1038159)
Was steht den bei der Connection drinnen und was bei den Feldern in der DB?

Zitat:

with DM.DB_Gideons do
begin
Connected := False;
DBParams.Clear;
DBParams.Add ('lc_ctype=UNICODE_FSS');
DBParams.Add ('user_name=sysdba');
DBParams.Add ('password=masterkey');
LibraryName := app_dir +('fbclient.dll');
DatabaseName := db_dir +('GIDEONS_DB.FDB');
Connected := True;
end;
Die Verbindung klappt bei beiden Versionen ohne Probleme.
Lediglich der Import in die neue Version ist Problematisch.
Neu wird jetzt CopyCat für den Abgleich verwendet. Aber alle
Installationen müssen zuerst umgestellt werden.

Manfred

mkinzler 28. Jul 2010 15:53

AW: Fibplus Batch Datenimport Problem
 
Sind denn alle Char/Varchar Felder auch UNICODE_FSS?

manfred_h 28. Jul 2010 15:59

AW: Fibplus Batch Datenimport Problem
 
Ja bei beiden DB's.

Chemiker 28. Jul 2010 19:03

AW: Fibplus Batch Datenimport Problem
 
Hallo manfred_h,

Zitat:

Zitat von manfred_h
Ausser der Umstellung von Firebird 1.5 auf 2.1.

Hast Du die alten Daten in FB 1.5 und die neuen sollen auf FB 2.1? Wenn das so ist könnte vielleicht ein BackUp der alten DB (FB 1.5) und anschließend ein Restore auf die neue DB (FB 2.1) helfen. Anschließend noch mal Versuchen die DB zu ändern.

Bis bald Chemiker


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:04 Uhr.
Seite 1 von 2  1 2   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz