13.3.3 database forms expert and Database operating table (DBD)
Delphi provides a development tool for users to develop a simple database application called database form Expert, which can be found under the Delphi System Menu Tool menu.
A database forms expert can automatically generate many of the tasks that must be done in a simple database application, and it can generate an application form based on a single database table or an application form that is based on a main-detail database table, and the tasks that a database forms expert can automatically accomplish are as follows:
To place a database part into a form (Tdatasource part)
Establishing a connection to a dataset part (Ttable, tquery) and a database on disk
Establishes a connection between a data source (Tdatasource) and a Data control part, a data source (Tdatasource) and a data access part (Ttable, tquery)
Write SQL statements for the tquery part
To define the tab order for a part in a form
Database operating station (DBD) is a database maintenance and data definition tool that programmers can use to query, connect, build, refactor, index, modify, and copy database tables, including Pà€aradox and dBASE files and database tables based on SQL language. And when using DBD to manipulate Paradox or dBASE tables, users do not have to have a Paradox or dBASE database management system. DBD can also copy a format of data and data dictionaries into another format, for example, you can copy a dBASE table to a database on a remote SQL Server. For a detailed description of the DBD, see "Database operating Platform (DBD) use."
13.4 Delphi Database application Development method and procedure
13.4.1 Overview
Using Derphi to open a database application, although similar to the development of other applications, there are some important differences that we must pay attention to.
With Delphi's client/server capabilities, programmers can develop client/server mode applications on a local database or on a remote database server. One of the powerful features of Delphi is the ability to easily modify applications based on a local desktop database system into a client/server model. A Delphi database application accesses a local database or a database on a remote SQL database server, which is completely transparent to the end user. That is, the physical location of the database is transparent to the end user, and the user interface does not have to change when the physical location of the database changes.
Because the database application relies on the database that it accesses, it is necessary to establish a sophisticated database, the data definition, before developing the database application, and the data definition should be part of the development database application, but it is beyond the scope of the book, the content of the data definition, Please refer to the relational database design information. When we use Derphi to develop a database application, there are four possible scenarios.
1, the database does not exist or must be redefined. Use DBD to define Paradox or dBASE database tables for the local database. Use the server development tools provided by Delphi, such as Windows isql or DBD, to define databases on local or remote SQL database servers.
2, the database in the Desktop database system or LAN (such as Paradox or dBASE), and BDE, databases and applications on the same machine, this is a typical stand-alone application.
3, the database is in the desktop database system, but the user wants to change it to the SQL database server, this situation we discussed in detail in Appendix C.
4, the database is in the SQL database server, and the application will go to the SQL database server to access the database, this is a standard client/server application.
For more information on developing client/server applications, see the "Client/server Applications" chapter.
Steps for developing a 13.4.2 database application
The ultimate goal of a database application is to provide users with a software product that meets their long-term needs, so one of the keys to successfully developing a database application is to define user requirements in detail and then develop them around the user's needs, with the following three basic steps for general development of database applications.
System Design
System implementation
System operation and Maintenance
In this three basic step, both include database development and application interface development two broad categories of tasks, for a client/server mode of application, database and application interface is more distinct, because they run on different platforms, and the operating systems are often not the same, such as (a server in a UNIX environment and a client of a Windows environment).
1. System Design
The system design phase should be based on the needs of users, clearly describe the database (database server side) and the application interface (client side) Implementation of the functions, that is, determine which features are implemented by the server side, which features by the client side, for client/server applications, Many features can be implemented on both the server side and the client, such as a complex mathematical transformation function that can be implemented either by the client's application or by the server-side storage process. The partitioning of server and client application functionality often depends on the hardware environment in which the application is running, for example: If the client is a low-end PC and the server side is a high-end workstation, then a large number of computations are ideal for the server to complete.
2. System realization
The main task of the system implementation phase is to use the tools and components provided by Delphi and Pascal language to realize the design phase of the system and debug it.
In the system implementation phase, it is best to use a database backup database, this backup database with the original database has the same structure, but the database is only a part of the original database, so not to the original database development application program, This is because considering that an application that is not well debugged can corrupt the data in the database or hinder the normal operation of the database.
If your application is based on a remote SQL database server, there are two ways to do this during the system implementation phase:
On a local interbase server, use the database backup database for development and debugging
On a remote server, use the database backup database for development and debugging
The advantage of the first approach is that it is independent of the server and does not affect other operations of the server, and does not consume the resources of the server without increasing the burden on the network. Its disadvantage is that the developed applications can only be used and debugged on standard SQL Servers. The second method can make the program designer directly feel the characteristics of the server, but it consumes network and server resources in the debugging phase, this method has certain danger, the error in the program may cause the server paralysis.