<?php
/********************************************************************************
 * (c)1337 aheadware.com - All rights reserved
 ********************************************************************************/

class AHDB_Db_PDO extends PDO {

    private $mysql = true;

    public function __construct( $cfg, $isMysql = true )
    {
        parent::__construct(
            'mysql:host=' . $cfg[ 'host' ] . ';dbname=' . $cfg[ 'name' ] . ';charset=utf8',
            $cfg[ 'user' ],
            $cfg[ 'pass' ]
        );
        $this->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );

        $this->mysql= $isMysql;

        if ( !$this->isMysql() )
        {
            $this->setAttribute( PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_UTF8 );
        }
    }

    public function isMysql()
    {
        return $this->mysql;
    }
}