399 $sqlGroupByList =
array();
401 $sqlSelect =
array();
406 $strDBType =
$DB->type;
407 $oracleEdition = (
'ORACLE' == $strDBType);
409 $arGroupByFunct =
array(
418 if (!empty($arGroupBy) && is_array($arGroupBy))
420 $arSelectFields = $arGroupBy;
421 foreach ($arGroupBy as
$key =>
$val)
435 if (!empty($sqlGroupByList))
436 $strSqlGroupBy = implode(
', ', $sqlGroupByList);
440 if (empty($arGroupBy) && is_array($arGroupBy))
442 $sqlSelect[] =
'COUNT(%%_DISTINCT_%% '.$firstField[
'FIELD'].
') as CNT';
446 if (isset($arSelectFields) && !is_array($arSelectFields))
448 $arSelectFields =
array($arSelectFields);
450 if (!empty($arSelectFields) && is_array($arSelectFields) && !in_array(
'*', $arSelectFields))
452 $arClearFields =
array();
453 foreach ($arSelectFields as
$key =>
$val)
460 $arSelectFields = $arClearFields;
464 empty($arSelectFields)
465 || !is_array($arSelectFields)
466 || in_array(
"*", $arSelectFields)
469 foreach (
$arFields as $fieldKey => $fieldDescr)
471 if (isset($fieldDescr[
'WHERE_ONLY']) &&
'Y' == $fieldDescr[
'WHERE_ONLY'])
475 switch ($fieldDescr[
'TYPE'])
479 if (isset($arOrder[$fieldKey]))
480 $sqlSelect[] = $fieldDescr[
'FIELD'].
' as '.$fieldKey.
'_X1';
482 $sqlSelect[] =
$DB->DateToCharFunction(
483 $fieldDescr[
'FIELD'],
484 (
'datetime' == $fieldDescr[
'TYPE'] ?
'FULL' :
'SHORT')
488 $sqlSelect[] = $fieldDescr[
'FIELD'].
' as '.$fieldKey;
491 if (isset($fieldDescr[
'FROM']) && !empty($fieldDescr[
'FROM']))
493 $sqlFrom[$fieldDescr[
'FROM']] =
true;
499 foreach ($arSelectFields as
$key =>
$val)
505 if (isset($arGroupByFunct[
$key]))
515 if (isset($arOrder[
$val]))
518 $sqlSelect[] =
$DB->DateToCharFunction(
536 if (!empty($sqlGroupByList))
538 $sqlSelect[] =
'COUNT(%%_DISTINCT_%% '.$firstField[
'FIELD'].
') as CNT';
542 $sqlSelect[0] =
'%%_DISTINCT_%% '.$sqlSelect[0];
548 $arSqlSearch =
array();
552 for (
$i = 0, $intCount =
count($filter_keys);
$i < $intCount;
$i++)
555 $vals = (!is_array($vals) ?
array($vals) : array_values($vals));
561 $key = $key_res[
"FIELD"];
562 $strNegative = $key_res[
"NEGATIVE"];
563 $strOperation = $key_res[
"OPERATION"];
564 $strOrNull = $key_res[
"OR_NULL"];
568 $arSqlSearch_tmp =
array();
572 if ($strOperation ==
"IN")
576 $arSqlSearch_tmp1 = call_user_func_array(
580 if ($arSqlSearch_tmp1 !==
false)
581 $arSqlSearch_tmp[] = $arSqlSearch_tmp1;
587 $clearVals =
array();
588 foreach ($vals as $item)
591 $clearVals[$item] = $item;
594 if (empty($clearVals))
595 $arSqlSearch_tmp[] =
'(1 = 2)';
597 $arSqlSearch_tmp[] = ($strNegative ==
'Y' ?
' NOT ' :
'').
'('.
$arFields[
$key][
'FIELD'].
' IN ('.implode(
',', $clearVals).
'))';
602 $clearVals =
array();
603 foreach ($vals as $item)
604 $clearVals[] = (float)$item;
606 if (empty($clearVals))
608 $arSqlSearch_tmp[] =
'(1 = 2)';
612 $clearVals = array_unique($clearVals);
613 $arSqlSearch_tmp[] = ($strNegative ==
'Y' ?
' NOT ' :
'').
'('.
$arFields[
$key][
'FIELD'].
' IN ('.implode(
',', $clearVals).
'))';
619 $clearVals =
array();
620 foreach ($vals as $item)
621 $clearVals[] =
"'".$DB->ForSql($item).
"'";
623 if (empty($clearVals))
625 $arSqlSearch_tmp[] =
'(1 = 2)';
629 $clearVals = array_unique($clearVals);
630 $arSqlSearch_tmp[] = (($strNegative ==
'Y') ?
' NOT ' :
'').
'('.
$arFields[
$key][
'FIELD'].
' '.$strOperation.
' ('.implode(
',', $clearVals).
'))';
636 $valueFormat = (
$arFields[
$key][
'TYPE'] ==
'datetime' ?
'FULL' :
'SHORT');
637 $clearVals =
array();
638 foreach ($vals as $item)
639 $clearVals[] =
$DB->CharToDateFunction($item, $valueFormat);
641 if (empty($clearVals))
643 $arSqlSearch_tmp[] =
'(1 = 2)';
647 $clearVals = array_unique($clearVals);
648 $arSqlSearch_tmp[] = ($strNegative ==
'Y'?
' NOT ' :
'').
'('.
$arFields[
$key][
'FIELD'].
' '.$strOperation.
' ('.implode(
',', $clearVals).
'))';
650 unset($clearVals, $valueFormat);
656 for ($j = 0, $intCountVals =
count($vals); $j < $intCountVals; $j++)
662 $arSqlSearch_tmp1 = call_user_func_array(
666 if ($arSqlSearch_tmp1 !==
false)
667 $arSqlSearch_tmp[] = $arSqlSearch_tmp1;
673 if ((
int)
$val == 0 && mb_strpos($strOperation,
"=") !==
false)
674 $arSqlSearch_tmp[] =
"(".$arFields[
$key][
"FIELD"].
" IS ".(($strNegative ==
"Y") ?
"NOT " :
"").
"NULL) ".(($strNegative ==
"Y") ?
"AND" :
"OR").
" ".(($strNegative ==
"Y") ?
"NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" 0)";
676 $arSqlSearch_tmp[] = (($strNegative ==
"Y") ?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" ".(
int)
$val.
" )";
682 if ((
float)
$val == 0 && mb_strpos($strOperation,
"=") !==
false)
683 $arSqlSearch_tmp[] =
"(".$arFields[
$key][
"FIELD"].
" IS ".(($strNegative ==
"Y") ?
"NOT " :
"").
"NULL) ".(($strNegative ==
"Y") ?
"AND" :
"OR").
" ".(($strNegative ==
"Y") ?
"NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" 0)";
685 $arSqlSearch_tmp[] = (($strNegative ==
"Y") ?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" ".(
float)
$val.
" )";
689 if ($strOperation ==
"QUERY")
695 if ((
$val ==
'') && (mb_strpos($strOperation,
"=") !==
false))
696 $arSqlSearch_tmp[] =
"(".$arFields[
$key][
"FIELD"].
" IS ".(($strNegative ==
"Y") ?
"NOT " :
"").
"NULL) ".(($strNegative ==
"Y") ?
"AND NOT" :
"OR").
" (".
$DB->Length(
$arFields[
$key][
"FIELD"]).
" <= 0) ".(($strNegative ==
"Y") ?
"AND NOT" :
"OR").
" (".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" '".
$DB->ForSql(
$val).
"' )";
698 $arSqlSearch_tmp[] = (($strNegative ==
"Y") ?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" '".
$DB->ForSql(
$val).
"' )";
704 $arSqlSearch_tmp[] = ($strNegative==
"Y"?
"NOT":
"").
"(".
$arFields[
$key][
"FIELD"].
" IS NULL)";
706 $arSqlSearch_tmp[] = ($strNegative==
"Y"?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT ":
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" ".
$DB->CharToDateFunction(
$val,
"FULL").
")";
711 $arSqlSearch_tmp[] = ($strNegative==
"Y"?
"NOT":
"").
"(".
$arFields[
$key][
"FIELD"].
" IS NULL)";
713 $arSqlSearch_tmp[] = ($strNegative==
"Y"?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT ":
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" ".
$DB->CharToDateFunction(
$val,
"SHORT").
")";
725 $strSqlSearch_tmp =
"";
726 for ($j = 0, $intCountSearch =
count($arSqlSearch_tmp); $j < $intCountSearch; $j++)
729 $strSqlSearch_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
730 $strSqlSearch_tmp .=
"(".$arSqlSearch_tmp[$j].
")";
732 if ($strOrNull ==
"Y")
734 if ($strSqlSearch_tmp <>
'')
735 $strSqlSearch_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
736 $strSqlSearch_tmp .=
"(".$arFields[
$key][
"FIELD"].
" IS ".($strNegative==
"Y" ?
"NOT " :
"").
"NULL)";
740 if ($strSqlSearch_tmp <>
'')
741 $strSqlSearch_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
742 $strSqlSearch_tmp .=
"(".$arFields[
$key][
"FIELD"].
" ".($strNegative==
"Y" ?
"<>" :
"=").
" 0)";
746 if ($strSqlSearch_tmp <>
'')
747 $strSqlSearch_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
748 $strSqlSearch_tmp .=
"(".$arFields[
$key][
"FIELD"].
" ".($strNegative==
"Y" ?
"<>" :
"=").
" '')";
752 if ($strSqlSearch_tmp !=
"")
753 $arSqlSearch[] =
"(".$strSqlSearch_tmp.
")";
757 if (!empty($arSqlSearch))
758 $strSqlWhere =
'('.implode(
') and (', $arSqlSearch).
')';
762 $arSqlOrder =
array();
763 $sortExist =
array();
764 foreach ($arOrder as $by =>
$order)
766 $by = mb_strtoupper($by);
773 $order .= (
$order ==
'ASC' ?
' NULLS FIRST' :
' NULLS LAST');
778 if (isset($sortExist[$by]))
780 $sortExist[$by] =
true;
788 if (!empty($arSqlOrder))
790 $strSqlOrderBy = implode (
', ', $arSqlOrder);
794 $sqlFromTables =
array();
795 if (!empty($sqlFrom))
797 $sqlFromTables = array_keys($sqlFrom);
798 $strSqlFrom = implode(
' ', $sqlFromTables);
801 if (!empty($sqlSelect))
803 $strSqlSelect = implode(
', ', $sqlSelect);
807 'SELECT' => $strSqlSelect,
808 'FROM' => $strSqlFrom,
809 'WHERE' => $strSqlWhere,
810 'GROUPBY' => $strSqlGroupBy,
811 'ORDERBY' => $strSqlOrderBy,
812 'SELECT_FIELDS' => $sqlSelect,
813 'FROM_TABLES' => $sqlFromTables,
814 'GROUPBY_FIELDS' => $sqlGroupByList,
815 'ORDERBY_FIELDS' => array_keys($sortExist)
828 $sqlGroupByList =
array();
830 $strDBType =
$DB->type;
831 $oracleEdition = (
'ORACLE' == $strDBType);
833 $arGroupByFunct =
array(
841 $arAlreadyJoined =
array();
844 if (!empty($arGroupBy) && is_array($arGroupBy))
846 foreach ($arGroupBy as
$key =>
$val)
858 if ($strSqlFrom <>
'')
866 if (!empty($sqlGroupByList))
867 $strSqlGroupBy = implode(
', ', $sqlGroupByList);
873 if (empty($arGroupBy) && is_array($arGroupBy))
875 $strSqlSelect =
"COUNT(%%_DISTINCT_%% ".$arFields[$arFieldsKeys[0]][
"FIELD"].
") as CNT ";
880 isset($arSelectFields)
881 && is_string($arSelectFields)
882 &&
'' != $arSelectFields
886 $arSelectFields =
array($arSelectFields);
889 if (empty($arSelectFields)
890 || !is_array($arSelectFields)
891 || in_array(
"*", $arSelectFields))
893 for (
$i = 0, $intCount =
count($arFieldsKeys);
$i < $intCount;
$i++)
895 if (isset(
$arFields[$arFieldsKeys[
$i]][
"WHERE_ONLY"])
896 &&
$arFields[$arFieldsKeys[
$i]][
"WHERE_ONLY"] ==
"Y")
901 if (
'' != $strSqlSelect)
902 $strSqlSelect .=
", ";
904 if (
$arFields[$arFieldsKeys[
$i]][
"TYPE"] ==
"datetime")
906 if (isset($arOrder[$arFieldsKeys[
$i]]))
907 $strSqlSelect .=
$arFields[$arFieldsKeys[
$i]][
"FIELD"].
" as ".$arFieldsKeys[
$i].
"_X1, ";
909 $strSqlSelect .=
$DB->DateToCharFunction(
$arFields[$arFieldsKeys[
$i]][
"FIELD"],
"FULL").
" as ".$arFieldsKeys[
$i];
913 if (isset($arOrder[$arFieldsKeys[
$i]]))
914 $strSqlSelect .=
$arFields[$arFieldsKeys[
$i]][
"FIELD"].
" as ".$arFieldsKeys[
$i].
"_X1, ";
916 $strSqlSelect .=
$DB->DateToCharFunction(
$arFields[$arFieldsKeys[
$i]][
"FIELD"],
"SHORT").
" as ".$arFieldsKeys[
$i];
919 $strSqlSelect .=
$arFields[$arFieldsKeys[
$i]][
"FIELD"].
" as ".$arFieldsKeys[
$i];
923 && !in_array(
$arFields[$arFieldsKeys[
$i]][
"FROM"], $arAlreadyJoined))
925 if ($strSqlFrom <>
'')
927 $strSqlFrom .=
$arFields[$arFieldsKeys[
$i]][
"FROM"];
928 $arAlreadyJoined[] =
$arFields[$arFieldsKeys[
$i]][
"FROM"];
934 foreach ($arSelectFields as
$key =>
$val)
940 if (
'' != $strSqlSelect)
941 $strSqlSelect .=
", ";
943 if (isset($arGroupByFunct[
$key]))
951 if (isset($arOrder[
$val]))
958 if (isset($arOrder[
$val]))
971 if (
'' != $strSqlFrom)
980 if (
'' != $strSqlGroupBy)
982 if (
'' != $strSqlSelect)
983 $strSqlSelect .=
", ";
984 $strSqlSelect .=
"COUNT(%%_DISTINCT_%% ".$arFields[$arFieldsKeys[0]][
"FIELD"].
") as CNT";
988 $strSqlSelect =
"%%_DISTINCT_%% ".$strSqlSelect;
994 $arSqlSearch = Array();
995 $arSqlHaving = Array();
999 for (
$i = 0, $intCount =
count($filter_keys);
$i < $intCount;
$i++)
1002 $vals = (!is_array($vals) ?
array($vals) : array_values($vals));
1006 if (empty($key_res))
1008 $key = $key_res[
"FIELD"];
1009 $strNegative = $key_res[
"NEGATIVE"];
1010 $strOperation = $key_res[
"OPERATION"];
1011 $strOrNull = $key_res[
"OR_NULL"];
1015 $arSqlSearch_tmp =
array();
1016 $arSqlHaving_tmp =
array();
1017 for ($j = 0, $intCountVals =
count($vals); $j < $intCountVals; $j++)
1023 $arSqlSearch_tmp1 = call_user_func_array(
1027 if ($arSqlSearch_tmp1 !==
false)
1030 $arSqlHaving_tmp[] = $arSqlSearch_tmp1;
1032 $arSqlSearch_tmp[] = $arSqlSearch_tmp1;
1037 $arSqlSearch_tmp1 =
"";
1041 if ((
int)
$val == 0 && mb_strpos($strOperation,
"=") !==
false)
1042 $arSqlSearch_tmp1 =
"(".$arFields[
$key][
"FIELD"].
" IS ".(($strNegative ==
"Y") ?
"NOT " :
"").
"NULL) ".(($strNegative ==
"Y") ?
"AND" :
"OR").
" ".(($strNegative ==
"Y") ?
"NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" 0)";
1044 $arSqlSearch_tmp1 = (($strNegative ==
"Y") ?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" ".(
int)
$val.
" )";
1048 $val = str_replace(
",",
".",
$val);
1050 if ((
float)
$val == 0 && mb_strpos($strOperation,
"=") !==
false)
1051 $arSqlSearch_tmp1 =
"(".$arFields[
$key][
"FIELD"].
" IS ".(($strNegative ==
"Y") ?
"NOT " :
"").
"NULL) ".(($strNegative ==
"Y") ?
"AND" :
"OR").
" ".(($strNegative ==
"Y") ?
"NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" 0)";
1053 $arSqlSearch_tmp1 = (($strNegative ==
"Y") ?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" ".(
float)
$val.
" )";
1057 if ($strOperation ==
"QUERY")
1063 if ((
$val ==
'') && (mb_strpos($strOperation,
"=") !==
false))
1064 $arSqlSearch_tmp1 =
"(".$arFields[
$key][
"FIELD"].
" IS ".(($strNegative ==
"Y") ?
"NOT " :
"").
"NULL) ".(($strNegative ==
"Y") ?
"AND NOT" :
"OR").
" (".
$DB->Length(
$arFields[
$key][
"FIELD"]).
" <= 0) ".(($strNegative ==
"Y") ?
"AND NOT" :
"OR").
" (".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" '".
$DB->ForSql(
$val).
"' )";
1066 $arSqlSearch_tmp1 = (($strNegative ==
"Y") ?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT " :
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" '".
$DB->ForSql(
$val).
"' )";
1072 $arSqlSearch_tmp1 = ($strNegative==
"Y"?
"NOT":
"").
"(".
$arFields[
$key][
"FIELD"].
" IS NULL)";
1074 $arSqlSearch_tmp1 = ($strNegative==
"Y"?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT ":
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" ".
$DB->CharToDateFunction(
$val,
"FULL").
")";
1079 $arSqlSearch_tmp1 = ($strNegative==
"Y"?
"NOT":
"").
"(".
$arFields[
$key][
"FIELD"].
" IS NULL)";
1081 $arSqlSearch_tmp1 = ($strNegative==
"Y"?
" ".$arFields[
$key][
"FIELD"].
" IS NULL OR NOT ":
"").
"(".
$arFields[
$key][
"FIELD"].
" ".$strOperation.
" ".
$DB->CharToDateFunction(
$val,
"SHORT").
")";
1085 $arSqlHaving_tmp[] = $arSqlSearch_tmp1;
1087 $arSqlSearch_tmp[] = $arSqlSearch_tmp1;
1095 if ($strSqlFrom <>
'')
1101 $strSqlSearch_tmp =
"";
1102 for ($j = 0, $intCountSearchTmp =
count($arSqlSearch_tmp); $j < $intCountSearchTmp; $j++)
1105 $strSqlSearch_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
1106 $strSqlSearch_tmp .=
"(".$arSqlSearch_tmp[$j].
")";
1108 if ($strOrNull ==
"Y")
1110 if ($strSqlSearch_tmp <>
'')
1111 $strSqlSearch_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
1112 $strSqlSearch_tmp .=
"(".$arFields[
$key][
"FIELD"].
" IS ".($strNegative==
"Y" ?
"NOT " :
"").
"NULL)";
1116 if ($strSqlSearch_tmp <>
'')
1117 $strSqlSearch_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
1118 $strSqlSearch_tmp .=
"(".$arFields[
$key][
"FIELD"].
" ".($strNegative==
"Y" ?
"<>" :
"=").
" 0)";
1122 if ($strSqlSearch_tmp <>
'')
1123 $strSqlSearch_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
1124 $strSqlSearch_tmp .=
"(".$arFields[
$key][
"FIELD"].
" ".($strNegative==
"Y" ?
"<>" :
"=").
" '')";
1128 if ($strSqlSearch_tmp !=
"")
1129 $arSqlSearch[] =
"(".$strSqlSearch_tmp.
")";
1131 $strSqlHaving_tmp =
"";
1132 for ($j = 0, $intCountHavingTmp =
count($arSqlHaving_tmp); $j < $intCountHavingTmp; $j++)
1135 $strSqlHaving_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
1136 $strSqlHaving_tmp .=
"(".$arSqlHaving_tmp[$j].
")";
1138 if ($strOrNull ==
"Y")
1140 if ($strSqlHaving_tmp <>
'')
1141 $strSqlHaving_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
1142 $strSqlHaving_tmp .=
"(".$arFields[
$key][
"FIELD"].
" IS ".($strNegative==
"Y" ?
"NOT " :
"").
"NULL)";
1144 if ($strSqlHaving_tmp <>
'')
1145 $strSqlHaving_tmp .= ($strNegative==
"Y" ?
" AND " :
" OR ");
1147 $strSqlHaving_tmp .=
"(".$arFields[
$key][
"FIELD"].
" ".($strNegative==
"Y" ?
"<>" :
"=").
" 0)";
1149 $strSqlHaving_tmp .=
"(".$arFields[
$key][
"FIELD"].
" ".($strNegative==
"Y" ?
"<>" :
"=").
" '')";
1152 if ($strSqlHaving_tmp !=
"")
1153 $arSqlHaving[] =
"(".$strSqlHaving_tmp.
")";
1157 if (!empty($arSqlSearch))
1158 $strSqlWhere =
'('.implode(
') and (', $arSqlSearch).
')';
1161 if (!empty($arSqlHaving))
1162 $strSqlHaving =
'('.implode(
') and (', $arSqlHaving).
')';
1166 $arSqlOrder =
array();
1167 foreach ($arOrder as $by =>
$order)
1169 $by = mb_strtoupper($by);
1173 $order =
"DESC".($oracleEdition ?
" NULLS LAST" :
"");
1175 $order =
"ASC".($oracleEdition ?
" NULLS FIRST" :
"");
1179 $arSqlOrder[] =
" ".$arFields[$by][
"FIELD"].
" ".
$order.
" ";
1183 && !in_array(
$arFields[$by][
"FROM"], $arAlreadyJoined))
1185 if ($strSqlFrom <>
'')
1188 $arAlreadyJoined[] =
$arFields[$by][
"FROM"];
1195 if (!empty($arSqlOrder))
1196 $strSqlOrder = implode(
', ', $arSqlOrder);
1200 "SELECT" => $strSqlSelect,
1201 "FROM" => $strSqlFrom,
1202 "WHERE" => $strSqlWhere,
1203 "GROUPBY" => $strSqlGroupBy,
1204 "ORDERBY" => $strSqlOrder,
1205 "HAVING" => $strSqlHaving