Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table or Cursor
Message
De
23/03/2009 14:32:55
 
 
À
23/03/2009 12:06:48
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
OS:
Windows XP SP2
Divers
Thread ID:
01390685
Message ID:
01390786
Vues:
69
>>Hi All
>>
>>Suppose I have this situation
>>
>>
>>use (_samples+'data\customer') in 0 Shared Alias Table1
>>Create Cursor Table2 (p_name c(20))
>>
>>? IsTable("table1") && Return .T.
>>? IsTable("table2") && Return .F.
>>
>>Procedure IsTable(tcTableName)
>>    *** What is the function?
>>Endpr
>>
>>
>>What is the best way of telling that Table1 is "TABLE" and Table2 is "CURSOR"
>
>
>(1)
>IsTable = !empty(cursorgetprop('DataBase', m._alias)) and inlist(Cursorgetprop('SourceType', m._alias), DB_SRCTABLE)
>
>(2)
>IsView =  !empty(cursorgetprop('DataBase', m._alias)) and !inlist(Cursorgetprop('SourceType', m._alias), DB_SRCTABLE)
>
>(3) otherwise
>IsCursor
>
>
>ps: justext(dbf()) returns TMP for both a cursor and a view
>
>
>&& excerpt form foxpro.h
>*-- Source Types for CursorGetProp()
>#DEFINE DB_SRCLOCALVIEW         1
>#DEFINE DB_SRCREMOTEVIEW        2
>#DEFINE DB_SRCTABLE             3
>
The only problems here is for Free tables. They also returns 3 for CURSORGETPROP("SourceName",Alias).
Maybe JUSTEXT(CURSORGETPROP("SourceName", m._alias)) == [DBF] && table?
NOT TESTED AT ALL!!!
CREATE TABLE Test FREE (Fld1 I)
USE
SELECT * FROM Test INTO CURSOR aaaa

? CURSORGETPROP("SourceType",[aaaa])
? empty(cursorgetprop('DataBase', [aaaa]))

? CURSORGETPROP("SourceType",[Test])
? empty(cursorgetprop('DataBase', [Test]))
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform