mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
fixed attachment statistics for sqlite (#847)
Co-authored-by: jona <a@b.c>
This commit is contained in:
parent
d0937218b9
commit
edf50a71d1
1 changed files with 8 additions and 8 deletions
|
@ -58,8 +58,8 @@ class AttachmentRepository extends DBElementRepository
|
||||||
{
|
{
|
||||||
$qb = $this->createQueryBuilder('attachment');
|
$qb = $this->createQueryBuilder('attachment');
|
||||||
$qb->select('COUNT(attachment)')
|
$qb->select('COUNT(attachment)')
|
||||||
->where('attachment.path LIKE :like');
|
->where('attachment.path LIKE :like ESCAPE \'#\'');
|
||||||
$qb->setParameter('like', '\\%SECURE\\%%');
|
$qb->setParameter('like', '#%SECURE#%%');
|
||||||
$query = $qb->getQuery();
|
$query = $qb->getQuery();
|
||||||
|
|
||||||
return (int) $query->getSingleScalarResult();
|
return (int) $query->getSingleScalarResult();
|
||||||
|
@ -94,12 +94,12 @@ class AttachmentRepository extends DBElementRepository
|
||||||
{
|
{
|
||||||
$qb = $this->createQueryBuilder('attachment');
|
$qb = $this->createQueryBuilder('attachment');
|
||||||
$qb->select('COUNT(attachment)')
|
$qb->select('COUNT(attachment)')
|
||||||
->where('attachment.path LIKE :base')
|
->where('attachment.path LIKE :base ESCAPE \'#\'')
|
||||||
->orWhere('attachment.path LIKE :media')
|
->orWhere('attachment.path LIKE :media ESCAPE \'#\'')
|
||||||
->orWhere('attachment.path LIKE :secure');
|
->orWhere('attachment.path LIKE :secure ESCAPE \'#\'');
|
||||||
$qb->setParameter('secure', '\\%SECURE\\%%');
|
$qb->setParameter('secure', '#%SECURE#%%');
|
||||||
$qb->setParameter('base', '\\%BASE\\%%');
|
$qb->setParameter('base', '#%BASE#%%');
|
||||||
$qb->setParameter('media', '\\%MEDIA\\%%');
|
$qb->setParameter('media', '#%MEDIA#%%');
|
||||||
$query = $qb->getQuery();
|
$query = $qb->getQuery();
|
||||||
|
|
||||||
return (int) $query->getSingleScalarResult();
|
return (int) $query->getSingleScalarResult();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue