Tutorial Extension  1.0.0
SellerDeck Extensions - Tutorial Extension
Public Member Functions | Protected Attributes | List of all members
CMockAccessOdbcPdo Class Reference

Public Member Functions

 __construct ($sDsn, $sDBUser, $sPassword)
 
 prepare ($sQuery)
 
 tables ()
 
 tableExists ($sTableName)
 
 lastInsertId ()
 
 exec ($sStatement)
 
 query ($sStatement, $nReturnType=\PDO::FETCH_ASSOC)
 
 fetch ($sFetchStyle=null, $sCursorOrientation=\PDO::FETCH_ORI_NEXT, $nCursorOffset=0)
 
 fetchAll ($sFetchStyle=null, $sFetchArgument=null, array $aCtorArgs=[])
 

Protected Attributes

 $m_oConnection
 
 $m_oResult = null
 

Detailed Description

Definition at line 53 of file CDataBaseAccessNoPDO.php.

Constructor & Destructor Documentation

__construct (   $sDsn,
  $sDBUser,
  $sPassword 
)

__construct - Object constructor method

public

Parameters
string$sDsnDSN
string$sDBUserDB User
string$sPasswordPassword
Returns
void

Definition at line 75 of file CDataBaseAccessNoPDO.php.

76  {
77  $this->m_oConnection = odbc_connect($sDsn, $sDBUser, $sPassword);
78  }

Member Function Documentation

exec (   $sStatement)

exec - Execute query

public

Parameters
string$sStatementStatement
Returns
int|bool Number of rows or FALSE on failure

Definition at line 142 of file CDataBaseAccessNoPDO.php.

143  {
144  $oResult = odbc_exec($this->m_oConnection, $sStatement);
145  return $oResult === false ? false : odbc_num_rows($oResult);
146  }
fetch (   $sFetchStyle = null,
  $sCursorOrientation = \PDO::FETCH_ORI_NEXT,
  $nCursorOffset = 0 
)

fetch - Fetch result array

public

Parameters
string$sFetchStyleFetch Style
string$sCursorOrientationCursor Orientation
int$nCursorOffsetCursor Offset
Returns
array|bool An array that corresponds to the fetched row, or FALSE if there are no more rows.

Definition at line 171 of file CDataBaseAccessNoPDO.php.

172  {
173  return odbc_fetch_array($this->m_oResult);
174  }
fetchAll (   $sFetchStyle = null,
  $sFetchArgument = null,
array  $aCtorArgs = [] 
)

fetchAll - Fetch all results

public

Parameters
string$sFetchStyleFetch Style
string$sFetchArgumentFetch Argument
array$aCtorArgsCtor Args
Returns
array Array of results

Definition at line 185 of file CDataBaseAccessNoPDO.php.

186  {
187  $aResultSet = [];
188  while ($aResult = odbc_fetch_array($this->m_oResult))
189  {
190  $aResultSet[] = $aResult;
191  }
192  return $aResultSet;
193  }
lastInsertId ( )

lastInsertId - Last Insert ID

public

Returns
mixed Last Insert ID

Definition at line 127 of file CDataBaseAccessNoPDO.php.

128  {
129  $oStatement = odbc_prepare($this->m_oConnection, "SELECT LAST_INSERT_ID()");
130  odbc_execute($oStatement);
131  $oResource = odbc_fetch_array($oStatement);
132  return $oResource['LAST_INSERT_ID'];
133  }
prepare (   $sQuery)

prepare - Prepare query

public

Parameters
string$sQueryQuery
Returns
CMockAccessOdbcPdoStatement

Definition at line 87 of file CDataBaseAccessNoPDO.php.

88  {
89  return new CMockAccessOdbcPdoStatement($this->m_oConnection, $sQuery);
90  }
query (   $sStatement,
  $nReturnType = \PDO::FETCH_ASSOC 
)

query - Execute query

public

Parameters
string$sStatementStatement
int$nReturnTypeReturn Type
Returns
CMockAccessOdbcPdo This object

Definition at line 156 of file CDataBaseAccessNoPDO.php.

157  {
158  $this->m_oResult = odbc_exec($this->m_oConnection, $sStatement);
159  return $this;
160  }
tableExists (   $sTableName)

tableExists - Does table exist?

public

Parameters
string$sTableNameTable Name
Returns
bool Table exist

Definition at line 110 of file CDataBaseAccessNoPDO.php.

111  {
112  $oResult = $this->tables();
113  $bFound = false;
114  while (!$bFound && $aResult = odbc_fetch_array($oResult))
115  {
116  $bFound = $sTableName == $aResult["TABLE_NAME"];
117  }
118  return $bFound;
119  }
tables ( )

tables - Getting tables

public

Returns
resource|bool An ODBC result identifier containing table information or FALSE on failure.

Definition at line 98 of file CDataBaseAccessNoPDO.php.

99  {
100  return odbc_tables($this->m_oConnection);
101  }

The documentation for this class was generated from the following file: