pear supplies a number of open source extensions to php including its db package, which provides a...

8

Upload: winfred-warren

Post on 02-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PEAR supplies a number of open source extensions to PHP including its DB package, which provides a database abstraction layer  so that the PHP programmer
Page 2: PEAR supplies a number of open source extensions to PHP including its DB package, which provides a database abstraction layer  so that the PHP programmer

PEAR supplies a number of open source extensions to PHP including its DB package, which provides a database abstraction layer

so that the PHP programmer doesn't have to worry about all the APIs for different databases.

Page 3: PEAR supplies a number of open source extensions to PHP including its DB package, which provides a database abstraction layer  so that the PHP programmer

Whether or not you decide to use PEAR DB or a similar database abstraction layer depends on your needs.

If you need to be able to work on many applications and get your work done quickly, then PEAR DB is certainly helpful.

If performance is key, then you may find the extra weight of PEAR DB to be prohibitive.

Page 4: PEAR supplies a number of open source extensions to PHP including its DB package, which provides a database abstraction layer  so that the PHP programmer

One big benefit of using a database abstraction layer like PEAR DB is portability. PEAR DB allows you to use a single API for working with many different types of databases.

So if you decide to move to another database, you will not have to rewrite all your code.

Page 5: PEAR supplies a number of open source extensions to PHP including its DB package, which provides a database abstraction layer  so that the PHP programmer

• Another benefit is code simplification. If your application involves multiple databases of different flavors or you work on many applications each of which uses a different type of database, you would normally have to learn the APIs for each of the databases you would be working with.

• Again, PEAR DB allows you to work with all these databases using the same API.

Page 6: PEAR supplies a number of open source extensions to PHP including its DB package, which provides a database abstraction layer  so that the PHP programmer

• The biggest downside of using a database abstraction layer is that the benefits come at a performance cost.

• Imagine you were planning to travel around Europe and had the choice of bringing an interpreter who could speak all European languages and learning the languages yourself.

• It would certainly be easier to bring the interpreter, but this would make each conversation you had somewhat slower. The abstraction layer is the interpreter.

Page 7: PEAR supplies a number of open source extensions to PHP including its DB package, which provides a database abstraction layer  so that the PHP programmer

The connection string for connecting to the database with PEAR DB is:

Syntax:driver://

username:password@host/database

Page 8: PEAR supplies a number of open source extensions to PHP including its DB package, which provides a database abstraction layer  so that the PHP programmer

• mysqli• mysql• mssql• oci8• odbc• pgsql• sybase• dbase• sqlite