1.2 What You Can Do with PHP and PostgreSQL


There are many reasons for using PHP and PostgreSQL as a team and in this section you will see some practical examples. You will see what you can do with PHP and PostgreSQL and you will learn about the most important features.

The first few chapters of this book focus entirely on PHP. First the installation will be discussed. You will see how PHP can be set up and how PHP interacts with the Web server.

When you know how to install the system, you can get started with PHP. Chapter 3, "PHP Basics," is an introduction to PHP where you will see how to implement and maintain simple applications. You will learn about the scope of variables, working with files, building packages, and working with forms, as well as debugging.

After this brief introduction, it is time to take a look at PHP's object-oriented capabilities. Chapter 4, "Object-Oriented PHP," is all about objects. Constructors, classes, inheritance, and so forth will be the topics of this chapter. Object orientation will help many of you to build more modular applications, and this will help you to reuse your code in many applications.

When you are familiar with PHP, PostgreSQL will be introduced. Chapter 5 will guide you through the principles of relational and object relational database theory. This will help you to gain an overview of working with databases and give you the fundamental knowledge you will need in this book.

Chapter 6, "Installing PostgreSQL," will be about the installation process of PostgreSQL. The chapter will focus on installing PostgreSQL on Unix and Windows-based systems.

As soon as PostgreSQL is up and running, you can take a look at SQL in Chapter 7, "Basic SQL." SQL is a structured query language whose only purpose is to interact with databases. Knowing the basics of SQL will enable you to implement simple database-driven applications.

Chapter 8 will definitely rock your boat. It is all about advanced SQL. For all of you who already are familiar with MySQL, this will be an avatar of advanced database technology provided by PostgreSQL. In the first part of the chapter we will discuss advanced data types you can use for storing network information or geometric data. Further sections of the chapter cover views, subselects, aliases, autojoins, constraints, and transactions, as well as object orientation. In a special section you will learn about rules. Rules are an extremely cool feature of PostgreSQL that enable you to redefine SQL commands to your needs.

For all who are migrating from Oracle to PostgreSQL, Chapter 9, "Embedded Languages," will be interesting. Most parts of this chapter are about PL/pgSQL, which is an embedded language similar to Oracle's PL/SQL. In this section you will also learn to write triggers.

An important topic when working with a database is its administration. Defining user rights and managing network security are only two parts of Chapter 10, "PostgreSQL Administration."

After all these fundamentals you will be ready for action, and it is time to get started with PHP and PostgreSQL as a team. Chapter 11 will guide you through the basics of working with simple database-driven applications. You will learn to insert and retrieve data from the database as well as learning about locking and inheritance.

For those of you who are working with huge files, Chapter 12, "Working with BLOBs," will be useful. You will learn how files can be stored inside a PostgreSQL database. Yes, you have understood correctly files can be stored inside a database. There is no need to work with external files that are not consistent with the filenames in the database. This section is about file uploads as well. You will learn how files can be uploaded to remote Web servers safely.

Speed is an important issue in modern application development. Chapter 13 will give you a brief insight into working with persistent database connections. You will learn about dangers and benefits of persistent connections and you will focus on measuring performance.

Regular expressions are a powerful invention. For fuzzy matching and pattern matching, regular expressions are essential. Although they are said to be difficult, simple patterns are not that complicated to write. In Chapter 14, "Managing Regular Expressions," you will be guided through the fundamentals of regular expressions and you will get a closer look at Perl-style and POSIX-style regular expressions. You will also see how regular expressions can be used in SQL.

Have you ever built a Web site consisting of more than just one dynamic page? If you have already done that, you know that it is essential to pass information from one script to another. Session management, which is the topic of Chapter 15, is an essential task, and the more complex your Web site is, the more important session management will be. HTTP is not a connection-oriented protocol, so some sort of connection-oriented capabilities must be available on the application level.

For many years building dynamic Web sites was about generating HTML code. With the evolution of modern technologies, it became possible to generate images, sounds, movies, and documents on the fly, as explained in Chapter 16, "Working with Dynamic Documents, Images, and Movies." You can build systems that do not have static, predefined components any more. No matter what application you want to build, PHP and PostgreSQL will provide the right solution for you. Figure 1.1 shows an example of what can be done with PHP and PostgreSQL.

Figure 1.1. Just take a look at what we are going to do.

graphics/01fig01.jpg

In combination with tools such as LaTeX, nice-looking documents can be generated. The content of the document is taken from the database and can be administered easily. It is possible to generate documents consisting of hundreds of pages fast and efficiently.

Dates and time have always been crucial. Unlike data such as integer values, dates and time cannot be processed that easily. The reason lies in the complexity of dates. Just think of months. A month can be 28, 29, 30, or 31 days long; in addition, it is not the same every year. You can easily imagine that this can be a problem.

In Chapter 17, "Working with Dates and Time," you will take a closer look at dates and time and we will try to present easy yet powerful solutions for the most common problems.

Speed is the drug of IT people. I am not talking about illegal substances but about performance tuning. It is all about speed, and every software developer wants to get the maximum performance out of his computer. In Chapter 18, "Tuning," you will learn to tune PostgreSQL and take a look at measuring performance in general.

Recently XML has become more and more popular. For exchanging data, XML is widely used for business-to-business (B2B) communication. The advantage of XML is that it is based on ASCII. This means that it can be read by every platform on every system available. An additional advantage of XML is that the definition of the structure of a document and the data itself need not be in the same file. This makes the creation of templates easier and helps you to gain flexibility.

Modern Web environments must be secure. Just think of a company's intranet where confidential data is transmitted, or think of a stock exchange where billions of dollars are managed. Security is an important issue. However, when building simple Web sites, the main problem is still the same how can these sites be made more secure? Chapter 20 focuses on security.

In Chapter 21, "Web Applications," you will see some prototypes of the most common applications. From Web shops to content management systems from application servers to drawing stock charts everything will be discussed in this chapter.

PostgreSQL is one of the most flexible databases available. It allows the user to implement simple extensions easily. Therefore, PostgreSQL can be the basis for every kind of application. The basic features of PostgreSQL are extraordinary, but when building your own extensions, the power of PostgreSQL can be even greater. Chapter 22 focuses on extending PostgreSQL as well as persuading the database to do things that are not core features such as building substring indexes or tolerant searching.

The topics of the two final chapters are high availability and migration. In the sections about high availability, you will learn about error-tolerant database structures. Just think of undoing transactions this chapter is what you are looking for.



PHP and PostgreSQL. Advanced Web Programming2002
PHP and PostgreSQL. Advanced Web Programming2002
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 201

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net