Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I drop it?
Message
De
09/12/2013 06:15:36
 
 
À
06/12/2013 12:08:20
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01588891
Message ID:
01589542
Vues:
78
>>>But actually the alter table issue is related to the way Fox operates the long field names. It requires a dbc to maintain them. As long as you don't want to change them, the names are held in some internal structure in memory and all is fine. If you want to change the structure and have long names, you need a dbc and a simple cursor doesn't belong to one, hence it's a no go.
>>
>>That was my guess as well (albeit uneducated). See my earlier messages to Gregory/Peter
>>Which feeds my reluctance to create local cursors with those elegant one line sql statements even more.
>>Before it was just defensive instinct, this puts some reasoning behind it :)
>
>The inelegant would come into play when creating those output cursors anyway, and prefer to see them in one place, so I have the full inventory of the fields in one place, not the "whatever the cursor was passed plus or minus a few columns that I change now". If renaming into c(10) names is a part of that, so be it, it will be something like
>
>
select SufficientlyLongName as slong1
>   ,   sufficientlyLongSurname as slongSur
>
>etc etc, and even so I'd have the single place where to look up the meaning of those names. Alter table is, IMO, something designed as a tool for the DBA, and I use it extensively when maintaining the structure of the tables. Tables, not cursors. If you feel you should change the structure of your cursor, something's wrong (IOW, not Dragan compatible :) with how you create the cursor.

I do not do this with my tables. I do it mostly for reporting or calculation purposes and Thanks God admin level possibilities are there!
Most times I would take all fields from one or more tables and then add more columns for various purposes. Like balances coming from other sources/objects, calculated values and such. Local cursor (in Srdjan's philosophy) is in many cases result sheet of multiple BOs returning their results then direct result of breath taking/mind boggling 100+ lines sql statement consisting of multiple wild joins, grouping, casts and what not. Hence flexibility of local cursor to be altered freely (and reliably) being of great importance.

>
>We aren't walking the same side of the street, but I can hear you and I don't have to upper("shout") so you hear me as well, the street is not so wide.

Admittedly way I voiced my reluctance on having long field names was more loud then it should have been, but it come
as reaction to pains I suffered as result of having to deal with them... FWIW, my experience tells me that short field names
(up to 10 char) and true local cursors (fox2x style created from struct array or table) gave me least problems (close to none).

>
>Here's the version of Frank Dietrich's intellisense script which I use whenever I have to make a select with more than a dozen fields, and need to change a few (delete lines, add lines, add aliases to fields):
>
*===========================================*
>*  FieldList Intellisense-Script            *
>*                                           *
>*  Copyright (c) 2002 All Rights Reserved.  *
>*  Frank Dietrich Datentechnik              *
>*  Leo-Baeck-Str. 22                        *
>*  14165 Berlin                             *
>*  PHONE :    +49-30-845 777-0              *
>*  FAX   :    +49-30-845 777-19             *
>*  CIS   :    100322,333                    *
>*  e-mail: frank.dietrich@dd-tech.de        *
>*  20.02.2002 v.1.0                         *
>*===========================================*
>
>*=======================================================*
>*  This Intellisense-script creates a comma-Delimited   *
>*  List of Fieldnames of any currently used Cursor.     *
>*  The list can contain no, real- (USER.NAME) or local  *
>*  aliases (A.NAME).                                    *
>*  Additionally an "AS"-clause can be added with the    *
>*  long field-Name (Caption) if the selected alias      *
>*  belongs to a database.                               *
>*=======================================================* 
>
>lparameters oFoxCode
>local lc_Alias, lc_Prefix, lc_List, ln_i, ln_WasSel
>local ll_LongName, lc_LongName, n
>
>lc_Alias = Inputbox("Select alias to get fields from?", "FieldList-Creator", alias())
>if empty(lc_Alias) or ! used(lc_Alias)
>	return oFoxcode.UserTyped
>endif
>		
>lc_List   = ""
>ln_WasSel = select()
>
>select (lc_Alias)
>
>n= fcount()
>for ln_i = 1 to n
>    	lc_List = lc_List +  space(8) + lower(field(ln_i) )
>    	if ln_i<> n
>		lc_List = lc_List + ",;"+chr(13)
>	endif
>endfor &&* ln_i = 1 to fcount()
>
>select (ln_WasSel)
>						
>oFoxCode.Valuetype =  "V"
>
>return lc_List
>
>I have versions of this with nvl(field, "") as field, without semicolons, with comma moved to precede the next line - which isn't too hard to add. It's just plain generated text anyway. So I just type "fieldlist" in an empty line, and I get a full list of fields. I only need to add Select before, and From... Into... where... after it.

I am interested in this! Will get in touch on this for further consultation :))
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform