PHPackages                             fulldecent/thin-pdo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. fulldecent/thin-pdo

Abandoned → [colshrapnel/safemysql](/?search=colshrapnel%2Fsafemysql)ArchivedLibrary[Database &amp; ORM](/categories/database)

fulldecent/thin-pdo
===================

A minimal extension for PHP's PDO class designed to make running SQL statements easier

1.2.2(9y ago)31122MITPHPPHP &gt;=5.5

Since May 16Pushed 7y agoCompare

[ Source](https://github.com/fulldecent/thin-pdo)[ Packagist](https://packagist.org/packages/fulldecent/thin-pdo)[ Docs](http://github.com/fulldecent/pdo-wrapper)[ RSS](/packages/fulldecent-thin-pdo/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (7)DependenciesVersions (4)Used By (0)

DEPRECATION NOTICE: This code worked great for me on production systems for years. Going forward I use and recommend the approach described at  as superior.

---

PHP PDO Wrapper Class
=====================

[](#php-pdo-wrapper-class)

A minimal extension for PHP's PDO class designed to make running SQL statements easier.

[Download the latest release](https://github.com/fulldecent/thin-pdo/releases)

Project Overview
----------------

[](#project-overview)

This project provides a minimal extension for [PHP's PDO (PHP Data Objects) class](http://us3.php.net/manual/en/book.pdo.php) designed for ease-of-use and saving development time/effort. This is achived by providing methods - delete, insert, select, and update - for quickly building common SQL statements, handling exceptions when SQL errors are produced, and automatically returning results/number of affected rows for the appropriate SQL statement types.

System Requirements
-------------------

[](#system-requirements)

- PHP 5.5+ (any current PHP version, see )
- PDO Extension
- Appropriate PDO Driver(s) - PDO\_SQLITE, PDO\_MYSQL, PDO\_PGSQL
- Only MySQL, SQLite, and PostgreSQL database types are currently supported.

db Class Methods
----------------

[](#db-class-methods)

Below you will find a detailed explanation along with code samples for each of the 6 methods included in the db class.

### constructor

[](#constructor)

```

```

More information can be found on how to set the dsn parameter by following the links provided below.

- MySQL -
- SQLite -
- PostreSQL -

### delete

[](#delete)

```

```

If no SQL errors are produced, this method will return the number of rows affected by the DELETE statement.

### insert

[](#insert)

```

```

If no SQL errors are produced, this method will return the number of rows affected by the INSERT statement.

See also: `$db->lastInsertId();` which is inherited from PDO.

### run

[](#run)

```

```

This method is used to run free-form SQL statements that can't be handled by the included delete, insert, select, or update methods. If no SQL errors are produced, this method will return the number of affected rows for DELETE, INSERT, and UPDATE statements, or an associate array of results for SELECT, DESCRIBE, and PRAGMA statements.

### select

[](#select)

```
