Visual FoxPro
Encyclopedia
Visual FoxPro is a data-centric
Database-centric architecture
Database-centric architecture or data-centric architecture has several distinct meanings, generally relating to software architectures in which databases play a crucial role. Often this description is meant to contrast the design to an alternative approach...

 object-oriented and procedural
Procedural programming
Procedural programming can sometimes be used as a synonym for imperative programming , but can also refer to a programming paradigm, derived from structured programming, based upon the concept of the procedure call...

 programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 produced by Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

. It is derived from FoxPro
FoxPro 2
FoxPro is a text-based procedurally-oriented programming language and DBMS, originally published by Fox Software and later by Microsoft, for MS-DOS, MS Windows, Apple Macintosh, and UNIX....

 (originally known as 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". The last version of FoxPro (2.6)
FoxPro 2
FoxPro is a text-based procedurally-oriented programming language and DBMS, originally published by Fox Software and later by Microsoft, for MS-DOS, MS Windows, Apple Macintosh, and UNIX....

 worked under Mac OS
Mac OS
Mac OS is a series of graphical user interface-based operating systems developed by Apple Inc. for their Macintosh line of computer systems. The Macintosh user experience is credited with popularizing the graphical user interface...

, DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

, Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

, and Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

: Visual FoxPro 3.0, the first "Visual" version, reduced platform support to only Mac and Windows, and later versions were Windows-only. The current version of Visual FoxPro is COM
Component Object Model
Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

-based and Microsoft has stated that they do not intend to create a Microsoft .NET version.

FoxPro originated as a member of the class of languages commonly referred to as "xBase"
XBase
xBase is the generic term for all programming languages that derive from the original dBASE programming language and database formats. These are sometimes informally known as dBASE "clones"...

 languages, which have syntax based on the dBase
DBASE
dBase II was the first widely used database management system for microcomputers. It was originally published by Ashton-Tate for CP/M, and later on ported to the Apple II and IBM PC under DOS...

 programming language. Other members of the xBase language family include Clipper
Clipper programming language
Clipper is a computer programming language that is used to create software programs that originally operated primarily under DOS. Although it is a powerful general-purpose programming language, it was primarily used to create database/business programs....

 and Recital. (A history of the early years of xBase can be found in the dBase article.)

Visual FoxPro, commonly abbreviated as VFP, is tightly integrated with its own relational database engine, which extends FoxPro's xBase capabilities to support SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....

 query and data manipulation. Unlike most database management systems, Visual FoxPro is a full-featured, dynamic programming language
Dynamic programming language
Dynamic programming language is a term used broadly in computer science to describe a class of high-level programming languages that execute at runtime many common behaviors that other languages might perform during compilation, if at all...

 that does not require the use of an additional general-purpose programming environment. It can be used to write not just traditional "fat client
Fat client
A fat client is a computer in client–server architecture or networks that typically provides rich functionality independent of the central server...

" applications, but also middleware
Middleware
Middleware is computer software that connects software components or people and their applications. The software consists of a set of services that allows multiple processes running on one or more machines to interact...

 and web application
Web application
A web application is an application that is accessed over a network such as the Internet or an intranet. The term may also mean a computer software application that is coded in a browser-supported language and reliant on a common web browser to render the application executable.Web applications are...

s.

Recent history

In late 2002, it was demonstrated that Visual FoxPro can run on Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 under the Wine
Wine (software)
Wine is a free software application that aims to allow computer programs written for Microsoft Windows to run on Unix-like operating systems. Wine also provides a software library, known as Winelib, against which developers can compile Windows applications to help port them to Unix-like...

 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 the End User License Agreement.

In December 2005, VFP broke into the top 20 on Tiobe index
Tiobe index
TIOBE programming community index is an ordered list of programming languages, sorted by the frequency of web search using the name of the language as the keyword. The index covers searches in Google, Google Blogs, MSN, Yahoo!, Wikipedia and YouTube. The index is updated once a month. The current...

 for the first time. In March 2007 it was at position 19, making it a "B" language. As of August, 2010, VFP (combined with xBase) is at position 25.

In March 2007, Microsoft announced that there will be no VFP 10, thus making VFP9 (released to manufacturing on December 17, 2004) the last commercial VFP release from Microsoft. The support of Version 9 is ongoing with service packs that were released December 8, 2005 and October 11, 2007.

At the time of the end of life announcement, work on the next release codenamed Sedna (named after a recently discovered dwarf planet
90377 Sedna
90377 Sedna is a trans-Neptunian object discovered in 2003, which was about three times as far from the Sun as Neptune. For most of its orbit it is even further from the Sun, with its aphelion estimated at 960 astronomical units , making it one of the most distant known objects in the Solar System...

) 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 including SQL Server
Microsoft SQL Server
Microsoft SQL Server is a relational database server, developed by Microsoft: It is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network...

 2005, .NET Framework
.NET Framework
The .NET Framework is a software framework that runs primarily on Microsoft Windows. It includes a large library and supports several programming languages which allows language interoperability...

, Windows Vista, Office 2007, Windows Search and Team Foundation Server
Team Foundation Server
Team Foundation Server is a Microsoft product offering source control, data collection, reporting, and project tracking, and is intended for collaborative software development projects...

 (TFS). Microsoft released Sedna under the Shared source
Shared source
Shared source is an umbrella term covering some of Microsoft's legal mechanisms for software source code distribution. Microsoft's Shared Source Initiative, launched in May 2001, includes a spectrum of technologies and licenses...

 license on the CodePlex site. Microsoft has clarified that the VFP core will still remain closed source. Sedna was released on January 25, 2008. 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 a grassroots
Grassroots
A grassroots movement is one driven by the politics of a community. The term implies that the creation of the movement and the group supporting it are natural and spontaneous, highlighting the differences between this and a movement that is orchestrated by traditional power structures...

 campaign was started by the Spanish-speaking FoxPro community at MasFoxPro ("MoreFoxPro" in English
English language
English is a West Germanic language that arose in the Anglo-Saxon kingdoms of England and spread into what was to become south-east Scotland under the influence of the Anglian medieval kingdom of Northumbria...

) to sign a petition to Microsoft to continue updating Visual FoxPro or release it to the community as Open Source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

. On April 3, 2007 the movement was noted by the technical press

Also on April 3, 2007 Microsoft responded to the petitioner's requests with this statement from Alan Griver:


"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 on CodePlex, which balances the needs of both the community and the large customers, was the best path forward."


Operating system compatibility

Supported Windows Versions
Version VFP 3.0 VFP 5.0 VFP 6.0 VFP 7.0 VFP 8.0 VFP 9.0
Windows 3.x Yes No No No No No
Windows NT 4.0 Yes Yes Yes Yes No No
Windows 95 Yes Yes Yes Runtime only No No
Windows 98 Yes Yes Yes Yes Runtime only Runtime only
Windows Me Yes Yes Yes Yes Runtime only Runtime only
Windows 2000 Yes Yes Yes Yes Yes Yes
Windows XP Yes Yes Yes Yes Yes Yes
Windows Server 2003 ? ? Yes Yes Yes Yes
Windows Vista Compatibility Mode Yes Yes Yes Yes Yes
Windows 7 Yes No Yes Yes Yes Yes

Information on executable files

Version VERSION returns EXE Size EXE Date DLL Size DLL Name
VFP 9 SP2 with Hotfixes Visual FoxPro 09.00.0000.7423 for Windows 5,648 kb April 3, 2009 4,624 kb VFP9R.DLL
VFP 9 SP2 Visual FoxPro 09.00.0000.5721 for Windows 5,648 kb September 21, 2007 4,624 kb VFP9R.DLL
VFP 9 Visual FoxPro 09.00.0000.2412 for Windows 5,620 kb December 13, 2004 4,600 kb VFP9R.DLL
VFP 8 Visual FoxPro 08.00.0000.3117 for Windows 5,236 kb September 25, 2003 4,200 kb VFP8R.DLL
VFP 7 Visual FoxPro 07.00.0000.9465 for Windows 4,260 kb January 4, 2002 3,344 kb VFP7R.DLL
VFP 6 Visual FoxPro 06.00.8961.00 for Windows 4,091 kb August 18, 2000 3,295 kb VFP6R.DLL
VFP 5 Visual FoxPro 5.0.0.415 for Windows 4,065 kb January 24, 1997 3,148 kb VFP500.DLL
VFP 3 Visual FoxPro 03.00.00.0711 for Windows 4,374 kb December 16, 1995 3,657 kb VFP300.ESL
FPW 2.6a FoxPro 2.6a for Windows 2,444 kb September 28, 1994 2,946 kb FOXW2600.ESL

Code samples

The FoxPro language contains commands quite similar to other programming languages such as Basic.
Loops include do, if, while, for, else commands in a usage easily understood by anyone familiar with other programming languages.
Commands take the form of "command" and "endcommand"

Some basic syntax samples:

FOR i = 1 to 10
x = x + 6.5
ENDFOR

IF i = 25
i = i + 1
ELSE
i = i + 3
ENDIF

x = 1
DO WHILE x < 50
x = x + 1
ENDDO


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.

Hello World example:

MESSAGEBOX("Hello World")

Object


loForm = CREATEOBJECT("HiForm")
loForm.Show(1)

DEFINE CLASS HiForm AS Form
AutoCenter = .T.
Caption = "Hello, World"

ADD OBJECT lblHi as Label WITH ;
Caption = "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.

? loMine.MyMethod1 && This will work.
? loMine.MyMethod2 && Program Error: Property MYMETHOD2 is not found.

DEFINE CLASS MyClass AS Custom
cProp1 = "My Property" && This is a public property
HIDDEN cProp2 && This is a private (hidden) property

PROCEDURE Init && Class constructor
This.cProp2 = "This is a hidden property."
ENDPROC

PROCEDURE MyMethod1
* This is a public method, calling a hidden method that returns
* the value of a hidden property.
RETURN This.MyMethod2
ENDPROC

HIDDEN PROCEDURE MyMethod2 && This is a private (hidden) method
RETURN This.cProp2
ENDPROC
ENDDEFINE

Data handling


&& Create a table
CREATE TABLE randData (iData I)

&& Populate with random data using xBase and SQL DML commands
FOR i = 1 TO 50
APPEND BLANK
REPLACE iData WITH (RAND * 100)

INSERT INTO randData (iData) VALUES (RAND * 100)
ENDFOR

&& Place a structural index on the data
INDEX ON iData TAG iData
CLOSE ALL

&& Display ordered data using xBase-style commands
USE randData
SET ORDER TO iData
GO TOP
LIST NEXT 10 && First 10
GO BOTTOM
SKIP -10
LIST REST && Last 10
CLOSE ALL

&& Browse ordered data using SQL DML commands
SELECT * ;
FROM randData ;
ORDER BY iData DESCENDING

ODBC access using SQL passthrough


&& Connect to an ODBC data source
LOCAL nHnd
nHnd = SQLCONNECT ("ODBCDSN", "user", "pwd")

&& Execute a SQL command
LOCAL nResult
nResult = SQLEXEC (nHnd, "USE master")
IF nResult < 0
MESSAGEBOX ("MASTER database does not exist!")
RETURN
ENDIF

&& Retrieve data from the remote server and stores it in
&& a local data cursor
nResult = SQLEXEC (nHnd, "SELECT * FROM authors", "QAUTHORS")

&& Update a record in a remote table using parameters
PRIVATE cAuthorID, cAuthorName
cAuthorID = "1001"
cAuthorName = "New name"
nResult = SQLEXEC (nHnd, "UPDATE authors SET auth_name = ?cAuthorName WHERE auth_id = ?cAuthorID")

&& Close the connection
SQLDISCONNECT(nHnd)

Beta code names

  • VFP 3 - Taz
    Tasmanian Devil (Looney Tunes)
    The Tasmanian Devil, often referred to as Taz, is an animated cartoon character featured in the Warner Bros. Looney Tunes series of cartoons. The character appeared in only five shorts before Warner Bros...

  • VFP 5 - RoadRunner
  • VFP 6 - Tahoe
    Lake Tahoe
    Lake Tahoe is a large freshwater lake in the Sierra Nevada of the United States. At a surface elevation of , it is located along the border between California and Nevada, west of Carson City. Lake Tahoe is the largest alpine lake in North America. Its depth is , making it the USA's second-deepest...

  • VFP 7 - Sedona
    Sedona, Arizona
    Sedona is a city that straddles the county line between Coconino and Yavapai counties in the northern Verde Valley region of the U.S. state of Arizona...

  • VFP 8 - Toledo
    Toledo, Ohio
    Toledo is the fourth most populous city in the U.S. state of Ohio and is the county seat of Lucas County. Toledo is in northwest Ohio, on the western end of Lake Erie, and borders the State of Michigan...

  • VFP 9 - Europa
    Europa (moon)
    Europa Slightly smaller than Earth's Moon, Europa is primarily made of silicate rock and probably has an iron core. It has a tenuous atmosphere composed primarily of oxygen. Its surface is composed of ice and is one of the smoothest in the Solar System. This surface is striated by cracks and...

  • VFP Next - Sedna
    90377 Sedna
    90377 Sedna is a trans-Neptunian object discovered in 2003, which was about three times as far from the Sun as Neptune. For most of its orbit it is even further from the Sun, with its aphelion estimated at 960 astronomical units , making it one of the most distant known objects in the Solar System...


Microsoft pages


Other pages

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK