Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create PRG from Cursors or Tables
Message
 
 
À
12/07/2007 09:01:08
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01239561
Message ID:
01239679
Vues:
14
This message has been marked as a message which has helped to the initial question of the thread.
>>>>Did you read this thread?
>>>
>>>Yep.
>>
>>It should had give you all you needed with may be a little tweaking.
>
>Doesn't matter as I did it manually. I didn't see anything that was incredibly useful in that thread for what I wanted to do. The solution (starred) was about creating a database of the list stru, which was nice, but not for what I was trying to do. I appreciate your help, but it's ok if I didn't find that thread very beneficial. Isn't it?

Ok, I made some minor changes to include indexes. You now can call it
FieldsToString(.t.,,,.t.) to include indexes
FUNCTION FieldsToString
LPARAMETERS tlAddTypes, tlAddAlias, tlLower, tlAddIndexes

LOCAL lcStr, lni, lnFields, laFields[1], lcType, lcField
lnFields = AFIELDS(laFields)
lcStr = ""

FOR lni = 1 TO m.lnFields
	lcType = laFields[m.lnI,2]
	IF m.tlLower
	  lcField = LOWER(laFields[m.lnI,1])
	ELSE
	   lcField = LOWER(LEFT(laFields[m.lnI, 1],1)) + ;
		PROPER(SUBSTR(laFields[m.lnI, 1],2)) 
	ENDIF
	
	lcStr = m.lcStr + IIF(m.tlAddAlias,PROPER(ALIAS()) + ".", "") + ;
	    m.lcField + ;	
		IIF(m.tlAddTypes, " " + m.lcType + ;
		IIF(NOT INLIST(m.lcType, "D","T","I","G","M","Y"), "(" + TRANSFORM(laFields[m.lnI,3]) + ;
		IIF(laFields[m.lnI,4] > 0, ", " + TRANSFORM(laFields[m.lnI,4]),"") + ")","") + ;
		IIF(laFields[m.lnI,5], " NULL", " NOT NULL"),"") + ", ; " + CRLF
NEXT
lcStr = LEFT(m.lcStr, RAT(",", m.lcStr) - 1 ) + CRLF
IF m.tlAddIndexes
   LOCAL lnTags, laTags[1]
   lnTags = ATAGINFO(laTags)
   FOR lnI = 1 TO m.lnTags
       lcStr = m.lcStr + CRLF +  'INDEX ON ' + ;
       laTags[m.lnI,3] + ' TAG ' + laTags[m.lnI,1] + ;
       IIF(not EMPTY(laTags[m.lnI,4]), ' FOR ' + laTags[m.lnI,4],'') + ;
       IIF(INLIST(laTags[m.lnI,2],'CANDIDATE','UNIQUE'), ' ' + laTags[m.lnI,2], '') && doubt anyone will create desc index
   NEXT   
   
ENDIF

_CLIPTEXT = m.lcStr
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform