13.1 Database System Overview
The database system provides us with a way to bring together information that is closely related to our work and life, and it also provides a way to store and maintain this information in a centralized location. The database system is mainly composed of three major parts: Database management System (DBMS: A program that specializes in organizing and managing data information), database applications (which enable us to acquire, display, and update data stored by the DBMS), a database (a collection of related data grouped together by a certain structure).
In general, DBMS and database applications reside on the same computer and run on the same computer, in many cases even in the same program, and most database systems used previously were designed in this way. However, with the development of DBMS technology, the current database system is developing to the client/server model. The client/server database separates the DBMS from the database application, which improves the processing power of the database system. The database application runs on one or more user workstations (clients) and communicates over the network with one or more DBMS running on another computer (the server).
The following are some concepts and references in the database system.
13.1.1 Database management System (DBMS)
Database management System (DBMS) is a program system which is used to describe, manage and maintain database, and is the core component of database system. It is based on the operating system, unified management and control of the database. Its main functions are:
1. Description database: Describes the logical structure of the database, storage structure, semantic information and confidentiality requirements.
2. Management database: Control the operation of the entire database system, control the user's concurrent access, verify the data security, confidentiality and integrity, perform data retrieval, insert, delete, modify, and other operations.
3. Maintain the database: control the initial data loading of the database, log the work log, monitor the database performance, modify the update database, organize the database, restore the failed database.
4. Data communication: Organization of the transmission of information.
There are four main types of DBMS: File management system, hierarchical database system, network database system and relational database system. Because the current relational database system is most widely used, we focus on the introduction of several concepts in relational database system.
relational databases (relational database): A relational database is made up of several tables. In Delphi, the database concept corresponding to the physical file is somewhat different. For the three database systems of dBASE, FoxPro, and Paradox, the database corresponds to a subdirectory, while other types such as Ms Access and Btrieve refer to a file. This is because the table for the former is a separate file, and the table of the latter is clustered in a database file.
Table: A table is a set of related data arranged in rows, like a table. For example, a class of all students in the final exam results, there is a table, each line corresponds to a student, in this line, including the student's number, name and the results of each course.
Fields (field): In a table, each column is called a field. Each field has corresponding descriptive information, such as data type, data width, and so on.
Record: In a table, each row is called a record.
Index: To speed up access to a database, many databases use indexes.
13.1.2 database application
DBMS stores a large amount of data information, the purpose is to provide users with data information services, and the database application is to communicate with the DBMS and access the data in the DBMS, it is the DBMS to achieve its external provision of data information services, the only way. Simply put, a database application is a computer program that allows users to insert, modify, delete, and report data in a database. Database applications have traditionally been written by programmers in one or more general-purpose or proprietary programming languages, but in recent years there have been a number of user-oriented database application development tools that simplify the process of using DBMS and do not require specialized programming. Delphi is a powerful database application development tool.
The language used to generate database applications is divided into three main types:
1. The process of language
Standard computer programming languages such as Pascal, Basic, and C are procedural languages that can create database applications through some kind of "Application Interface" (API), which consists of a set of standard functions (or calls) that extend the functionality of the language, Enable it to access data in the database. When a program designer creates a database application in a procedural language, the application code must be written into a series of processes, each executing a part of the application, such as a process querying the database, and another process updating the data in the database, The different processes are then linked through other user interface processes (such as menu systems) and run in the appropriate place in the application.
These procedural languages are generally used to create non-database applications, which are often referred to as "third-generation Languages" (3GL). There are also procedural programming languages that are specific to a particular DBMS, which is commonly referred to as the "fourth Generation Language" (4GL), the database-specific language. Common database-specific procedural languages such as dBASE language, Paradox database Pal language, and so on.
2. Structured Query Language (SQL)
Structured Query Language (Structure query Language) is a relational model based database query language, which is a non procedural language, that is, there is no need to write about how to do something, just write what you can do. The written statement can be seen as a problem, called query, for which the query results are required. Here is an example:
Select name,total from Class where total>600
This query is intended to come out of all the candidates with a total score greater than 600 from the database table class, listing their name and total score.
It is more appropriate to describe SQL as a child language because it does not have any screen processing or user input/output capabilities. Its primary purpose is to provide a standard way to access the database, regardless of the language in which the rest of the database application is written, which is designed for interactive queries of the database (hence called dynamic SQL). It can also be used in database applications written in a procedural language (so called Embedded SQL).
3. Other languages
In the language used to develop database applications, you can also use the current number of "object-oriented programming" (OOP) languages, such as C + +, Objact Pascal, and oop represent a completely different program design method in which the activity is defined as the "object" Instead of being defined as a series of procedures. The use of OOP languages in database applications is increasing.
Another language that the development database application uses is the macro language. A macro language is not a complete programming language, it is actually a user-entered table that is entered into an application to automate certain tasks. For a high-level language for a particular application, the macro language can often be found in low-grade DBMS software or in the front-end of the database server.
Finally, there is a "query-by-example" (QBE, sample query) language. Strictly speaking, QBE is not a language, it is a user-supplied interface with one or more empty tables that correspond to tables in the database. The user can select the column that needs to be queried through the keyboard, and fill in the condition in the appropriate column to define the search condition of the query, then the DBMS converts the QBE to the corresponding action to complete the query task that the user requests.
A brief introduction of database features and functions of 13.2 Delphi
Until now, the development of computer software has been divided into two different systems, one of which is the use of traditional programming languages (such as Pascal, Basic and C) to develop numerical control, numerical operations and other software, focusing on their focus on arithmetic, data structure and the recent generation of object-oriented technology. Another system is the common domain of database management software (the development of database applications). These two systems are developing at a very rapid pace, but there is no sign of mixed penetration. If you use the database language for traditional arithmetic programming, although you can also complete the corresponding functions, but its programming process can be extremely complex. If you use the traditional programming language to do database programming, by invoking the specialized database application interface functions and processes, the functions and processes provided by these functions may also be more perfect, but it is extremely difficult to do. And Delphi combined the advantages of two systems, it combines the traditional programming language Object Pascal and database language powerful function, it can be used for traditional arithmetic programming and can be used for database programming, especially Delphi has a powerful database function, Using Delphi's Database Tools, we don't need to write any object Pascal code to create a simple database application.
Delphi is a tool for developing database applications that Borland company released at the end of 1994 and is object-oriented and a powerful tool for developing client/server database applications. Delphi operating in Window3.1 above version of the system environment, currently has two versions: Delphi standard Version and client/server version. The standard version contains a local copy of the Borland Database Engine, which allows users to create database applications that have access to dBASE, Paradox, and locally interbase servers, and it also supports databases with ODBC interfaces. Delphi's client/server version includes Borland SQL Link, which directly accesses ORACLE, SyBase, and Microsoft SQL Server,informix and InterBase database servers.
Delphi has access to a variety of database management system databases, with forms (forms) and reports (Reports), BDE (Borland database Engine) can access such as paradox, DBASE, local interbase Server's database, you can also access databases on remote database servers (such as databases in client/server databases such as Oracle, SyBase, Informix, and so on), or any ODBC (Open database connecticity) A database in an accessible database management system.