• Main Page
  • Data Structures
  • Files
  • File List

firebirdConnection.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /**
00004  * Firebird/Interbase 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: firebirdConnection.php,v 1.6 2008-01-30 21:36:28-05 mt_jordan Exp $
00013  */
00014 
00015 class firebirdConnection
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      * @param array $datasource
00045      */
00046     public function __construct( $datasource )
00047     {
00048         $this->objDatasource    = $datasource;
00049         $this->objDatasource[5] = ( array_key_exists( 5, $this->objDatasource ) && $this->objDatasource[5] ) ? true : false;
00050     }
00051 
00052     /**
00053      * Connect to database server
00054      *
00055      * @return mixed
00056      */
00057     public function objDbConnection()
00058     {
00059         $objStr = $this->objDatasource[1] . ':' . $this->objDatasource[4];
00060 
00061         $this->objConnection = ( $this->objDatasource[5] ) ? ibase_pconnect( $objStr, $this->objDatasource[2], $this->objDatasource[3] )
00062                                                            : ibase_connect( $objStr, $this->objDatasource[2], $this->objDatasource[3] );
00063 
00064         if ( !$this->objConnection )
00065             trigger_error( ibase_errmsg(), E_USER_WARNING );
00066 
00067         return $this->objConnection;
00068     }
00069 
00070     /**
00071      * Close connection to database server
00072      *
00073      * @access public
00074      * @return bool
00075      */
00076     public function objDbClose()
00077     {
00078         return ibase_close( $this->objConnection );
00079     }
00080 
00081     /**
00082      * Return info on database server
00083      *
00084      * @access public
00085      * @return str
00086      */
00087     public function objServerVersion()
00088     {
00089         $objSvc = ibase_service_attach( $this->objDatasource[1], $this->objDatasource[2], $this->objDatasource[3] );
00090         $objVer = ibase_server_info( $objSvc, IBASE_SVC_SERVER_VERSION ) . ' - ' . ibase_server_info( $objSvc, IBASE_SVC_IMPLEMENTATION );
00091         ibase_service_detach( $objSvc );
00092 
00093         return $objVer;
00094     }
00095 }
00096 ?>

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