• Main Page
  • Data Structures
  • Files
  • File List

sybaseResultset.php

Go to the documentation of this file.
00001 <?php
00002 
00003 /**
00004  * Sybase ASE query resultset 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: sybaseResultset.php,v 1.5 2008-01-26 22:30:28-05 mt_jordan Exp $
00013  */
00014 
00015 class sybaseResultset
00016 {
00017     /**********************************************
00018      * Internal variables
00019      *********************************************/
00020 
00021     /**
00022      * Query record
00023      *
00024      * @access private
00025      * @var    array
00026      */
00027     private $objRecord = array();
00028 
00029     /**
00030      * Query resultset object
00031      *
00032      * @access private
00033      * @var    mixed
00034      */
00035     private $objResult;
00036 
00037     /**********************************************
00038      * Class methods
00039      *********************************************/
00040 
00041     /**
00042      * Constructor
00043      *
00044      * @access public
00045      * @param  mixed $result
00046      * @param  mixed $connection
00047      */
00048     public function __construct( $result )
00049     {
00050         $this->objResult = $result;
00051     }
00052 
00053     /**
00054      * Return num of affected rows from insert/delete/update query
00055      *
00056      * @access public
00057      * @return int
00058      */
00059     public function affected_rows()
00060     {
00061         if ( $this->objResult )
00062             return sybase_affected_rows();
00063     }
00064 
00065     /**
00066      * Return resultset as assoc array
00067      *
00068      * @access public
00069      * @return mixed
00070      */
00071     public function fetch_array()
00072     {
00073         if ( $this->objResult )
00074         {
00075             $this->objRecord = sybase_fetch_assoc( $this->objResult );
00076 
00077             return ( $this->objRecord !== false );
00078         }
00079     }
00080 
00081     /**
00082      * Return resultset as object
00083      *
00084      * @access public
00085      * @return mixed
00086      */
00087     public function fetch_object()
00088     {
00089         if ( $this->objResult )
00090             return sybase_fetch_object( $this->objResult );
00091     }
00092 
00093     /**
00094      * Return resultset as numeric array
00095      *
00096      * @access public
00097      * @return mixed
00098      */
00099     public function fetch_row()
00100     {
00101         if ( $this->objResult )
00102         {
00103             $this->objRecord = sybase_fetch_row( $this->objResult );
00104 
00105             return ( $this->objRecord !== false );
00106         }
00107     }
00108 
00109     /**
00110      * Return record from select query
00111      *
00112      * @access public
00113      * @param  mixed $field
00114      * @return mixed
00115      */
00116     public function field( $field )
00117     {
00118         if ( $this->objResult )
00119         {
00120             if ( get_magic_quotes_runtime() )
00121                 return stripslashes( $this->objRecord[$field] );
00122             else
00123                 return $this->objRecord[$field];
00124         }
00125     }
00126 
00127     /**
00128      * Free resultset memory - destroy resultset object
00129      *
00130      * @access public
00131      */
00132     public function flush()
00133     {
00134         if ( $this->objResult )
00135         {
00136             sybase_free_result( $this->objResult );
00137             $this->objRecord = array();
00138             $this->objResult = null;
00139         }
00140     }
00141 
00142     /**
00143      * Return num fields from select query
00144      *
00145      * @access public
00146      * @return int
00147      */
00148     public  function num_fields()
00149     {
00150         if ( $this->objResult )
00151             return sybase_num_fields( $this->objResult );
00152     }
00153 
00154     /**
00155      * Return num rows from select query
00156      *
00157      * @access public
00158      * @return int
00159      */
00160     public function num_rows()
00161     {
00162         if ( $this->objResult )
00163             return sybase_num_rows( $this->objResult );
00164     }
00165 
00166     /**
00167      * Return resultset object
00168      *
00169      * @access public
00170      * @return mixed
00171      */
00172     public function result()
00173     {
00174         return $this->objResult;
00175     }
00176 }
00177 
00178 ?>

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