public function create($sql, $type = MW_DB_Connection_Abstract::TYPE_SIMPLE)
	{
		try {
			switch ($type)
			{
				case MW_DB_Connection_Abstract::TYPE_SIMPLE:
					return new MW_DB_Statement_PDO_Simple($this->_connection, $sql);
				case MW_DB_Connection_Abstract::TYPE_PREP:
					return new MW_DB_Statement_PDO_Prepared($this->_connection->prepare($sql));
				default:
					throw new MW_DB_Exception( sprintf( 'Invalid value "%1$d" for statement type', $type ) );
			}
		} catch (PDOException $e) {
			throw new MW_DB_Exception($e->getMessage(), $e->getCode(), $e->errorInfo);
		}
	}
public function create($sql, $type = MW_DB_Connection_Abstract::TYPE_SIMPLE)
	{
		try {
			switch ($type)
			{
				case MW_DB_Connection_Abstract::TYPE_SIMPLE:
					return new MW_DB_Statement_PDO_Simple($this->_connection, $sql);
				case MW_DB_Connection_Abstract::TYPE_PREP:
					return new MW_DB_Statement_PDO_Prepared($this->_connection->prepare($sql));
				default:
					throw new MW_DB_Exception( sprintf( 'Invalid value "%1$d" for statement type', $type ) );
			}
		} catch (PDOException $e) {
			throw new MW_DB_Exception($e->getMessage(), $e->getCode(), $e->errorInfo);
		}
	}
public function create ( $ sql , $ type = MW_DB_Connection_Abstract :: TYPE_SIMPLE ) { try { switch ( $ type ) { case MW_DB_Connection_Abstract :: TYPE_SIMPLE : return new MW_DB_Statement_PDO_Simple ( $ this -> _connection , $ sql ) ; case MW_DB_Connection_Abstract :: TYPE_PREP : return new MW_DB_Statement_PDO_Prepared ( $ this -> _connection -> prepare ( $ sql ) ) ; default : throw new MW_DB_Exception ( sprintf ( 'Invalid value "%1$d" for statement type' , $ type ) ) ; } } catch ( PDOException $ e ) { throw new MW_DB_Exception ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e -> errorInfo ) ; } }
Creates a PDO database statement.

@param string $sql SQL statement, maybe with place holders
@param integer $type Simple or prepared statement type constant from abstract class
@return MW_DB_Statement_Interface PDO statement object
@throws MW_DB_Exception if type is invalid or the PDO object throws an exception
Creates a PDO database statement .