summaryrefslogtreecommitdiffstats
path: root/apps/calendar
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2012-08-25 01:52:27 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2012-08-25 01:52:27 +0200
commitfa3497f6ed54b6de16dc44ae94721f00b5d5fc6b (patch)
tree7b3a6c1b946273ee0f1f3f6ade1f9cd3483004dc /apps/calendar
parentfd5af9aff4245127f32f3b90dbd6e52792984447 (diff)
downloadnextcloud-server-fa3497f6ed54b6de16dc44ae94721f00b5d5fc6b.tar.gz
nextcloud-server-fa3497f6ed54b6de16dc44ae94721f00b5d5fc6b.zip
add backticks to SQL, use limit parameter instead of LIMIT SQL
Diffstat (limited to 'apps/calendar')
-rw-r--r--apps/calendar/lib/import.php6
-rw-r--r--apps/calendar/lib/repeat.php22
-rw-r--r--apps/calendar/lib/share.php4
-rw-r--r--apps/calendar/lib/share/calendar.php2
-rw-r--r--apps/calendar/lib/share_backend.php2
5 files changed, 18 insertions, 18 deletions
diff --git a/apps/calendar/lib/import.php b/apps/calendar/lib/import.php
index 368f8406e71..2e3a729e0cd 100644
--- a/apps/calendar/lib/import.php
+++ b/apps/calendar/lib/import.php
@@ -273,9 +273,9 @@ class OC_Calendar_Import{
*/
private function isDuplicate($insertid){
$newobject = OC_Calendar_Object::find($insertid);
- $stmt = OCP\DB::prepare('SELECT COUNT(*) as count FROM *PREFIX*calendar_objects
- INNER JOIN *PREFIX*calendar_calendars ON calendarid=*PREFIX*calendar_calendars.id
- WHERE objecttype=? AND startdate=? AND enddate=? AND repeating=? AND summary=? AND calendardata=? AND userid = ?');
+ $stmt = OCP\DB::prepare('SELECT COUNT(*) AS `count` FROM `*PREFIX*calendar_objects`
+ INNER JOIN `*PREFIX*calendar_calendars` ON `calendarid`=`*PREFIX*calendar_calendars`.`id`
+ WHERE `objecttype`=? AND `startdate`=? AND `enddate`=? AND `repeating`=? AND `summary`=? AND `calendardata`=? AND `userid` = ?');
$result = $stmt->execute(array($newobject['objecttype'],$newobject['startdate'],$newobject['enddate'],$newobject['repeating'],$newobject['summary'],$newobject['calendardata'], $this->userid));
$result = $result->fetchRow();
if($result['count'] >= 2){
diff --git a/apps/calendar/lib/repeat.php b/apps/calendar/lib/repeat.php
index b9fbee8fe0a..27f1e0481a1 100644
--- a/apps/calendar/lib/repeat.php
+++ b/apps/calendar/lib/repeat.php
@@ -16,7 +16,7 @@ class OC_Calendar_Repeat{
* @return (array)
*/
public static function get($id){
- $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_repeat WHERE eventid = ?');
+ $stmt = OCP\DB::prepare('SELECT * FROM `*PREFIX*calendar_repeat` WHERE `eventid` = ?');
$result = $stmt->execute(array($id));
$return = array();
while($row = $result->fetchRow()){
@@ -32,9 +32,9 @@ class OC_Calendar_Repeat{
* @return (array)
*/
public static function get_inperiod($id, $from, $until){
- $stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_repeat WHERE eventid = ?'
- .' AND ((startdate >= ? AND startdate <= ?)'
- .' OR (enddate >= ? AND enddate <= ?))');
+ $stmt = OCP\DB::prepare( 'SELECT * FROM `*PREFIX*calendar_repeat` WHERE `eventid` = ?'
+ .' AND ((`startdate` >= ? AND `startdate` <= ?)'
+ .' OR (`enddate` >= ? AND `enddate` <= ?))');
$result = $stmt->execute(array($id,
OC_Calendar_Object::getUTCforMDB($from), OC_Calendar_Object::getUTCforMDB($until),
OC_Calendar_Object::getUTCforMDB($from), OC_Calendar_Object::getUTCforMDB($until)));
@@ -50,7 +50,7 @@ class OC_Calendar_Repeat{
* @return (array)
*/
public static function getCalendar($id){
- $stmt = OCP\DB::prepare('SELECT * FROM *PREFIX*calendar_repeat WHERE calid = ?');
+ $stmt = OCP\DB::prepare('SELECT * FROM `*PREFIX*calendar_repeat` WHERE `calid` = ?');
$result = $stmt->execute(array($id));
$return = array();
while($row = $result->fetchRow()){
@@ -66,9 +66,9 @@ class OC_Calendar_Repeat{
* @return (array)
*/
public static function getCalendar_inperiod($id, $from, $until){
- $stmt = OCP\DB::prepare( 'SELECT * FROM *PREFIX*calendar_repeat WHERE calid = ?'
- .' AND ((startdate >= ? AND startdate <= ?)'
- .' OR (enddate >= ? AND enddate <= ?))');
+ $stmt = OCP\DB::prepare( 'SELECT * FROM `*PREFIX*calendar_repeat` WHERE `calid` = ?'
+ .' AND ((`startdate` >= ? AND `startdate` <= ?)'
+ .' OR (`enddate` >= ? AND `enddate` <= ?))');
$result = $stmt->execute(array($id,
$from, $until,
$from, $until));
@@ -99,7 +99,7 @@ class OC_Calendar_Repeat{
continue;
}
$startenddate = OC_Calendar_Object::generateStartEndDate($vevent->DTSTART, OC_Calendar_Object::getDTEndFromVEvent($vevent), ($vevent->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE)?true:false, 'UTC');
- $stmt = OCP\DB::prepare('INSERT INTO *PREFIX*calendar_repeat (eventid,calid,startdate,enddate) VALUES(?,?,?,?)');
+ $stmt = OCP\DB::prepare('INSERT INTO `*PREFIX*calendar_repeat` (`eventid`,`calid`,`startdate`,`enddate`) VALUES(?,?,?,?)');
$stmt->execute(array($id,OC_Calendar_Object::getCalendarid($id),$startenddate['start'],$startenddate['end']));
}
return true;
@@ -189,7 +189,7 @@ class OC_Calendar_Repeat{
* @return (bool)
*/
public static function clean($id){
- $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_repeat WHERE eventid = ?');
+ $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*calendar_repeat` WHERE `eventid` = ?');
$stmt->execute(array($id));
}
/**
@@ -198,7 +198,7 @@ class OC_Calendar_Repeat{
* @return (bool)
*/
public static function cleanCalendar($id){
- $stmt = OCP\DB::prepare('DELETE FROM *PREFIX*calendar_repeat WHERE calid = ?');
+ $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*calendar_repeat` WHERE `calid` = ?');
$stmt->execute(array($id));
}
} \ No newline at end of file
diff --git a/apps/calendar/lib/share.php b/apps/calendar/lib/share.php
index 23892157fef..bad1082c33e 100644
--- a/apps/calendar/lib/share.php
+++ b/apps/calendar/lib/share.php
@@ -226,9 +226,9 @@ class OC_Calendar_Share{
* @return: mixed - bool if false, array with type and id if true
*/
public static function getElementByToken($token){
- $stmt_calendar = OCP\DB::prepare("SELECT * FROM `*PREFIX*calendar_share_" . OC_Calendar_Share::CALENDAR . "` WHERE `sharetype` = 'public' AND `share` = ?");
+ $stmt_calendar = OCP\DB::prepare('SELECT * FROM `*PREFIX*calendar_share_' . OC_Calendar_Share::CALENDAR . '` WHERE `sharetype` = \'public\' AND `share` = ?');
$result_calendar = $stmt_calendar->execute(array($token));
- $stmt_event = OCP\DB::prepare("SELECT * FROM `*PREFIX*calendar_share_" . OC_Calendar_Share::EVENT . "` WHERE `sharetype` = 'public' AND `share` = ?");
+ $stmt_event = OCP\DB::prepare('SELECT * FROM `*PREFIX*calendar_share_' . OC_Calendar_Share::EVENT . '` WHERE `sharetype` = \'public\' AND `share` = ?');
$result_event = $stmt_event->execute(array($token));
$return = array();
if($result_calendar->numRows() == 0 && $result_event->numRows() == 0){
diff --git a/apps/calendar/lib/share/calendar.php b/apps/calendar/lib/share/calendar.php
index 7f498292419..bbc43fcca0f 100644
--- a/apps/calendar/lib/share/calendar.php
+++ b/apps/calendar/lib/share/calendar.php
@@ -99,7 +99,7 @@ class OC_Share_Backend_Calendar implements OCP\Share_Backend_Collection {
}
public function getChildren($itemSource) {
- $query = OCP\DB::prepare('SELECT id FROM *PREFIX*calendar_objects WHERE calendarid = ?');
+ $query = OCP\DB::prepare('SELECT `id` FROM `*PREFIX*calendar_objects` WHERE `calendarid` = ?');
$result = $query->execute(array($itemSource));
$sources = array();
while ($object = $result->fetchRow()) {
diff --git a/apps/calendar/lib/share_backend.php b/apps/calendar/lib/share_backend.php
index f937c0d1c34..1ea58ac270c 100644
--- a/apps/calendar/lib/share_backend.php
+++ b/apps/calendar/lib/share_backend.php
@@ -22,7 +22,7 @@
class OC_Share_Backend_Calendar extends OCP\Share_Backend {
public function getSource($item, $uid) {
- $query = OCP\DB::prepare('SELECT id FROM *PREFIX*calendar_calendars WHERE userid = ? AND displayname = ? LIMIT 1');
+ $query = OCP\DB::prepare('SELECT `id` FROM `*PREFIX*calendar_calendars` WHERE `userid` = ? AND `displayname` = ?',1);
return $query->execute(array($uid, $item))->fetchAll();
}