Author: mg[at]swiftly[dot]org
Inheritance: implements Swiftriver\Core\DAL\DataContextInterfaces\IAPIKeyDataContext, implements Swiftriver\Core\DAL\DataContextInterfaces\IChannelDataContext, implements Swiftriver\Core\DAL\DataContextInterfaces\IContentDataContext, implements Swiftriver\Core\DAL\DataContextInterfaces\ISourceDataContext, implements Swiftriver\Core\DAL\DataContextInterfaces\ITrustLogDataContext
 /**
  * This function returns an initilised \PDO object that
  * can be used by the calling class to access the data
  * store. The implementation of generating the \PDO
  * object is switched on the DataContentType property
  * of the $request parameter
  * 
  * @param \Swiftriver\Core\Analytics\AnalyticsRequest $request
  * @return \PDO
  */
 public function PDOConnection($request)
 {
     switch ($request->DataContextType) {
         case "\\Swiftriver\\Core\\Modules\\DataContext\\MySql_V2\\DataContext":
             return \Swiftriver\Core\Modules\DataContext\MySql_V2\DataContext::PDOConnection();
         default:
             return null;
     }
 }
 /**
  * This function should allow calling classes to run basic sql select
  * statements and switch the implmentation based on the data content
  * type.
  * 
  * @param string $sql
  * @return array["results","errors"]
  */
 public function RunGenericQuery($sql)
 {
     $dataContext = \Swiftriver\Core\Setup::DALConfiguration()->DataContextType;
     switch ($dataContext) {
         case "\\Swiftriver\\Core\\Modules\\DataContext\\MySql_V2\\DataContext":
             $db = \Swiftriver\Core\Modules\DataContext\MySql_V2\DataContext::PDOConnection();
             $statement = $db->prepare($sql);
             $result = $statement->execute();
             return $result == false ? array("results" => array(), "errors" => $statement->errorInfo()) : array("results" => $statement->fetchAll(), "errors" => null);
     }
 }