/** * Constructor method * * @access public * @return void */ public function __construct() { $dsn = 'mysql:host=' . Config::DB_HOST; $dsn .= ';dbname=' . Config::DB_NAME; $dsn .= ';port=' . Config::DB_PORT; $this->pdo = new PDO($dsn, Config::DB_USER, Config::DB_PASSWORD, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); $this->pdo->exec('SET NAMES UTF8 COLLATE utf8_general_ci'); $structure = new NotORM_Structure_Convention('id_%s', 'id_%s', '%s', Config::DB_PREFIX); parent::__construct($this->pdo, $structure); }
function __construct(NotORM_Structure $structure = null, NotORM_Cache $cache = null) { $CI =& get_instance(); $CI->load->database(); //required to get the db parameters //Please set $active_record = FALSE & $db['default']['autoinit'] = FALSE; //in case you don't intend to use them, for low resource usage and better performance $connection = new PDO("pgsql:dbname={$CI->db->database};host={$CI->db->hostname};port={$CI->db->port}", $CI->db->username, $CI->db->password); parent::__construct($connection, $structure, $cache); }