| @@ 1134-1176 (lines=43) @@ | ||
| 1131 | * @param int $list_count |
|
| 1132 | * @return string select paging sql |
|
| 1133 | */ |
|
| 1134 | function getSelectPageSql($query, $with_values = TRUE, $start_count = 0, $list_count = 0) |
|
| 1135 | { |
|
| 1136 | ||
| 1137 | $select = $query->getSelectString($with_values); |
|
| 1138 | if($select == '') |
|
| 1139 | { |
|
| 1140 | return new BaseObject(-1, "Invalid query"); |
|
| 1141 | } |
|
| 1142 | $select = 'SELECT ' . $select; |
|
| 1143 | ||
| 1144 | $from = $query->getFromString($with_values); |
|
| 1145 | if($from == '') |
|
| 1146 | { |
|
| 1147 | return new BaseObject(-1, "Invalid query"); |
|
| 1148 | } |
|
| 1149 | $from = ' FROM ' . $from; |
|
| 1150 | ||
| 1151 | $where = $query->getWhereString($with_values); |
|
| 1152 | if($where != '') |
|
| 1153 | { |
|
| 1154 | $where = ' WHERE ' . $where; |
|
| 1155 | } |
|
| 1156 | ||
| 1157 | $groupBy = $query->getGroupByString(); |
|
| 1158 | if($groupBy != '') |
|
| 1159 | { |
|
| 1160 | $groupBy = ' GROUP BY ' . $groupBy; |
|
| 1161 | } |
|
| 1162 | ||
| 1163 | $orderBy = $query->getOrderByString(); |
|
| 1164 | if($orderBy != '') |
|
| 1165 | { |
|
| 1166 | $orderBy = ' ORDER BY ' . $orderBy; |
|
| 1167 | } |
|
| 1168 | ||
| 1169 | $limit = $query->getLimitString(); |
|
| 1170 | if($limit != '') |
|
| 1171 | { |
|
| 1172 | $limit = sprintf(' LIMIT %d, %d', $start_count, $list_count); |
|
| 1173 | } |
|
| 1174 | ||
| 1175 | return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; |
|
| 1176 | } |
|
| 1177 | ||
| 1178 | } |
|
| 1179 | ||
| @@ 833-874 (lines=42) @@ | ||
| 830 | * @param int $list_count |
|
| 831 | * @return string select paging sql |
|
| 832 | */ |
|
| 833 | function getSelectPageSql($query, $with_values = true, $start_count = 0, $list_count = 0) |
|
| 834 | { |
|
| 835 | $select = $query->getSelectString($with_values); |
|
| 836 | if($select == '') |
|
| 837 | { |
|
| 838 | return new BaseObject(-1, "Invalid query"); |
|
| 839 | } |
|
| 840 | $select = 'SELECT ' . $select; |
|
| 841 | ||
| 842 | $from = $query->getFromString($with_values); |
|
| 843 | if($from == '') |
|
| 844 | { |
|
| 845 | return new BaseObject(-1, "Invalid query"); |
|
| 846 | } |
|
| 847 | $from = ' FROM ' . $from; |
|
| 848 | ||
| 849 | $where = $query->getWhereString($with_values); |
|
| 850 | if($where != '') |
|
| 851 | { |
|
| 852 | $where = ' WHERE ' . $where; |
|
| 853 | } |
|
| 854 | ||
| 855 | $groupBy = $query->getGroupByString(); |
|
| 856 | if($groupBy != '') |
|
| 857 | { |
|
| 858 | $groupBy = ' GROUP BY ' . $groupBy; |
|
| 859 | } |
|
| 860 | ||
| 861 | $orderBy = $query->getOrderByString(); |
|
| 862 | if($orderBy != '') |
|
| 863 | { |
|
| 864 | $orderBy = ' ORDER BY ' . $orderBy; |
|
| 865 | } |
|
| 866 | ||
| 867 | $limit = $query->getLimitString(); |
|
| 868 | if($limit != '') |
|
| 869 | { |
|
| 870 | $limit = sprintf(' LIMIT %d, %d', $start_count, $list_count); |
|
| 871 | } |
|
| 872 | ||
| 873 | return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; |
|
| 874 | } |
|
| 875 | ||
| 876 | } |
|
| 877 | ||