Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Visual FoxPro

From Wikipedia, the free encyclopedia
Programming language
Visual FoxPro
Visual FoxPro v9 running onWindows XP
DeveloperMicrosoft
Final release
v9.0 SP2[1] / October 16, 2007; 18 years ago (2007-10-16)[2]
Operating systemWindows 2000,Windows XP, andWindows Server 2003[3]
PlatformIA-32[4]
Available inIDE: English, German, Spanish
Runtime: Above plus French, Chinese, Russian, Czech, Korean
TypeIntegrated development environment,programming language
LicenseCommercialproprietary software
Websitemsdn.microsoft.com/vfoxpro

Visual FoxPro is aprogramming language that was developed byMicrosoft. It is adata-centric andprocedural programming language withobject-oriented programming (OOP) features.

It was derived fromFoxPro (which was itself descended from FoxBASE) which was developed by Fox Software beginning in 1984. Fox Technologies merged with Microsoft in 1992, after which the software acquired further features and the prefix "Visual".[5]FoxPro 2.6 worked onMac OS,DOS,Windows, andUnix.

Visual FoxPro 3.0, the first "Visual" version, reduced platform support to only Mac[6] and Windows, and later versions 5, 6, 7, 8 and 9 were Windows-only. The current version of Visual FoxPro isCOM-based and Microsoft has stated that they do not intend to create aMicrosoft .NET version.[citation needed]

Version 9.0, released in December 2004 and updated in October 2007 with the SP2 patch, was the final version of the product. Support ended in January 2010 and extended support in January 2015.[7]

History

[edit]
See also:dBase

Visual FoxPro originated as a member of the class of languages commonly referred to as "xBase" languages, which have syntax based on thedBase programming language. Other members of the xBase language family includeClipper and Recital (database).

Visual FoxPro, commonly abbreviated as VFP, is tightly integrated with its own relational database engine, which extends FoxPro's xBase capabilities to supportSQL query and data manipulation. Unlike mostdatabase management systems, Visual FoxPro is a full-featured,dynamic programming language that does not require the use of an additional general-purpose programming environment. It can be used to write not just traditional "fat client" applications, but alsomiddleware andweb applications.

In late 2002, it was demonstrated that Visual FoxPro can run onLinux under theWine Windows compatibility suite. In 2003, this led to complaints by Microsoft: it was claimed that the deployment of runtime FoxPro code on non-Windows machines violates theEnd User License Agreement.[8]

Visual FoxPro had a rapid rise and fall in popularity as measured by theTIOBE Programming Community Index.[9] In December 2005, VFP broke into the top 20 for the first time. In June 2006 it peaked at position 12, making it (at the time) a "B" language. As of May 2025[update], Visual FoxPro holds position 29 on the TIOBE index.[10]

In March 2007, Microsoft announced that there would be no VFP 10,[11] thus making VFP9 (released to manufacturing on December 17, 2004) the last commercial VFP release from Microsoft. Service Pack 2 for Microsoft Visual FoxPro 9.0 was released on October 16, 2007.[12] The support of Version 9 ended on January 13, 2015.[7]

At the time of the end of life announcement, work on the next release codenamed Sedna (named after arecently discovered dwarf planet) which was built on top of the VFP9 codebase had already begun. "Sedna" is a set of add-ons to VFP 9.0 of xBase components to support a number of interoperability scenarios with various Microsoft technologies includingSQL Server 2005,.NET Framework, Windows Vista, Office 2007, Windows Search andTeam Foundation Server (TFS). Microsoft released Sedna under theShared source license on theCodePlex site. Microsoft has clarified that the VFP core will still remain closed source. Sedna was released on January 25, 2008.[13] As of March 2008, all xBase components of the VFP 9 SP2 (including Sedna) were available for community-development on CodePlex.

In late March 2007 agrassroots campaign was started by the Spanish-speaking FoxPro community at MásFoxPro[14] ("MoreFoxPro" inEnglish) to sign a petition to Microsoft to continue updating Visual FoxPro or release it to the community asopen-source. On April 3, 2007, the movement was noted by the technical press.[15]

On April 3, 2007, Microsoft responded to the petition with this statement from Alan Griver:[15]

"We're very aware of the FoxPro community and that played a large part in what we announced on March 13th. It's never an easy decision to announce that we're not going to release another version of a product and it's one that we consider very carefully.

"We're not announcing the end of FoxPro: Obviously, FoxPro applications will continue to work. By some of our internal estimates, there are more applications running in FoxPro 2.6 than there are in VFP and FoxPro 2.6 hasn't been supported in many years. Visual FoxPro 9 will be supported by Microsoft through 2015.

"For Microsoft to continue to evolve the FoxPro base, we would need to look at creating a 64-bit development environment and that would involve an almost complete rewrite of the core product. We've also invested in creating a scalable database with SQL Server, including the freely available SQL Server Express Edition. As far as forming a partnership with a third-party is concerned, we've heard from a number of large FoxPro customers that this would make it impossible for them to continue to use FoxPro since it would no longer be from an approved vendor. We felt that putting the environment into open source onCodePlex, which balances the needs of both the community and the large customers, was the best path forward."

Version timeline

[edit]

All versions listed are for Windows.[16]

VersionRelease date
Visual FoxPro 3.0June 1995
Visual FoxPro 5.0October 1996
Visual FoxPro 5.0aOctober 1997
Visual FoxPro 6.018 May 1998
Visual FoxPro 7.027 June 2001
Visual FoxPro 8.01 February 2003
Visual FoxPro 8.0 Service Pack 17 October 2003
Visual FoxPro 920 December 2004
Visual FoxPro 9 Service Pack 18 December 2005
Visual FoxPro 9 Service Pack 216 October 2007

Code samples

[edit]

The FoxPro language contains commands quite similar to other programming languages such as BASIC.

Some basic syntax samples:

FOR i = 1 to 10x = x + 6.5NEXT&& Instead of "NEXT" can also use "ENDFOR"IF i = 25i = i + 1ELSEi = i + 3ENDIFx = 1DO WHILE x < 50x =  x + 1ENDDOx = 1DO WHILE.T.x = x + 1IF x < 50LOOPELSEEXITENDIFENDDOnMonth =MONTH(DATE())DO CASECASE nMonth <= 3MESSAGEBOX("Q1")CASE nMonth <= 6MESSAGEBOX("Q2")CASE nMonth <= 9MESSAGEBOX("Q3")OTHERWISEMESSAGEBOX("Q4")ENDCASEFOR EACH oControl INTHISFORM.ControlsMESSAGEBOX(oControl.Name)ENDFORf = Factorial(10)FUNCTION Factorial(n)LOCAL i, rr = 1FOR i = n TO 1 STEP -1r = r * iNEXT&& Can also use "ENDFOR" here instead of "NEXT"RETURN rENDFUNC

Hello World examples:

* Output at the current location ?"Hello World"* Output at a specified location @ 1,1 SAY"Hello World"* Output in a separate window, cleared on inputWAIT WINDOW"Hello World"* Output in a standard dialog box, cleared on OKMESSAGEBOX("Hello World")

Object

[edit]
Output of theHello World program.
* Output in a defined windowloForm=CREATEOBJECT("HiForm")loForm.Show(1)DEFINECLASSHiFormASFormAutoCenter=.T.Caption="Hello, World"ADDOBJECTlblHiasLabel;WITHCaption="Hello, World!"ENDDEFINE
loMine =CREATEOBJECT("MyClass")? loMine.cProp1&& This will work. (Double-ampersand marks an end-of-line comment)? loMine.cProp2&& Program Error: Property CPROP2 is not found because it's hidden externally.? loMine.MyMethod1()&& This will work.? loMine.MyMethod2()&& Program Error: Property MYMETHOD2 is not found because it's hidden externally.DEFINE CLASS MyClass ASCustomcProp1 ="My Property"&& This is a public propertyHIDDEN cProp2&& This is a private (hidden) propertydProp3 = {}&& Another public propertyPROCEDURE Init()&& Class constructorThis.cProp2 ="This is a hidden property."PROCEDURE dProp3_Access&& Property GetterRETURNDATE()PROCEDURE dProp3_Assign(vNewVal)&& Property Setter uses the "_assign" tag on the property nameIFVARTYPE(vNewVal) ="D"THIS.dProp3 = vNewValENDIFPROCEDURE MyMethod1()* This is a public method, calling a hidden method that returns* the value of a hidden property.RETURNThis.MyMethod2()HIDDEN PROCEDURE MyMethod2()&& This is a private (hidden) methodRETURNThis.cProp2ENDDEFINE
  • VFP has an extensive library of predefined classes and visual objects which are accessed in theIDE by a Property Sheet (includingMethods),[17] so code such as the above defining classes and objects are only needed for special purposes and theframework of large systems.

Data handling

[edit]

The language also has extensive database manipulation and indexing commands.The "help" index of commands in VFP 9 has several hundred commands and functions described. The examples below show how to code the creation and indexing of tables, however VFP has table and database builder screens which create the tables and indexes without making you write code.

Output of theData handling program.
* Create a tableCREATE TABLE randData (iData I)* Populate with random data using xBase and SQL DML commandsFOR i = 1 TO 50APPEND BLANKREPLACE iData WITH (RAND() * 100)INSERT INTO randData (iData) VALUES (RAND() * 100)ENDFOR* Place a structural index on the dataINDEX ON iData TAG iDataCLOSE DATA&& Do not close open libraries etc* Display ordered data using xBase-style commandsUSE randDataSET ORDER TO iDataLOCATE&& In place of GO TOP. Enforces use of index to find TOPLIST NEXT 10&& First 10GO BOTTOMSKIP -10LIST REST&& Last 10CLOSE DATA* Browse ordered data using SQL DML commandsSELECT *;FROM randData;ORDER BY iData DESCENDING

ODBC access using SQL passthrough

[edit]
PRIVATE cAuthorID, cAuthorName&& Private variables supplant any previous global or private variable of the same nameLOCAL nHnd, nResult&& Local variables are visible only here* Connect to an ODBC data sourcenHnd =SQLCONNECT ("ODBCDSN","user","pwd")* Enter a loop so we can exit to the close connection code if there's an errorDO WHILE.T.* Execute a SQL commandnResult =SQLEXEC (nHnd,"USE master")IF nResult < 0MESSAGEBOX ("MASTER database does not exist!")EXIT&& To close the connectionENDIF* Retrieve data from the remote server and stores it in a local data cursornResult =SQLEXEC (nHnd,"SELECT * FROM authors","QAUTHORS")IF nResult < 0MESSAGEBOX ("Unable to execute remote SQL SELECT command!")EXIT&& To close the connectionENDIF* Update a record in a remote table using parameterscAuthorID     ="1001"cAuthorName   ="New name"nResult       =SQLEXEC (nHnd,"UPDATE authors SET auth_name = ?cAuthorName WHERE auth_id = ?cAuthorID")IF nResult < 0MESSAGEBOX ("Unable to execute remote SQL UPDATE command!")EXIT&& To close the connectionENDIF* If we get here, we have retrieved everything successfullyEXIT&& Exit unconditionallyENDDO* Close the connectionSQLDISCONNECT(nHnd)

See also

[edit]

References

[edit]
  1. ^"Visual FoxPro 9.0 Updates".Visual FoxPro Developer Center. Microsoft. Retrieved7 June 2013.
  2. ^"Download Microsoft Visual FoxPro 9.0 Service Pack 2.0".Download Center. Microsoft. October 16, 2007. Retrieved7 June 2013.
  3. ^"System Requirements".Visual FoxPro Developer Center. Microsoft. Retrieved7 June 2013.
  4. ^"Frequently Asked Questions".Visual FoxPro Developer Center. Microsoft. Retrieved7 June 2013.
  5. ^Pollack, Andrew (25 March 1992)."Microsoft to Try New Market By Acquiring Fox Software".The New York Times. p. D1.
  6. ^Microsoft Visual FoxPro 3.0 for Power Macintosh Now Available, July 25, 1996, news.microsoft.com
  7. ^ab"Microsoft Visual FoxPro 9.0".learn.microsoft.com.
  8. ^Visual FoxPro for Linux: A Violation of the EULA?, May 13, 2003, By Ed Leafe, Linux Journal
  9. ^Tiobe Index History for FoxPro
  10. ^"Index | TIOBE - the Software Quality Company".
  11. ^A Message to the Community
  12. ^Microsoft Visual FoxPro 9.0 Service Pack 2.0
  13. ^Microsoft SEDNA download
  14. ^Mas FoxPro - Visual FoxPro Wiki
  15. ^abDevelopers petition Microsoft to reconsider FoxPro phase out Posted by Mary Jo Foley (April 3rd, 2007) - All about Microsoft - ZDNet.com
  16. ^The History of FoxPro
  17. ^"Visual FoxPro Development Productivity Tools". Microsoft. Retrieved20 December 2014.

External links

[edit]

Microsoft pages

[edit]

Other pages

[edit]
Implementations
IDE
Microsoft development tools
Development
environments
Visual Studio
Others
Languages
APIs and
frameworks
Native
.NET
Device drivers
Database
SQL Server
SQL services
Other
Source control
Testing and
debugging
Delivery
Retrieved from "https://en.wikipedia.org/w/index.php?title=Visual_FoxPro&oldid=1318403044"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp