Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP's PDO Source Code [closed]

Tags:

php

pdo

I've got PHP installed from the repos on my Ubuntu 9.10 local machine. Where can I find the source code to the PDO classes?

like image 286
Corey Hart Avatar asked Jan 25 '10 07:01

Corey Hart


People also ask

Is it necessary to close PDO connection?

If you don't do this explicitly, PHP will automatically close the connection when your script ends. So the answer is no, you don't need to do anything unless you need to explicitly close the connection during the script execution for whatever reason, in which case just set your PDO object to null.

How do I close a PDO connection in PHP?

The connection remains active for the lifetime of that PDO object. To close the connection, you need to destroy the object by ensuring that all remaining references to it are deleted—you do this by assigning null to the variable that holds the object.

What does PHP's PDO stand for?

PDO is an acronym for PHP Data Objects. PDO is a lean, consistent way to access databases. This means developers can write portable code much easier. PDO is not an abstraction layer like PearDB.

How fetch data from database in PHP and display PDO?

Fetch data from a result set by calling one of the following fetch methods: To return a single row from a result set as an array or object, call the PDOStatement::fetch method. To return all of the rows from the result set as an array of arrays or objects, call the PDOStatement::fetchAll method.


2 Answers

As of PHP 5.1, PDO is part of the PHP core so it should be somewhere in there. My educated guess is

/ext/pdo

Before 5.1, it used to be a PECL package that is still available here. If you want to browse the source just for curiosity, it might do. If you need the current one, look in the core.

like image 104
Pekka Avatar answered Oct 21 '22 17:10

Pekka


The PHP code can be found on GitHub: https://github.com/php/php-src

And the PDO classes are under /ext/pdo as Pekka 웃 pointed out.

In this way you don't need to download the full code, but read it online.

like image 27
Lucio Avatar answered Oct 21 '22 15:10

Lucio