Source for file intuition.dbconnection.php

Documentation is available at intuition.dbconnection.php

  1. <?php
  2. /**
  3. @package    jelix
  4. @subpackage db_driver
  5. @author     Yannick Le Guédart
  6. @copyright  2007 Over-blog, 2007 Yannick Le Guédart
  7. @link       http://www.jelix.org
  8. @link       http://www.sinequa.com
  9. @licence    http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  10. */
  11.  
  12. /**
  13.  *
  14.  */
  15. include (LIB_PATH 'intuition/Intuition.inc');
  16. require_once(dirname(__FILE__).'/intuition.dbresultset.php');
  17.  
  18. /**
  19. @package    jelix
  20. @subpackage db_driver
  21. */
  22. class intuitionDbConnection extends jDbConnection {
  23.     /**
  24.     * The intuition session.
  25.     * @access private
  26.     * @var object 
  27.     */
  28.     private $_iSession
  29.  
  30.     public function beginTransaction (){
  31.         return $this->_doExec ('BEGIN');
  32.     }
  33.  
  34.     public function commit (){
  35.         return $this->_doExec ('COMMIT');
  36.     }
  37.  
  38.     public function rollback (){
  39.         return $this->_doExec ('ROLLBACK');
  40.     }
  41.  
  42.     public function prepare ($query){
  43.         throw new JException (
  44.             'jelix~db.error.feature.unsupported'
  45.             array ('intuition','prepare'))
  46.     }
  47.  
  48.     public function errorInfo (){
  49.         return 
  50.             array 
  51.                 'HY000',
  52.                 $this->_iSession->status ()
  53.                 $this->_iSession->status ());
  54.     }
  55.  
  56.     public function errorCode(){
  57.         return $this->_iSession->status ();
  58.     }
  59.  
  60.     protected function _connect (){
  61.         $this->_iSession new iSession ()
  62.         
  63.         if (!isset ($this->profile['port'])){
  64.             $this->profile['port'8088;
  65.         }
  66.         
  67.         $connectionArray array (
  68.             'host'              => $this->profile['host'],
  69.             'port'              => $this->profile['port'],
  70.             'read_only'         => 1,
  71.             'charset'           => in_UTF8,
  72.             'database'          => $this->profile['database'],
  73.             'user'              => $this->profile['user'],
  74.             'password'          => $this->profile['password'],
  75.             'page_size'         => 20,
  76.             'max_answers_count' => 1000,
  77.             'default-language'  => 'en'
  78.             );
  79.  
  80.         $cnx @$this->_iSession->connect ($connectionArray);
  81.         
  82.         if ($cnx){
  83.             return $this->_iSession;
  84.         }else{
  85.             throw new Exception ($this->_iSession->status ());
  86.         }
  87.     }
  88.  
  89.     protected function _disconnect (){
  90.         return $this->_connection->in_close();
  91.     }
  92.  
  93.     protected function _doQuery ($queryString){
  94.         // Remove the carriage returns before anything
  95.         
  96.         $queryString str_replace (array ("\n""\r")" "$queryString);  
  97.         
  98.         // Query execution 
  99.         
  100.         $queryResult $this->_connection->in_query ($queryString);
  101.         
  102.         if (is_object ($queryResultor 
  103.             (is_numeric ($queryResultand $queryResult 0)){
  104.  
  105.             $rs                 new intuitionDbResultSet ($queryResult);
  106.             $rs->_connector     $this;
  107.         }else{
  108.             $rs false;
  109.             throw new Exception ($this->_iSession->status ());
  110.         }
  111.  
  112.         return $rs;
  113.     }
  114.  
  115.     protected function _doLimitQuery $queryString$offset$number)  {
  116.         $queryString.= ' SKIP ' $offset ' COUNT ' $number;
  117.         $result $this->_doQuery($queryString);
  118.         return $result;
  119.     }
  120.     
  121.     protected function _doExec ($query){
  122.         // Remove the carriage returns before anything
  123.         
  124.         $queryString str_replace (array ("\n""\r")" "$queryString);  
  125.         
  126.         // Query execution
  127.         
  128.         $queryResult $this->_connection->in_query ($queryString);
  129.         
  130.         return $queryResult;
  131.     }
  132.  
  133.     public function lastInsertId ($fromSequence=''){
  134.         throw new JException (
  135.             'jelix~db.error.feature.unsupported',
  136.             array ('intuition','lastInsertId'))
  137.     }
  138.  
  139.     protected function _autoCommitNotify ($state){
  140.         throw new JException (
  141.             'jelix~db.error.feature.unsupported'
  142.             array ('intuition','_autoCommitNotify'))
  143.     }
  144.  
  145.     /**
  146.      * @todo support of binary strings
  147.      */
  148.     protected function _quote ($text$binary{
  149.         return quote ($text);
  150.     }
  151.  
  152.     /**
  153.      *
  154.      * @param integer $id the attribut id
  155.      * @return string the attribute value
  156.      * @see PDO::getAttribute()
  157.      */
  158.     public function getAttribute($id{
  159.         return "";
  160.     }
  161.  
  162.     /**
  163.      * 
  164.      * @param integer $id the attribut id
  165.      * @param string $value the attribute value
  166.      * @see PDO::setAttribute()
  167.      */
  168.     public function setAttribute($id$value{
  169.     }
  170.  
  171. }

Documentation generated on Wed, 24 Sep 2014 21:55:53 +0200 by phpDocumentor 1.4.3