• Main Page
  • Data Structures
  • Files
  • File List

ingresConnection.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /**
00004  * Ingres 2006 database connection class
00005  *
00006  * @package objSQL
00007  * @version 2.1.0
00008  * @author MT Jordan <mtjo62@gmail.com>
00009  * @link http://objsql.sourceforge.net
00010  * @copyright 2004-2010 openSource Partners
00011  * @license LGPL
00012  * @revision $Id: ingresConnection.php,v 1.5 2008-01-30 21:36:36-05 mt_jordan Exp $
00013  */
00014 
00015 class ingresConnection
00016 {
00017     /**********************************************
00018      * Internal variables
00019      *********************************************/
00020 
00021     /**
00022      * Database connection object
00023      *
00024      * @access private
00025      * @var    mixed
00026      */
00027     private $objConnection;
00028 
00029     /**
00030      * Database connection information
00031      *
00032      * @access private
00033      * @var    array
00034      */
00035     private $objDatasource;
00036 
00037     /**********************************************
00038      * Class methods
00039      *********************************************/
00040 
00041     /**
00042      * Constructor
00043      *
00044      * @access public
00045      * @param  array $datasource
00046      */
00047     public function __construct( $datasource )
00048     {
00049         $this->objDatasource    = $datasource;
00050         $this->objDatasource[5] = ( array_key_exists( 5, $this->objDatasource ) && $this->objDatasource[5] ) ? true : false;
00051     }
00052 
00053     /**
00054      * Connect to database server
00055      *
00056      * @access public
00057      * @return mixed
00058      */
00059     public function objDbConnection()
00060     {
00061         $this->objConnection = ( $this->objDatasource[5] ) ? ingres_pconnect( $this->objDatasource[4], $this->objDatasource[2], $this->objDatasource[3] )
00062                                                            : ingres_connect( $this->objDatasource[4], $this->objDatasource[2], $this->objDatasource[3] );
00063 
00064         //turn autocommit on
00065         if ( $this->objConnection )
00066             ingres_autocommit( $this->objConnection );
00067         else
00068             trigger_error( ingres_error(), E_USER_WARNING );
00069 
00070         return $this->objConnection;
00071     }
00072 
00073     /**
00074      * Close connection to database server
00075      *
00076      * @access public
00077      * @return bool
00078      */
00079     public function objDbClose()
00080     {
00081         return ingres_close( $this->objConnection );
00082     }
00083 
00084     /**
00085      * Return info on database server
00086      *
00087      * @access public
00088      * @return str
00089      */
00090     public function objServerVersion()
00091     {
00092         $objStmt   = ingres_query( "SELECT dbmsinfo( '_version' )", $this->objConnection );
00093         $objResult = ingres_fetch_array( $objStmt );
00094 
00095         return $objResult['col1'];
00096     }
00097 }
00098 
00099 ?>

Generated on Sat Jul 10 2010 15:14:38 for objSQL 2.1.0 by  doxygen 1.7.1