Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CursorAdapter Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01008137
Message ID:
01008151
Vues:
21
>>I have the test code below. It works fine. It returns the data
>>I want in the format I want.
>>
>>Some questions:
>>
>>1) When the object oCursor is destroyed, the table closes. Any way
>>to make it persist?
>
>This makes sense to me as the lifetime of the CA should be the same as the cursor.

If the cursor object is left open, and it's SQL data, isn't this holding a
connection to the database? We will want to use disconnected data. It seems to me
that you would want to call this code in some generic format, only being used long
enough to return the desire data, and having it persistant would make this difficult.

>
>>
>>2) If the table can be persisted after the CA class is destroyed, can/how
>>are changes submitted back to the data source?
>>
>>3) How would you impliment this? Obviously the structure required for each call
>>to this code might be different. It seems inifficient to have to create a PRG
>>for each table I want ot access.
>
>IMO, a different CA is needed for each table.

First, in an application, there might be a hundred different calls to the same
table, each pulling different columns. Would you create a different class for each?
That could be alot of classes.

Second, what about dynamic queries? You never know exactly what data is needed and
the what the resulting cursor structure will be until the user submits a query.

>
>>
>>4) How would you use the CA in a multi tier environment? If I create a class
>>based on session, with this code inside it, the resulting cursor is then in a
>>different session. We don't use DBC's. All tables are free tables.
>
>The CA is only applicable in the data tier. It would do a CUSORTOXML() and send the data via XML to the Business objects, which will do an XMLTOCURSOR() is needed or pass the XML on to the UI, which will do an XMLTOCURSOR().
>
>Is there are reason you only use free tables? DBCs provide several advantages.

This is a VFP 8 app that is targeting Fox2x free tables used by another application.
We are in the processing of redeveloping that app in C#.net, but this app will need to
be upgraded to target the SQL data.



>
>
>>
>>Thanks!
>>
>>
>>
>>CLOSE DATABASES ALL
>>
>>LOCAL oCursor as CursorAdapter
>>LOCAL aErrors[1]
>>
>>USE d:\projects\testdata\smts\station
>>
>>oCursor = createobject("CursorAdapter")
>>
>>WITH oCursor
>>
>>.Alias = "MyStations"
>>.CursorSchema = "STName C(04), Afil C(20), Mkt C(20), Buyer C(2)"
>>.DataSourceType = "Native"
>>.SelectCmd = "SELECT StatName, Afiliate, Market, BInit FROM Station WHERE StatName = 'KTLA'"
>>.KeyFieldList = "STName"
>>.Tables = "Station"
>>.UpdatableFieldList = "STName, Afil, Mkt, Buyer"
>>.UpdateNameList = "STName Station.StatName, Afil Station.Afiliate, Mkt Station.Market,
>>                  Buyer Station.BInit"
>>
>>IF .CursorFill(.T.)
>>  BROWSE
>>  TABLEUPDATE(1)
>>ELSE
>>  AERROR(aErrors)
>>  MESSAGEBOX(aErrors[2],48,"Error Occured")
>>ENDIF
>>
>>ENDWITH
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform