1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77:
| procedure TThreadP05CreateInputFiles.createAccLocFile(); var i : Int64; ln : string; fName : String; mySQL : Widestring; Ausgabe : Textfile; begin AddLogMsg(0,120,false,'Start: createAccLocFile()'); i := -1;
try AddLogMsg(0,120,false,'Datenbankabfrage für Location wird gestartet!');
mySQL := 'select acct_location_id, address1, city, ' + 'upper(trim(hausnr)) as hausnr, '+ 'upper(trim(hausnr_zu)) as hausnr_zu, '+ 'postal_code_id, soundex(address1), soundex(city), soundex(hausnr) '+ 'from account_location where duploc=0 '+ 'order by soundex(city), soundex(address1), 1';
AddLogMsg(2,120,false,'SQL Statement: '+ mySQL);
DataModuleAxentForm.ADODS_P05_CreateFiles.CommandText := mySQL; DataModuleAxentForm.DS_P05_CreateFiles.DataSet := DataModuleAxentForm.ADODS_P05_CreateFiles;
with DataModuleAxentForm.DS_P05_CreateFiles.DataSet do begin Active := true; First(); end; AddLogMsg(0,120,false,'Datenbankabfrage für Location erfolgreich beendet!'); except on E: Exception do AddLogMsg(0,120,true,'FATALERROR on get DB Data!: ' + E.Message); end;
fName := PFAD_UNDO + ACCLOC_FN_NEW; AddLogMsg(1,120,false, fName + ' -> Erstelle Datei!'); AssignFile(Ausgabe, fName); Rewrite(Ausgabe);
AddLogMsg(0,120,false, fName + ' -> Starte schreiben in die Datei!'); while not DataModuleAxentForm.DS_P05_CreateFiles.DataSet.Eof do begin with DataModuleAxentForm.DS_P05_CreateFiles.DataSet do begin inc(i); ln:= FieldByName('ACCT_LOCATION_ID').AsString +'|' + FieldByName('ADDRESS1').AsString + '|' + FieldByName('CITY').AsString + '|' + FieldByName('HAUSNR').AsString + '|' + FieldByName('HAUSNR_ZU').AsString + '|' + FieldByName('POSTAL_CODE_ID').AsString + '|' + FieldByName('SOUNDEX(ADDRESS1)').AsString + '|' + FieldByName('Soundex(CITY)').AsString + '|' + FieldByName('Soundex(HAUSNR)').AsString; Next(); end;
try writeln(Ausgabe, ln); except on E: Exception do AddLogMsg(0,120,true, fName + ' -> WARN: Error on write Data to file!: ' + E.Message); end; end; AddLogMsg(0,120,false, fName + ' -> Datensätze insgesamt geschrieben = ' + inttostr(i));
DataModuleAxentForm.DS_P05_CreateFiles.DataSet.Active:= false; AddLogMsg(2,120,false, fName + ' -> Schliesse Datei!'); Closefile(Ausgabe); AddLogMsg(1,120,false, fName + ' -> Beende schreiben in die Datei!'); AddLogMsg(0,120,false,'End: createAccLocFile()'); end; |