Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error in stored proc
Message
De
23/10/2009 13:38:40
 
 
À
22/10/2009 05:44:03
Lutz Scheffler (En ligne)
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01430571
Message ID:
01431077
Vues:
53
This message has been marked as a message which has helped to the initial question of the thread.
>Hi all,
>
>I have a nice little problem with vfp and a stored proc.
>
>In a stored proc used to append a record (default value) I try to use a try catch. If an error in the try block happens the record will not be appended and error 1502 will be raised.
>
>Can an you reproduce this
>How can I work around
>
>code to reproduce:
>
>CREATE DATABASE mooh
>CREATE TABLE test (ix I DEFAULT new_ix())
>
>TEXT TO cHelp NOSHOW
>FUNCTION new_ix
> RETURN 12
>ENDFUNC &&New_IX
>ENDTEXT &&cHelp
>
>STRTOFILE(cHelp,'Help.txt')
>APPEND PROCEDURES FROM HELP.txt OVERWRITE
>
>USE test
>
>*runs fine
>APPEND BLANK
>
>TEXT TO cHelp NOSHOW
>FUNCTION new_ix
> TRY
>   ERROR 1
>  CATCH TO loException
>  FINALLY
> ENDTRY
>
> RETURN 1
>ENDFUNC &&New_IX
>ENDTEXT &&cHelp
>
>STRTOFILE(cHelp,'Help.txt')
>APPEND PROCEDURES FROM HELP.txt OVERWRITE
>
>DELETE FILE Help.txt
>
>*raises error
>APPEND BLANK
>
>
>Agnes

two bugs exists here:
1. the ERROR 1 remove the Record lock
2. VFP ignore every RLOCK put into then db function

FLOCK() is the only "strong" workaround
CLEAR

SET EXCLUSIVE OFF
ON ERROR

CREATE DATABASE mooh

TEXT TO cHelp NOSHOW
FUNCTION new_ix
 RETURN 12
ENDFUNC &&New_IX
ENDTEXT &&cHelp

STRTOFILE(cHelp,'Help.txt')
APPEND PROCEDURES FROM HELP.txt OVERWRITE

CREATE TABLE test (ix I DEFAULT new_ix())

USE test SHARED

*runs fine
APPEND BLANK

TEXT TO cHelp NOSHOW
FUNCTION new_ix
	? ISRLOCKED(),ISFLOCKED()
 TRY
   ERROR 1	&& this remove the RLOCK
   =1
  CATCH TO loException
	? ISRLOCKED(),ISFLOCKED()
	FLOCK()    && this work
	* RLOCK() && vfp ignores this !!!!
 FINALLY
	  ? ISRLOCKED(),ISFLOCKED()
 ENDTRY
 RETURN 1
ENDFUNC &&New_IX
ENDTEXT &&cHelp

STRTOFILE(cHelp,'Help.txt')
APPEND PROCEDURES FROM HELP.txt OVERWRITE

DELETE FILE Help.txt

*raises error
APPEND BLANK

CLOSE DATABASES ALL

DELETE DATABASE mooh DELETETABLES
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform