Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error in stored proc
Message
De
22/10/2009 16:11:33
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
 
 
À
22/10/2009 06:59:32
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:
01430785
Vues:
58
>Agnes,
>
>>Can an you reproduce this
>Yes, I even tried with a function that is not a stored proc. A function that calls another function doing try/catch. And lastly without try/catch and with on error ...
>
>
>>How can I work around
>
>I haven't found any way. Appears that any error in the append will say 'record in use'

Hmm, when I first read this I saw TEXT TO... with TRY...CATCH. I ran into an error with this a while back - Message#1412669 so I thought it might be related.

Then I saw you've tried other scenarios and still see the problem.

The problem I ran into is caused by an error condition stomping on an open file handle, Christof offered a workaround, which was to store the file handle to a memvar, then restore it after the error handler has completed.

So, I'm wondering if Agnes' problem is also caused by the VFP error handler stomping on something it shouldn't. Maybe if that could be saved, then restored after the error was handled, it would be a workaround.

What it might be that should be saved, I have no idea :(

The problem I encountered was in VFP9 SP1 but not in VFP8 SP1. I wondered if this issue was also not present in VFP8 SP1.

I ran Agnes' code on VFP8 SP1, no problem found, 2 records are appended, no error is raised.

I've also run it on VFP9 SP2 7423 (latest hotfix), no problem there either (?!?)

>>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
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform