24 public function __construct($aConnectionDetails, $sDatabaseID)
29 $sDsn = arr_get($aConnectionDetails,
'sDsn',
'');
30 $this->m_sDBUser = arr_get($aConnectionDetails,
'sUser',
'');
31 $sPassword = arr_get($aConnectionDetails,
'sPassword',
'');
32 $this->m_sDataBaseID = arr_get($aConnectionDetails,
'sDatabaseID',
'');
33 $this->m_aDataBases = arr_get($aConnectionDetails,
'aDataBases', []);
39 echo $e->getMessage();
59 protected $m_oConnection;
64 protected $m_oResult = null;
77 $this->m_oConnection = odbc_connect($sDsn, $sDBUser, $sPassword);
100 return odbc_tables($this->m_oConnection);
112 $oResult = $this->
tables();
114 while (!$bFound && $aResult = odbc_fetch_array($oResult))
116 $bFound = $sTableName == $aResult[
"TABLE_NAME"];
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'];
142 public function exec($sStatement)
144 $oResult = odbc_exec($this->m_oConnection, $sStatement);
145 return $oResult ===
false ?
false : odbc_num_rows($oResult);
156 public function query($sStatement, $nReturnType = \PDO::FETCH_ASSOC)
158 $this->m_oResult = odbc_exec($this->m_oConnection, $sStatement);
171 public function fetch($sFetchStyle = null, $sCursorOrientation = \PDO::FETCH_ORI_NEXT, $nCursorOffset = 0)
173 return odbc_fetch_array($this->m_oResult);
185 public function fetchAll($sFetchStyle = null, $sFetchArgument = null, array $aCtorArgs = [])
188 while ($aResult = odbc_fetch_array($this->m_oResult))
190 $aResultSet[] = $aResult;
216 protected $m_aParams;
221 protected $m_oStatement;
234 $this->m_sQuery = $sQuery;
235 $this->m_aParams = null;
237 $this->m_oStatement = odbc_prepare($oConnection, $this->m_sQuery);
250 $this->m_aParams[$sParam] = $vValue;
261 if ($this->m_aParams == null)
263 odbc_execute($this->m_oStatement);
267 odbc_execute($this->m_oStatement, $this->m_aParams);
279 public function fetch($vOption = null)
281 return odbc_fetch_array($this->m_oStatement);
293 $aQueries = explode(
" ", $sQuery);
296 while (isset($aQueries[$nIndex]))
298 if (preg_match(
"/^:/", $aQueries[$nIndex]))
300 $this->m_aParams[$aQueries[$nIndex]] = null;
316 while (isset($this->m_aParams[$nIndex]))
318 $this->m_aParams[$nIndex] = null;
query($sStatement, $nReturnType=\PDO::FETCH_ASSOC)
static get($sChannel="default", $sLogRoot="")
__construct($sDsn, $sDBUser, $sPassword)
__construct($oConnection, $sQuery)
__construct($aConnectionDetails, $sDatabaseID)
fetch($sFetchStyle=null, $sCursorOrientation=\PDO::FETCH_ORI_NEXT, $nCursorOffset=0)
fetchAll($sFetchStyle=null, $sFetchArgument=null, array $aCtorArgs=[])
bindValue($sParam, $vValue)