Stones / Matthew | Beginning Databases with PostgreSQL | E-Book | sack.de
E-Book

E-Book, Englisch, 664 Seiten, eBook

Stones / Matthew Beginning Databases with PostgreSQL

From Novice to Professional
2. Auflage 2006
ISBN: 978-1-4302-0018-5
Verlag: APRESS
Format: PDF
Kopierschutz: 1 - PDF Watermark

From Novice to Professional

E-Book, Englisch, 664 Seiten, eBook

ISBN: 978-1-4302-0018-5
Verlag: APRESS
Format: PDF
Kopierschutz: 1 - PDF Watermark



PostgreSQL is arguably the most powerful open-source relational database system. It has grown from academic research beginnings into a functionally-rich, standards-compliant, and enterprise-ready database used by organizations all over the world. And it's completely free to use.Beginning Databases with PostgreSQL offers readers a thorough overview of database basics, starting with an explanation of why you might need to use a database, and following with a summary of what different database types have to offer when compared to alternatives like spreadsheets. You'll also learn all about relational database design topics such as the SQL query language, and introduce core principles including normalization and referential integrity. The book continues with a complete tutorial on PostgreSQL features and functions and include information on database construction and administration. Key features such as transactions, stored procedures and triggers are covered, along with many of the capabilities new to version 8. To help you get started quickly, step-by-step instructions on installing PostgreSQL on Windows and Linux/UNIX systems are included.In the remainder of the book, we show you how to make the most of PostgreSQL features in your own applications using a wide range of programming languages, including C, Perl, PHP, Java and C#. Many example programs are presented in the book, and all are available for download from the Apress web site.By the end of the book you will be able to install, use, and effectively manage a PostgreSQL server, design and implement a database, and create and deploy your own database applications.
Stones / Matthew Beginning Databases with PostgreSQL jetzt bestellen!

Zielgruppe


Popular/general

Weitere Infos & Material


to PostgreSQL.- Relational Database Principles.- Getting Started with PostgreSQL.- Accessing Your Data.- PostgreSQL Command-Line and Graphical Tools.- Data Interfacing.- Advanced Data Selection.- Data Definition and Manipulation.- Transactions and Locking.- Functions, Stored Procedures, and Triggers.- PostgreSQL Administration.- Database Design.- Accessing PostgreSQL from C Using libpq.- Accessing PostgreSQL from C Using Embedded SQL.- Accessing PostgreSQL from PHP.- Accessing PostgreSQL from Perl.- Accessing PostgreSQL from Java.- Accessing PostgreSQL from C#.


Accessing PostgreSQL from Perl (S. 465-466)

As earlier chapters have shown, communicating with PostgreSQL generally involves a lot of string manipulation. One language that excels at string manipulation is Perl. In Chapter 13, we demonstrated that the libpq interface is a powerful way to access a PostgreSQL database, but there are disadvantages. We need to use string manipulation to pass values to queries and to retrieve results, and for short programs, the C code dealing with strings can overshadow the database interactions.

As Chapter 13 pointed out, although binary access is possible, its benefits are minimal. With Perl, strings are much more sophisticated, supporting functionality such as joining, splitting, pattern matching, and automatic conversion to and from other data types. Perl has also historically been associated with web server processing (although more modern mechanisms such as PHP, described in the previous chapter, are taking over that role).

Having interfaces to databases definitely adds benefits. If you know even a little about Perl, you will be aware that one of the language’s axioms is that there is always more than one way to tackle any given job. In fact, Perl enthusiasts would be disappointed if they had to limit their options to single figures. We do not propose to bombard you with numerous techniques for accessing PostgreSQL databases from Perl, however. Instead, we will present a single methodology. There are essentially three ways to access PostgreSQL from Perl:

• Low-level access, which is essentially a Perl mapping of the libpq C interface (Module Pg)
• High-level access, using a database independent layer (DBI)
• Access by embedding the Perl interpreter (similar to the description in Chapter 14)

We will describe only the high-level DBI access mechanism, because it is the simplest to install and use. This method is database-independent, yet is still very flexible and powerful. If you are interested in a libpq-style of working, we suggest taking a look at Module Pg, which is part of the DBD:: Pg database driver. PL/Perl requires a version of Perl to have been initially built as a shared library - libperl.so, as opposed to the more usual libperl.a (see the instructions for building Perl found in Perl source distributions).

Installing Perl Modules

The Perl programming language supports the concept of modules - additional functions that can be integrated into a Perl installation to provide extra features. Many developers have developed modules to extend Perl, providing diverse functionality, including network protocols for file transfer or sending e-mail, parsing and manipulating XML documents, generating graphical images, and more. Much of Perl’s standard functionality is provided by modules included with a basic Perl installation.

In this chapter, we will be using several modules that are not included in the base Perl installation. Because installing modules is a fairly common task, the Perl community has developed a standard process for finding and installing modules. This process has itself been encapsulated in a Perl module, the CPAN module, which we will meet in a moment. Perl modules can be written in several languages, not just Perl. Modules written in a language other than Perl need to be compiled before they can be installed, but binaries are often available to download.


Richard Stones graduated from university with an electrical engineering degree, but decided software was more fun. He has programmed in a variety of languages, but only admits to knowing Visual Basic under duress. He has worked for a number of companies, from the very small to the very large, in a variety of areas, from real-time embedded systems upward. He is employed by Celesio AG as a systems architect, working principally on systems for the retail side of the business. He has co-authored several computing books with Neil Matthew, including Beginning Linux Programming, Professional Linux Programming, and Beginning Databases with MySQL.



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.