$principalUri = $this->convertPrincipal($principalUri, true);
$query = $this->db->getQueryBuilder();
$query->select($query->func()->count('*'))
- ->from('calendars')
- ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
+ ->from('calendars');
+
+ if ($principalUri === '') {
+ $query->where($query->expr()->emptyString('principaluri'));
+ } else {
+ $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
+ }
if ($excludeBirthday) {
$query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI)));
// Making fields a comma-delimited list
$query = $this->db->getQueryBuilder();
- $query->select($fields)->from('calendars')
- ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
- ->orderBy('calendarorder', 'ASC');
- $stmt = $query->execute();
+ $query->select($fields)
+ ->from('calendars')
+ ->orderBy('calendarorder', 'ASC');
+
+ if ($principalUri === '') {
+ $query->where($query->expr()->emptyString('principaluri'));
+ } else {
+ $query->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)));
+ }
+
+ $result = $query->execute();
$calendars = [];
- while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $result->fetch()) {
+ $row['principaluri'] = (string) $row['principaluri'];
$components = [];
if ($row['components']) {
$components = explode(',',$row['components']);
$calendars[$calendar['id']] = $calendar;
}
}
-
- $stmt->closeCursor();
+ $result->closeCursor();
// query for shared calendars
$principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true);
$fields[] = 'a.transparent';
$fields[] = 's.access';
$query = $this->db->getQueryBuilder();
- $result = $query->select($fields)
+ $query->select($fields)
->from('dav_shares', 's')
->join('s', 'calendars', 'a', $query->expr()->eq('s.resourceid', 'a.id'))
->where($query->expr()->in('s.principaluri', $query->createParameter('principaluri')))
->andWhere($query->expr()->eq('s.type', $query->createParameter('type')))
->setParameter('type', 'calendar')
- ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY)
- ->execute();
+ ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY);
+
+ $result = $query->execute();
$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
while ($row = $result->fetch()) {
+ $row['principaluri'] = (string) $row['principaluri'];
if ($row['principaluri'] === $principalUri) {
continue;
}
$stmt = $query->execute();
$calendars = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ $row['principaluri'] = (string) $row['principaluri'];
$components = [];
if ($row['components']) {
$components = explode(',',$row['components']);
->execute();
while ($row = $result->fetch()) {
+ $row['principaluri'] = (string) $row['principaluri'];
list(, $name) = Uri\split($row['principaluri']);
$row['displayname'] = $row['displayname'] . "($name)";
$components = [];
throw new NotFound('Node with name \'' . $uri . '\' could not be found');
}
+ $row['principaluri'] = (string) $row['principaluri'];
list(, $name) = Uri\split($row['principaluri']);
$row['displayname'] = $row['displayname'] . ' ' . "($name)";
$components = [];
return null;
}
+ $row['principaluri'] = (string) $row['principaluri'];
$components = [];
if ($row['components']) {
$components = explode(',',$row['components']);
return null;
}
+ $row['principaluri'] = (string) $row['principaluri'];
$components = [];
if ($row['components']) {
$components = explode(',',$row['components']);
return null;
}
+ $row['principaluri'] = (string) $row['principaluri'];
$subscription = [
'id' => $row['id'],
'uri' => $row['uri'],
'classification'=> (int)$row['classification']
];
}
+ $stmt->closeCursor();
return $result;
}
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter($calendarType)));
$stmt = $query->execute();
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
+ $stmt->closeCursor();
if (!$row) {
return null;