WireDatabasePDO class

All database operations in ProcessWire are performed via this PDO-style database class.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the WireDatabasePDO class also inherits all the methods and properties of: Wire.

Show class?             Show args?        

PDO

NameReturnSummary 
WireDatabasePDO::beginTransaction()
boolInitiates a transaction 
WireDatabasePDO::commit()
boolCommits a transaction 
WireDatabasePDO::errorCode()
stringFetch the SQLSTATE associated with the last operation on the statement handle 
WireDatabasePDO::errorInfo()
arrayFetch extended error information associated with the last operation on the database handle 
WireDatabasePDO::exec($statement)
bool intExecute an SQL statement string 
WireDatabasePDO::getAttribute(int $attribute)
mixedRetrieve a database connection attribute 
WireDatabasePDO::inTransaction()
boolChecks if inside a transaction 
WireDatabasePDO::lastInsertId()
stringReturns the ID of the last inserted row or sequence value 
WireDatabasePDO::pdo()
PDOReturn the actual current PDO connection instance 
WireDatabasePDO::prepare(string $statement)
PDOStatementPrepare an SQL statement for accepting bound parameters 
WireDatabasePDO::query(string $statement)
PDOStatementExecutes an SQL statement, returning a result set as a PDOStatement object 
WireDatabasePDO::quote(string $str)
stringQuote and escape a string value 
WireDatabasePDO::rollBack()
boolRolls back a transaction 
WireDatabasePDO::setAttribute(int $attribute, mixed $value)
boolSets an attribute on the database handle 
WireDatabasePDO::supportsTransaction()
boolAre transactions available with current DB engine (or table)? 

Additional methods and properties

In addition to the methods and properties above, WireDatabasePDO also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.123

Twitter updates

  • New post: In this week’s post, we’ll take a look a look at the new website and focus on some parts of it and how they were built. Then we’ll dive into the latest version of ProcessWire on the dev branch, version 3.0.124— More
    11 January 2019
  • New ProcessWire main site rebuild ready for preview— More
    4 January 2019
  • Happy Holidays! This latest master version of ProcessWire contains hundreds of new additions, fixes, optimizations and more. This post covers all the highlights— More
    21 December 2018

Latest news

  • ProcessWire Weekly #244
    In the 244th issue of ProcessWire Weekly we'll cover the latest core updates, introduce the new processwire.com site, ask a PHP version related question in the weekly poll, and showcase the site of an open source room bookings app. Read on!
    Weekly.pw / 12 January 2019
  • ProcessWire 3.0.124 and new website launched
    In this week’s post, we’ll take a look a look at the new website and focus on some parts of it and how they were built. Then we’ll dive into the latest version of ProcessWire on the dev branch, version 3.0.124.
    Blog / 11 January 2019
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani