mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-02 06:57:40 +00:00
make sql statement work for mysql and sqlite
This commit is contained in:
parent
151c3dd8f2
commit
9da9b10b88
|
@ -2073,14 +2073,14 @@ class SeedDMS_Core_DMS {
|
||||||
|
|
||||||
return $resArr;
|
return $resArr;
|
||||||
case 'docspermonth':
|
case 'docspermonth':
|
||||||
$queryStr = "select `key`, count(`key`) as total from (select from_unixtime(date, '%Y-%m') as `key`from tblDocuments) a group by `key` order by `key`";
|
$queryStr = "select `key`, count(`key`) as total from (select ".$this->db->getDateExtract("date")." as `key` from tblDocuments) a group by `key` order by `key`";
|
||||||
$resArr = $this->db->getResultArray($queryStr);
|
$resArr = $this->db->getResultArray($queryStr);
|
||||||
if (!$resArr)
|
if (!$resArr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return $resArr;
|
return $resArr;
|
||||||
case 'docsaccumulated':
|
case 'docsaccumulated':
|
||||||
$queryStr = "select `key`, count(`key`) as total from (select from_unixtime(date, '%Y-%m-%d') as `key`from tblDocuments) a group by `key` order by `key`";
|
$queryStr = "select `key`, count(`key`) as total from (select ".$this->db->getDateExtract("date")." as `key` from tblDocuments) a group by `key` order by `key`";
|
||||||
$resArr = $this->db->getResultArray($queryStr);
|
$resArr = $this->db->getResultArray($queryStr);
|
||||||
if (!$resArr)
|
if (!$resArr)
|
||||||
return false;
|
return false;
|
||||||
|
@ -2088,7 +2088,12 @@ class SeedDMS_Core_DMS {
|
||||||
$sum = 0;
|
$sum = 0;
|
||||||
foreach($resArr as &$res) {
|
foreach($resArr as &$res) {
|
||||||
$sum += $res['total'];
|
$sum += $res['total'];
|
||||||
$res['key'] = mktime(12, 0, 0, substr($res['key'], 5, 2), substr($res['key'], 8, 2), substr($res['key'], 0, 4)) * 1000;
|
/* auxially variable $key is need because sqlite returns
|
||||||
|
* a key '`key`'
|
||||||
|
*/
|
||||||
|
$key = mktime(12, 0, 0, substr($res['key'], 5, 2), substr($res['key'], 8, 2), substr($res['key'], 0, 4)) * 1000;
|
||||||
|
unset($res['key']);
|
||||||
|
$res['key'] = $key;
|
||||||
$res['total'] = $sum;
|
$res['total'] = $sum;
|
||||||
}
|
}
|
||||||
return $resArr;
|
return $resArr;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user