Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Indexes on views
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00069290
Message ID:
00069340
Vues:
39
Nancy, there are several ways to approach indexing a view. VFP is so fast at indexing that you can probably get away with doing it on the fly every time the user asks for a different sort order. For example, you can implement a predefined array of code fragments that you would use for generating an INDEX on &XXX command (the array would hold the possible XXX's). The index into this array can be derived via a users choice from a picklist that displays the possible sort orders. You can then generate the IDX file on the fly with an INDEX on & XXX TO IDXFILENAME command. You can use the same file name over and over. You would first want to be sure that the index file is not currently in use, then you delete it if it already exists, then execute the INDEX command.

Remember this trick for making a read-only cursor into read-write:
USE (DBF("ReadOnlyCursor")) Again in 0 Alias RWCursor
Use In ReadOnlyCursor
Select RWCursor
With this approach, you can create/modify/delete as many CDX entries as you need to for the lifetime of the cursor.

You might also find the following article interesting. The methods described basically give you more direct control over your C/S interface with VFP. This is my preferred way to implement C/S because I can choose to use either ANSI SQL or a more optimized, platform-specific version like Transact-SQL.

KB article ID: Q138094


"How to Create Updatable Views by Using SQL Passthrough"


Here's the first paragraph:

Remote views provide the most common and easiest way to gain access to and update remote data. You can also use SQL passthrough technology to send SQL statements directly to a server. By default, a SQL passthrough query always returns a non-updatable snapshot of remote data, which is stored in an active view cursor. You can make the cursor updatable by setting properties with the CURSORSETPROP() function. An updatable remote view, in contrast, usually doesn't require that you set properties before you can update remote data.

>I am using views to ease later transition to SQL server. On my table maintenance, I have a very nice interface for a find that works very well for tables but relies on indexes to switch between various orders. Can you confirm that there is no way to have an index on a view?
>I have tried requerying the view as the order changes. This seems slower than I would like. Also, I am writing this as generic code in a class, so am using macros in the SQL statement. If I then try to browse that view from the DBC, my macros are no longer defined. Also, under this configuration, all of my views are only valid when the related form is running (and macros are defined) -should I be creating the views on the fly and then deleting them when the form is no longer active?

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform