Get Net Database Applications through PHP and MySQL, 2nd Edition now via O’Reilly digital learning.

You are watching: _____ is a scripting language that allows web authors to design interactive sites.

O’Reilly members experience live digital training, plus publications, videos, and digital content from 200+ publishers.


Most of the services we enjoy on the Web are gave by internet database applications. Web-based email, digital shopping, forums and also bulletin boards, corporate web sites, and sporting activities and also news portals are all database-pushed. To develop a modern internet website, you should construct a database application.

This book presents a extremely renowned, simple, low-price means to carry together the Web and databases to build applications. The most well-known database management device provided in these remedies is MySQL, an extremely rapid and easy-to-use system spread under an Open Source license by its manufacturer, MySQL AB. We comment on MySQL in detail in this book.

With a web server such as Apache (we assume Apache in this book, although the software application questioned right here works with various other internet servers as well) and also MySQL, you have many of what you have to build a internet database application. The essential glue you require is a method for the web server to talk to the database; in various other words, a way to incorporate database operations into web peras. The many popular glue that accomplishes this job is PHP.

PHP is an open up source job of the Apache Software Foundation and it’s the most popular Apache internet server add-on module, through approximately 53% of the Apache HTTP servers having PHP capabilities.<1> PHP is especially suited to internet database applications bereason of its integration tools for the Web and also database environments. In specific, the adaptability of embedding scripts in HTML peras permits simple integration of HTML presentation and also code. The database tier integration support is also great, via even more than 15 libraries available to interact with nearly all renowned database servers. In this book, we present a comprehensive see of PHP together with a number of powerful extensions provided by a repository recognized as PEAR.

Apache, MySQL, and PHP have the right to run on a broad variety of operating systems. In this book, we show you how to usage them on Linux, Mac OS X, and also Microsoft Windows.

This is an introductory book, yet it provides you the innovative expertise you have to construct applications effectively. This contains important tasks such as checking user input, managing errors robustly, and also locking your database operations to protect against information corruption. Most importantly, we describe the ethics behind good internet database applications. You’ll finish the book through not only the technical abilities to produce an application, yet also an appreciation for the techniques that make an application secure, reliable, maintainable, and expandable.


When you browse the Net, you usage your internet web browser to research resources from a web server and also the web server responds through the resources. You make these researches by filling in and also submitting develops, clicking on links, or inputting URLs right into your browser. Often, sources are static HTML pperiods that are presented in the web browser. Figure 1-1 shows just how a web internet browser communicates via a web server to retrieve this book’s home page. This is the classical two-tier or client-server design used on the Web.


*

A web server is not sophisticated storage software program. Complicated operations on information, done by commercial sites and anyone else presenting many dynamic data, need to be tackled by a separate database. This leads to a more facility design with three-tiers: the browser is still the client tier, the internet server becomes the middle tier, and the database is the third or database tier. Figure 1-2 mirrors how a web web browser repursuits a source that’s created from a database, and exactly how the database and also internet server respond to the repursuit.


*

This book mirrors you exactly how to construct internet database applications that are built about the three-tier architecture model displayed in Figure 1-3. At the base of an application is the database tier, consisting of the database monitoring system that manperiods the information individuals develop, delete, modify, and query. Built on peak of the database tier is the middle tier , which consists of the majority of of the application logic that you construct. It also communicates information in between the various other tiers. On height is the client tier , generally web browser software application that interacts through the application.


*

The three-tier architecture is conceptual. In practice, there are different implementations of internet database applications that fit this architecture. The many common implementation has actually the web server (which includes the scripting engine that procedures the scripts and also carries out the actions they specify) and the database management device mounted on one machine: it’s the simplest to control and secure, and it’s our emphasis in this book. With this implementation on contemporary hardware, your applications have the right to more than likely take care of tens of hundreds of requests eexceptionally hour.

For well-known internet sites, a widespread implementation is to install the web server and the database server on different devices, so that resources are dedicated to permit a much more scalable and also faster application. For extremely high-end applications, a cluster of computer systems deserve to be supplied, wright here the database and web servers are replicated and also the pack spread across many kind of devices. Our emphasis is on straightforward implementations; replication and also fill distribution are past the scope of this book.

Describing internet database applications as three-tier architectures renders them sound formally structured and also arranged. However, it hides the fact that the applications need to lug together different protocols and software application, and also that the software requirements to be mounted, configured, and also secured. The majority of the product in this book discusses the middle tier and the application logic that enables web browsers to work-related through databases.


The three-tier design gives a conceptual structure for internet database applications. The Internet itself gives the protocols and also network that connect the client and also middle tiers of the application: it offers the link between the web internet browser and also the internet server. HTTP is one component that binds together the three-tier architecture.

HTTP permits sources to be communicated and common over the Web. Most web servers and web browsers communicate utilizing the present version, HTTP/1.1. A in-depth knowledge of HTTP isn’t vital to understand also the material in this book, however it’s necessary to understand also the difficulties HTTP presents for internet database applications. (A longer introduction to the underlying internet protocols have the right to be found in Appendix D.)


HTTP is conceptually simple: a web web browser sends out a request for a resource to a internet server, and also the internet server sends out back a response. For eextremely repursuit, there’s always one response. The HTTP response carries the resource—the HTML document, image, or output of a program—earlier to the web browser.

An HTTP request is a textual description of a resource, and additional information or headers that describe just how the reresource should be reverted. Consider the following example request:

GET /~hugh/index.html HTTP/1.1Host: goanna.cs.rmit.edu.auFrom: hugh
hughwilliams.com (Hugh Williams)User-agent: Hugh-fake-browser/version-1.0Accept: text/simple, text/htmlThis example provides a GET method to repursuit an HTML page /~hugh/index.html from the server goanna.cs.rmit.edu.au via HTTP/1.1. In this example, 4 extra header lines specify the organize, identify the user and also the internet browser, and define what data types can be welcomed by the web browser. A repursuit is usually made by a internet web browser and also might encompass various other headers.

An HTTP response has actually a solution code and message, extra headers, and also generally the reresource that has actually been requested. Part of the response to the request for /~hugh/index.html is as follows:

HTTP/1.1 200 OKDate: Thu, 04 Dec 2003 04:30:02 GMTServer: Apache/1.3.27 (Unix)Last-Modified: Fri, 21 Nov 2003 22:26:07 GMTETag: "a87da0-2128-3fbe90ff"Accept-Ranges: bytesContent-Length: 8488Content-Type: text/html...The first line of the response tells the browser that the response is HTTP/1.1 and confirms that the repursuit prospered by reporting the response code 200 and also the message OK. In this example, salso lines of added headers identify the existing day and time, the web server software, the last day and time the page was changed, an entity tag (ETag) that is provided for caching, an instruction to the web browser on how to repursuit component of the record, the length of the response, and also the content type. After a blank line, the resource itself follows, and we’ve displayed only the initially few lines. In this example the reresource is the requested HTML record, /~hugh/index.html.


Timeless database applications are stateful. Users log in, run related transactions, and also then log out when they are finished. For instance, in a financial institution application, a bank teller might log in, usage the application through a collection of menus as he serves customer requests, and also log out once he’s finimelted for the day. The bank application has state: after the teller is logged in, he have the right to communicate with the application in a structured method utilizing menus. When the teller has logged out, he deserve to no much longer use the application.

HTTP is stateless. Any interaction in between a internet web browser and also a internet server is independent of any various other interaction. Each HTTP request from a web browser includes the exact same header indevelopment, such as the security credentials of the user, the kinds of pperiods the web browser deserve to accept, and instructions on exactly how to format the response. The server procedures the headers, formulates a solution that defines how the request was offered, and returns the headers and also a source to the browser. Once the response is finish, the server forgets the research and there’s no way to go ago and retrieve the request or response.

Statelessness has actually benefits: the the majority of significant are the resource savings from not having to keep information at the internet server to track a user or repursuits, and the versatility to allow individuals to relocate in between unconnected pages or sources. However, bereason HTTP is statemuch less, it is challenging to build stateful internet database applications: for example, it’s tough to pressure a user to follow menus or a collection of measures to complete a job.

To add state to HTTP, you require a technique to impose indevelopment flows and structure. A prevalent solution is to exreadjust a token or vital in between a web internet browser and a internet server that uniquely identifies the user and also her session . Each time a internet browser researches a source, it presents the token, and each time the internet server responds, it retransforms the token to the web web browser. The token is used by the middle-tier software program to gain back information about a user from her previous repursuit, such as which menu in the application she last accessed.

Exaltering tokens allows stateful structure such as menus, procedures, and also workcirculation processes to be included to the application. They have the right to likewise be used to prevent actions from happening more than once, time out logins after a period of intask, and also manage accessibility to an application.


Given that a web database application constructed through a three-tier design doesn’t fit naturally with HTTP, why use that model at all? The answer mostly lies in the popularity and standardization of web browsers: any user that has actually a internet browser can usage the internet database application, and normally without any type of limitations. This implies an application have the right to be yielded to any kind of variety of varied, distributed individuals who use any platdevelop, operating mechanism, or browser software program. This advantage is so substantial that our emphasis in this book is totally on three-tier remedies that usage a web internet browser as the client tier.

Internet browsers are thin clients . This suggests almost no application logic is contained in the client tier. The browser ssuggest sends out HTTP researches for sources and also then display screens the responses, most of which are HTML pperiods. This thin client version implies you don’t need to construct, install, or configure the client tier, but that you perform should build almost all of your application to run in the middle tier.

You can thicken the client tier to put more work-related on the internet browser. Using renowned innovations such as Java, JavaScript, and also Macromedia Flash, you can develop application components that procedure information individually of the internet server or preprocess information prior to sfinishing it to the server.

JavaScript is particularly excellent for many type of work bereason it’s simple to use, open up resource, and also constructed right into all well-known browsers (although individuals deserve to revolve it off). It’s frequently offered to validay information that’s typed into develops before it’s sent out to the server, highlight components of a web page as soon as the computer mouse passes over, display screen menus, and also perform various other straightforward tasks. However, it’s restricted in the indevelopment it deserve to save and also it can’t interact through a database server. Thus, although you shouldn’t depend on JavaScript to perform crucial work, it’s valuable for preprocessing and also it’s another essential modern technology we comment on in Chapter 7.


Tright here are basically 2 kinds of research made to a internet server: the first asks for a file—regularly a static HTML web page or an image—to be returned, and also the second asks for a program or manuscript to be run and also its output to be changed. We’ve presented you a simple instance previously in this chapter, and easy requests for records are better questioned in Appendix D. HTTP requests for PHP scripts need a server to run PHP’s Zfinish scripting engine, procedure the instructions in the manuscript (which may accessibility a database), and return the script output to the web browser to output as simple HTML.

Apache is an open up source, rapid, and also scalable internet server. It deserve to manage simultaneous researches from browsers and also is designed to run under multitasking operating systems such as Linux, Mac OS X, and Microsoft Windows. It has low resource requirements, deserve to successfully handle alters in repursuit tons, and also have the right to run rapid on even modest hardware. It is widely provided and also tested. The present release at the moment of creating is 2.0.48.

Conceptually, Apache isn’t complex. On a Unix platcreate, the web server is actually several running programs, wbelow one works with the others and doesn’t serve requests itself. The other server programs inform their availability to handle repursuits to the coordinating server. If too few servers are easily accessible to manage incoming repursuits, the coordinating server may start brand-new servers; if also many type of are cost-free, it may kill spare servers to conserve sources.

Apache’s configuration file controls exactly how it lis10s on the netoccupational and serves repursuits. The server administrator controls the actions of Apache through more than 150 directives that impact resource demands, response time, versatility in handling request fill varicapacity, security, exactly how HTTP requests are taken on and also logged, exactly how scripting engines are provided to run scripts, and also a lot of other aspects of its procedure.

The configuration of Apache for a lot of internet database applications is straightforward. We talk about just how to install Apache in Appendix A with Appendix C, how to hide files that you don’t desire to serve in Chapter 6, and also the functions of a secure internet server in Chapter 11. We comment on the HTTP protocol and just how it’s applied in Appendix D. More details on Apache configuration have the right to be uncovered in the resources provided in Appendix G.


Open source

Community initiatives to keep and also improve it are unconstrained by commercial imperatives.

Flexible for integration with HTML

One or more PHP scripts deserve to be embedded right into static HTML records and also this provides client tier integration basic. On the downside, this can blend the scripts via the presentation; but the layout approaches explained in Chapter 7 deserve to resolve many of these difficulties.

Suited to complex projects

It is a fully featured object-oriented programming language, via even more than 110 libraries of programming attributes for jobs as diverse as math, sorting, producing PDF papers, and sending email. Tright here are over 15 libraries for indigenous, quick access to the database tier.

Quick at running scripts

Using its integrated Zfinish scripting engine, PHP script execution is rapid and also all components run within the primary memory room of PHP (in comparison to various other scripting framefunctions, in which components are in unique modules). Our experiments imply that for tasks of at least modeprice intricacy, PHP is much faster than various other renowned scripting devices.

Platform- and operating-system portable

Apache and PHP run on many type of various platforms and operating systems. PHP have the right to likewise be incorporated through other web servers.

A area effort

PHP includes PEAR, a repository that is residence to over 100 openly accessible source code packages for widespread PHP programming jobs.


At the time of writing, PHP4 (Version 4.3.3) was the current version and also PHP5 was obtainable for beta experimentation (Version 5.0.0b2). The scripts in this book have actually been occurred and tested making use of PHP4, and also testing on PHP5 has figured out a few limitations. This book explains both versions of PHP: in particular, you’ll uncover a conversation of brand-new object-oriented PHP5 features in Chapter 14. When a function is only obtainable in PHP5, we tell you in the text. When a PHP4 manuscript or attribute doesn’t occupational on PHP5, we describe why and also predict exactly how it’ll be resolved in the future; it’s most likely that almost all scripts that run under PHP4 will certainly run under PHP5 later on.

PHP is a significant topic of this book. It’s introduced in Chapter 3 via Chapter 5, where we comment on a lot of of the attributes of the core language. PHP libraries that are important to internet database application breakthrough are the topic of Chapter 6 and also Chapter 8 via Chapter 13. PHP’s PEAR package repository is the subject of Chapter 7. An instance PHP application is the topic of Chapter 16 to Chapter 20. Appendix A through Appendix C present just how to install PHP. Other pointers to web resources, publications, and also commercial assets for PHP development are listed in Appendix G.

A technological explanation of the brand-new functions of PHP5 is presented in the next area. If you aren’t familiar with PHP4, skip ahead to the next area.


PHP4 included the first release of the Zfinish engine version 1.0, PHP’s scripting engine that implements the syntaxes of the language and also provides all of the tools essential to run library functions. PHP5 has a new Zfinish engine variation 2.0, that’s amplified to resolve the constraints of variation 1.0 and to include new functions that have actually been asked for by developers. However, unchoose the changes that arisen once PHP3 came to be PHP4, the alters from PHP4 to PHP5 just affect component of the language. Most code that’s written for PHP4 will certainly run without modification under PHP5.

In brief, the following are the significant new attributes in PHP5. Many type of of these features are explained in information elsewhere in this book:


New Object Model

Object-oriented programming (OOP) and also the OOP features of PHP5 are questioned in detail in Chapter 14. PHP4 has actually a simple object version that doesn’t incorporate many type of of the functions that object-oriented programmers expect in an OOP language such as destructors, exclusive and also safeguarded member functions and variables, static member features and also variables, interencounters, and also course form clues. All of these functions are available in PHP5.

The PHP5 OOP version likewise much better manages just how objects are passed around in between attributes and also classes. Handles to objects are currently passed, fairly than the objects themselves. This has actually dramatically enhanced the performance of PHP.

Internationalization

Support for non-Western character sets and Unicode. This is disputed in Chapter 3.

Exception Handling

New attempt...capture, and throw statements are accessible that are aimed at enhancing the robustness of applications when errors take place. These are discussed in Chapter 4. There’s also a backtrace function that you can use to construct a practice error handler that mirrors just how the code that led to an error was dubbed. This function has been back-ported into PHP4 and is disputed in Chapter 12.

Improved memory dealing with and also speed

PHP4 was fast, yet PHP5 is faster and also provides also much better usage of memory. We don’t comment on this in detail.

New XML support

Tright here were several different tools for functioning via the eXtensible Markup Language (XML) in PHP4. These tools have actually been replaced through a solitary new, robust framework in PHP5. We don’t talk about XML assistance in this book.

The Imconfirmed MySQL library (mysqli)

A brand-new MySQL function library is easily accessible in PHP5 that supports MySQL 4. The library has actually the significant feature that it permits an SQL query to be prepared once, and executed many type of times, and this dramatically boosts speed if a query is often supplied. This library is briefly explained in Chapter 6, and also is the resource of many of the PHP4 and also PHP5 compatibility troubles explained throughout in this book.


The database tier stores and also retrieves data. It’s likewise responsible for managing updays, allowing simultaneous ( concurrent) accessibility from web servers, giving defense, ensuring the integrity of information, and also providing support services such as data backup. Importantly, a good database tier need to allow quick and also versatile access to millions upon millions of facts.

Managing information in the database tier calls for facility software application. Fortunately, the majority of database monitoring devices (DBMSs) or servers are designed so that the software program complexities are hidden. To properly use a database server, skills are required to design a database and formulate queries making use of the SQL language; SQL is discussed in Chapter 5. An knowledge of the underlying design of the database server is uncrucial to the majority of individuals.

In this book, we usage the MySQL server to manage information. It has actually a well-deserved reputation for speed: it can manage many numerous facts, it’s exceptionally scalable, and particularly suited to the attributes of internet database applications. Also, prefer PHP and Apache, MySQL is open up resource software program. However, there are downsides to MySQL that we comment on later in this section.

The initially step in effective internet database application breakthrough is expertise device demands and also making databases. We comment on techniques for modeling device requirements, converting a design right into a database, and also the ethics of database technology in Appendix E. In this section, we focus on the database tier and also present database software application by contrasting it through other methods for storing information. Chapter 5 and Chapter 15 cover the requirements and software program we usage in more detail.

There are other server selections for storing data in the database tier. These include search engines, record administration devices, and gatemethod solutions such as email software. Our discussions in this book focus on the MySQL server in the database tier.


A database server or DBMS searcs and also manages information that’s stored in databases. A database is a repertoire of connected data, and also an application deserve to have actually more than one database. A database could contain a couple of entries that consist of an easy resolve book of names, addresses, and phone numbers. At the various other excessive, a database can contain tens or numerous millions of records that explain the directory, purchases, orders, and also payroll of a huge company. Many internet database applications have small- to medium-size databases that store thousands, or 10s of thousands, of records.

Database servers are complicated software application. However before, the vital component for internet database application advance is the applications interface that’s provided to access the database server. For all yet the largest applications, knowledge and configuring the internals of a database server is generally unvital.


The database server applications interconfront is accessed using SQL. It’s a typical query language that’s used to specify and manipulate databases and data, and also it’s sustained by all famous database servers.

SQL has actually had actually a complex life. It started at the IBM San Jose Research Laboratory in the early 1970s, wright here it was known as Sequel ; some customers still call it Sequel, though it’s more effectively described by the three-letter acronym, SQL. After virtually 16 years of advancement and differing implementations, the criteria organizations ANSI and also ISO publimelted an SQL typical in 1986. IBM publimelted a various traditional one year later!

Due to the fact that the mid-1980s, three subsequent standards have been publiburned by ANSI and also ISO. The initially, SQL-89, is the a lot of widely, completely imposed SQL in well-known database servers. Many type of servers implement just some attributes of the next release, SQL-2 or SQL-92, and virtually no servers have actually implemented the functions of the many newly apshowed conventional, SQL-99 or SQL-3. MySQL supports the entry-level SQL-92 standard and also has actually some proprietary extensions.

Consider an SQL instance. Suppose you want to keep indevelopment about publications in a library. You can create a table—an object that’s stored in your database—utilizing the complying with statement:

CREATE TABLE publications ( title char(50), author char(50), ISBN char(50) NOT NULL, PRIMARY KEY (ISBN));Then, you can add books to the database utilizing statements such as:

INSERT INTO books ("Net Database Apps", "Hugh and also Dave", "123-456-N");Once you’ve added information, you have the right to retrieve facts around the publications making use of queries such as the following that finds the writer and title of a book through a details ISBN:

SELECT writer, title FROM books WHERE ISBN = "456-789-Q";These are only some of the functions of SQL, and also even these attributes can be used in complex ways. SQL also permits you to upday and delete data and databases, and it consists of many other functions such as defense and also access management, multiuser transactions that permit many type of users to access the exact same database without corrupting the information, tools to import and export data, and also powerful unexecute and recarry out functions.

SQL is disputed in detail in Chapter 5 and Chapter 15.


Why usage a facility database server to control data? There are a number of factors that deserve to be explained by contrasting a database with a spreadsheet, a straightforward text file, or a custom-developed strategy of storing data. A few instance instances wbelow a database server need to and have to not be used are debated later on in this section.

Take spreadsheets as an example. Spreadsheet worksheets are generally designed for a particular application. If 2 customers keep names and also addresses, they are likely to organize information in a various means and develop custom methods to move around and summarize the information. The regimen and the information aren’t independent: moving a column might expect rewriting a macro or formula, while exchanging information between the 2 users’ applications could be complicated. In comparison, a database server and also SQL carry out data-regimen self-reliance, wright here the approach for storing the information is independent of the language that accesses it.

Managing complicated relationships is difficult in a spreadsheet or message file. For example, take into consideration what happens if we desire to store information about customers: we could allocate a couple of spreadsheet columns to save each customer’s residential deal with. If we were to add organization addresses and also postal addresses, we’d need even more columns and facility handling to, for example, process a mail-out to customers. If we want to store information around the purchases by our customers, the spreadsheet becomes larger still, and also problems begin to emerge. For instance, it is hard to determine the maximum number of columns necessary to store orders and also to architecture a method to process these for reporting. In comparison, databases are designed to control complex relational data.

A database server usually permits multiple users to access a database at the same time in a systematic way. In contrast, a spreadsheet have to be opened up and written just by one user; if another user opens up the spreadsheet, she won’t check out any updays being made at the very same time by the initially user. At finest, a mutual spreadsheet or text file permits very restricted conpresent access.

An additional advantage of a database server is its speed and also scalcapability. It isn’t completely true to say that a database provides quicker browsing of information than a spreadsheet or a practice filesystem. In many cases, searching a spreadsheet or a special-purpose file might be perfectly acceptable, or even faster if it is designed carefully and the volume of information is small. However before, for controlling large quantities of connected indevelopment, the underlying search structures enable rapid browsing, and also if information requirements are complex, a database server should optimize the approach of retrieving the data.

Tbelow are additionally other advantages of database servers, consisting of data-oriented and user-oriented defense, management software application, portcapability, and data recoextremely assistance. A practical advantage of this is reduced application breakthrough time: the system is already built, it demands only data and also queries to accessibility the information.


Tbelow is even more than one user who requirements to accessibility the data at the very same time.

Tright here is at leastern a moderate amount of information. For example, you might must preserve indevelopment around a few hundred customers.

Tright here are relationships in between the stored information items. For example, customers might have actually any kind of number of connected invoices.

Tright here is more than one type of data object. For instance, tbelow can be indevelopment about customers, orders, inventory, and also various other information in an digital store.

There are constraints that must be rigidly enforced on the data, such as field lengths, area kinds, uniqueness of customer numbers, and so on.

New or consolidated indevelopment have to be produced from fundamental, associated information; that is, the data must be queried to develop reports or results.

Tright here is a large amount of data that have to be searched conveniently.

Security is essential. There is a have to enpressure rules regarding who have the right to accessibility the data.

Adding, deleting, or modifying data is a facility process.

Adding, deleting, and updating data is a constant or facility procedure.


MySQL has a lot of of the features of high-finish commercial database servers, consisting of the capacity to regulate very huge quantities of information. Its style is ideally suited to regulating databases that are typical of most internet database applications. The current version at the moment of composing is MySQL 4.1.

The distinction between MySQL and high-finish commercial servers is that MySQL’s components aren’t as mature. For example, MySQL’s query evaluator doesn’t constantly construct a fast setup to evaluate complicated queries. It also doesn’t assistance every one of the features you could discover in other servers: for instance, views, triggers, and stored measures are planned for future versions. Tright here are various other, more minor restrictions that don’t typically influence web development. However before, also users who require these features frequently choose MySQL bereason it’s cost-free. (Contrary to popular belief, considering that 2002, MySQL has supported nested queries, transactions, and also row (or record) locking.)

MySQL is another significant topic of this book. It’s introduced in Chapter 5, and used broadly in examples in Chapter 6 through Chapter 8 and Chapter 11 and also Chapter 12. State-of-the-art MySQL features are a subject of Chapter 15. An instance application that offers PHP and also MySQL is the subject of Chapter 16 with Chapter 20. Appendix A with Appendix C reflects exactly how to install MySQL and also schosen MySQL resources are detailed in Appendix G.

A technical explanation of the attributes of MySQL 4 is presented in the next section. If you aren’t acquainted via MySQL, skip ahead to the following section.


MySQL 4 is a major new release that includes necessary attributes that have been added given that MySQL 3.23. The current version, MySQL 4.1, supports a vast variety of SQL queries, including joins, multi-table updays and deletes, and nested queries. At present it supports the majority of attributes of the SQL 92 standard, and also its aim is to completely assistance SQL 99.

The MySQL server supports a number of table kinds that permit a broad array of choice in your applications of locking approaches, transactivity environments, and performance selections. It likewise has actually good devices for backup and also recoexceptionally. MySQL is a powerful, fully-featured DBMS that’s commercially supported by the company MySQL AB.

In information, the adhering to are the significant attributes of MySQL 4. Many kind of of these attributes are described in information in other places in this book:


Nested query and also acquired table support

Sub-queries are brand-new in MySQL 4.1. This enables you to usage the SQL statements EXISTS, IN, NOT EXISTS, and NOT IN, and it also allows you to incorporate a nested query in the FROM clause that creates a derived table. UNION was presented in MySQL 4.0. All of these are disputed in detail in Chapter 15.

Internationalization

MySQL 4.1 currently supports Unicode, enabling you to construct applications that don’t usage Western languages. We don’t discuss MySQL’s usage of Unicode in this book, yet we perform talk about PHP’s Unicode support in Chapter 3.

Query caching

MySQL 4.0 introduced a query cache that stores the most-recent outcomes of queries, and also intelligently delivers these as answers to the same future queries. We display you just how to usage this feature in Chapter 15. We define various other rate enhancements in the very same chapter.

Transaction-safe InnoDB tables

The InnoDB table form was consisted of as a integrated module in MySQL 4.0. InnoDB supports transactions, and also enables you to decide whether to commit or rollago a collection of writes to the database. It likewise supports checkpointing, which is provided by MySQL to obtain the database right into a known state after a crash or severe error. We define the benefits and disbenefits of InnoDB in Chapter 15.

See more: What Does Charge It To The Game Mean ? Charge It 2 The Game

Full message searching

MySQL 4 introduced new techniques for quick looking of text and a form of search engine-prefer ranking. We don’t talk about this in the book.