helper_plugin_data::_getDB PHP Method

_getDB() public method

load the sqlite helper
public _getDB ( ) : helper_plugin_sqlite | false
return helper_plugin_sqlite | false plugin or false if failed
    function _getDB()
    {
        if ($this->db === null) {
            $this->db = plugin_load('helper', 'sqlite');
            if ($this->db === null) {
                msg('The data plugin needs the sqlite plugin', -1);
                return false;
            }
            if (!$this->db->init('data', dirname(__FILE__) . '/db/')) {
                $this->db = null;
                return false;
            }
            $this->db->create_function('DATARESOLVE', array($this, '_resolveData'), 2);
        }
        return $this->db;
    }

Usage Example

 public function setUp()
 {
     parent::setUp();
     $this->action = new action_plugin_data();
     $this->helper = plugin_load('helper', 'data');
     $this->db = $this->helper->_getDB();
     $this->db->query('INSERT INTO pages ( pid, page, title , class , lastmod) VALUES
         (?, ?, ?, ?, ?)', 1, 'test', 'title', 'class', time());
 }
All Usage Examples Of helper_plugin_data::_getDB