Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   Create Unique Index -> Exception kommt zu spät (https://www.delphipraxis.net/183077-create-unique-index-exception-kommt-zu-spaet.html)

hoika 10. Dez 2014 08:19

Datenbank: FB • Version: 2 • Zugriff über: IBDAC

Create Unique Index -> Exception kommt zu spät
 
Hallo,

ich habe hier ein merkwürdiges Problem.
IBDAC 3 (jaja, ist ein altes Projekt)

Ich erzeuge per TIBCQuery einen unique Index.
Schlägt das fehl, weil z.B. doppelte Werte vorhanden sind,
schlägt das nächste ExecSQL einer anderen Query fehl ...
Und zwar genau mit der erwarteten Fehlermeldung "Attempt to store duplicate value (visible to active transactions) in unique index".

Das ist eine völlig andere Query !

selbst ein try except um das Indexerzeugen behebt das Problem nicht.

Threads benutze ich dort nicht.

Ist das Problem bekannt?

Danke


Heiko

mensch72 10. Dez 2014 08:35

AW: Create Unique Index -> Exception kommt zu spät
 
wenn es reproduzierbar ist, das im Fall der Fälle die Exception bei der nächsten SQL Anweisung "raus" kommt und keine parallelen Threads werkeln, dann kannst du als WorkAround auch dahinter stets ein zusätzliches "select uid from table where uid=0" machen. Der SQL Befehl spielt ja keine Rolle, geht ja nur um das "fangen" der Exception, wenn es so ist wie du beschreibst, das die wenn dann immer erst beim nächsten Befehl kommt.

Keine "schöne" Lösung, aber wenn's hilft... und schadet außer etwas Verarbeitungszeit zumindest nicht.

hoika 10. Dez 2014 08:49

AW: Create Unique Index -> Exception kommt zu spät
 
Hallo,

klingt sehr pragmatisch, aber so wollte ich dann auch rangehen ;)

Heiko


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:03 Uhr.

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