Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Increment Field
Message
De
11/04/2008 18:33:02
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01309981
Message ID:
01310116
Vues:
23
>Hi Al,
>
>You shouldn't use an alias in RECNO() or similar functions because a query always uses internal alliases for tables involved. If you do, than you reference an alias outside of a query.

Sure, that's what my testing just showed. Even explicitly calling the alias of the derived query tries to go outside (my Test #2). It just shows that these two overloads of RECNO() have different behaviour.

>>
>>* Test2
>>CLOSE DATABASES ALL
>>
>>CREATE CURSOR Test1 ( Char1 C( 10 ) )
>>* We purposefully leave no rows in the first cursor
>>
>>CREATE CURSOR Test2 ( Char1 C( 10 ), OrderCol I )
>>INSERT INTO Test2 ( Char1, OrderCol ) VALUES ( "One", 1 )
>>INSERT INTO Test2 ( Char1, OrderCol ) VALUES ( "Two", 2 )
>>INSERT INTO Test2 ( Char1, OrderCol ) VALUES ( "Three", 3 )
>>INSERT INTO Test2 ( Char1, OrderCol ) VALUES ( "Four", 4 )
>>INSERT INTO Test2 ( Char1, OrderCol ) VALUES ( "Five", 5 )
>>
>>* Purposely set the currently selected table to
>>* the first cursor instead of Test2 to see if we can fool RECNO():
>>SELECT Test1
>>
>>SELECT ;
>>  * ;
>>  , RECNO( "DerivedTable" ) AS MyRecNo ;
>>  FROM ;
>>    ( SELECT ;
>>      * ;
>>      FROM Test2 ) DerivedTable ;
>>  INTO CURSOR Output ;
>>  ORDER BY OrderCol
>>
>>* Result: Program error: "Alias is not found". But, we're explicitly referencing
>>the alias of the derived table! Shouldn't this work? < g >
>>
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