20 protected $m_sColumnQuoteBegin =
"[";
25 protected $m_sColumnQuoteEnd =
"]";
34 public function __construct($aConnectionDetails, $sDatabaseID)
36 $sDsn = arr_get($aConnectionDetails,
'sDsn',
'');
37 $this->m_sDBUser = arr_get($aConnectionDetails,
'sUser',
'');
38 $sPassword = arr_get($aConnectionDetails,
'sPassword',
'');
39 $this->m_sDataBaseID = arr_get($aConnectionDetails,
'sDatabaseID',
'');
40 $this->m_sDBAuthType = arr_get($aConnectionDetails,
'sDBAuthType',
'');
41 $this->m_aDataBases = arr_get($aConnectionDetails,
'aDataBases', []);
44 $this->m_oDB = new \PDO($sDsn, $this->m_sDBUser, $sPassword);
46 catch (\PDOException $oPDOException)
48 $sDsn = str_replace(
"Driver={Microsoft Access Driver (*.mdb)",
"Driver={Microsoft Access Driver (*.mdb" . ACCDB_STRING .
")", $sDsn);
49 $this->m_oDB = new \PDO($sDsn, $this->m_sDBUser, $sPassword);
63 $sSelectSQL =
"SELECT";
64 if (!empty($aQuery[
"limit"]))
66 $sSelectSQL .=
" TOP $aQuery[limit] ";
68 if (!empty($aQuery[
"select"]))
70 $sSelectSQL .=
" $aQuery[select] ";
76 if (!empty($aQuery[
"from"]))
78 $sSelectSQL .=
"FROM ";
79 if (!empty($aQuery[
"join"]))
81 $sSelectSQL .=
"($aQuery[from] $aQuery[join])";
85 $sSelectSQL .=
"$aQuery[from] ";
88 if (!empty($aQuery[
"where"]))
90 $sSelectSQL .=
"WHERE $aQuery[where] ";
92 if (!empty($aQuery[
"group_by"]))
94 $sSelectSQL .=
"GROUP BY $aQuery[group_by] ";
96 if (!empty($aQuery[
"order_by"]))
98 $sSelectSQL .=
"ORDER BY $aQuery[order_by] ";
115 $nMaxKey = count($aJoinTables) - 1;
116 foreach (array_reverse($aJoinTables) as $nKey => $sJoinTable)
121 $sJoinTmp =
" $sJoinTable ";
125 $sJoinTmp =
" ($sJoinTable $sJoins) ";
127 $sJoins = arr_get($aJoinDirections, $nMaxKey - $nKey,
"INNER JOIN")
129 .
"ON (" . $this->
CompileJoinOn(arr_get($aJoinOns, $nMaxKey - $nKey,
"")) .
")";
143 $sData = iconv(
"UTF-8",
"WINDOWS-1256", $sData);
144 return str_replace(
"'",
"''", $sData);
156 return $bData ? -1 : 0;
static get($sChannel="default", $sLogRoot="")
__construct($aConnectionDetails, $sDatabaseID)
ConcatenateJoins($aJoinDirections, $aJoinTables, $aJoinOns)
CompileSelectSql($aQuery=[])
CompileJoinOn($aJoinOn=[])