Question : ILLEGAL VIEW NAMES VISUAL FOXPRO?

Is there a naming rule for views in VFP?

Why ask?

I'm having a repeatable problem trying to update the stored procedures in a dbc. I can and have made numerous changes in the past, used gendbcx to create the update code and krt file. Works beautifully every time.

Until this particular change.

Most of the code I've so far placed in the stored procedure file is only there to create indexes for views so that, as soon as a view is opened, the index I need in the app is available.

here, for example is one that does NOT cause a problem:

            CASE cTableName='ACCOUNT_PRICESET'
            INDEX on accref TAG accref
            INDEX on category+code TAG catcode additive
            INDEX UNIQUE ON CATEGORY TAG CATUNQ additive
            SET ORDER TO catcode

and here is the one that causes the problem:

            CASE cTableName='ACCOUNT_CAT_DEFAULTS'
            INDEX on category TAG category
            SET ORDER TO category

If I add that to the stored procedure and run gendbcx, when the update code imports the resulting krt file and then tries to open the dbc, it always fails with "DBC is not an object file"

I have looked in detail at the krt file. It appears  to be perfect. The import substr calculations are properly reset to the revised positions in the "Code" and nothing else looks untoward.

I have subsequently reverted and made other changes to the stored proc file, recompiled and have no problem at all with the krt file import.

Given the simplicity of the offending code, the only remaining hypothesis I could come up with is that the name of the view - ACCOUNT_CAT_DEFAULTS is the cause of the problem. So I changed the name of the view to 'CAT_DEFAULTS' which is very similar to many of my other views and changed the stored proc code accordingly. Nada. Exactly the same failure.

Anyone got any ideas?

Answer : ILLEGAL VIEW NAMES VISUAL FOXPRO?

GENDBCX has 3 input parameters:

tcOutFile, tcClassName, tlSeparateSPObjCode

If you use just the first one then KRT file is created
The second one allows to use your own GENDBC class and it is most probably empty in your case
The third one when .T. allows to create KRT + KRO file. KRT contains the source, KRO the compiled code.  BUT this probably does not help.

Database compilation is allowed even if DBC is not open, so you may add COMPILE DATABASE <YourDatabase> command just before the OPEN DATABASE <YourDatabase> command into PROCEDURE CreateDBC in generated PRG code. If the DBC file is correct (and it should be because it contains just stored procedures at this point) then the compilation should help. It also means the KRT file is not created correctly which sounds suspiciously... But you have to try.

The GENDBCX available on a web was last updated 1998.07.20  by SEA. Its version is 1.12. Everything is in comments at the beginning. It seems you have the latest version. BTW, VFP now contains GENDBC which is probably newer than this GENDBCX.

And the final and most important question:
Did you try to generate new DBC from the code generated by GENDBCX or does it crash only when you use your own updater?

Random Solutions  
 
programming4us programming4us