Completed
Push — master ( 5a6198...a64e14 )
by Maxence
17s queued 10s
created

TokensRequestBuilder::getTokensInsertSql()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Circles - Bring cloud-users closer together.
5
 *
6
 * This file is licensed under the Affero General Public License version 3 or
7
 * later. See the COPYING file.
8
 *
9
 * @author Maxence Lange <[email protected]>
10
 * @copyright 2017
11
 * @license GNU AGPL version 3 or any later version
12
 *
13
 * This program is free software: you can redistribute it and/or modify
14
 * it under the terms of the GNU Affero General Public License as
15
 * published by the Free Software Foundation, either version 3 of the
16
 * License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU Affero General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU Affero General Public License
24
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
 *
26
 */
27
28
29
namespace OCA\Circles\Db;
30
31
32
use OCA\Circles\Model\SharesToken;
33
use OCP\DB\QueryBuilder\IQueryBuilder;
34
35
36
/**
37
 * Class TokensRequestBuilder
38
 *
39
 * @package OCA\Circles\Db
40
 */
41
class
42
TokensRequestBuilder extends CoreRequestBuilder {
43
44
45
	/**
46
	 * Base of the Sql Insert request for Shares
47
	 *
48
	 * @return IQueryBuilder
49
	 */
50
	protected function getTokensInsertSql() {
51
		$qb = $this->dbConnection->getQueryBuilder();
52
		$qb->insert(self::TABLE_TOKENS);
53
54
		return $qb;
55
	}
56
57
58
	/**
59
	 * Base of the Sql Update request for Groups
60
	 *
61
	 * @param int $circleId
62
	 * @param string $groupId
63
	 *
64
	 * @return IQueryBuilder
65
	 */
66
	protected function getTokensUpdateSql($circleId, $groupId) {
0 ignored issues
show
Unused Code introduced by
The parameter $circleId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $groupId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
67
		$qb = $this->dbConnection->getQueryBuilder();
68
		$qb->update(self::TABLE_TOKENS);
69
70
		return $qb;
71
	}
72
73
74
	/**
75
	 * @return IQueryBuilder
76
	 */
77
	protected function getTokensSelectSql() {
78
		$qb = $this->dbConnection->getQueryBuilder();
79
80
		/** @noinspection PhpMethodParametersCountMismatchInspection */
81
		$qb->select('t.user_id', 't.circle_id', 't.share_id', 't.token')
82
		   ->from(self::TABLE_TOKENS, 't');
83
84
		$this->default_select_alias = 't';
85
86
		return $qb;
87
	}
88
89
90
	/**
91
	 * Base of the Sql Delete request
92
	 *
93
	 * @return IQueryBuilder
94
	 */
95
	protected function getTokensDeleteSql() {
96
		$qb = $this->dbConnection->getQueryBuilder();
97
		$qb->delete(self::TABLE_TOKENS);
98
99
		return $qb;
100
	}
101
102
103
	/**
104
	 * @param array $data
105
	 *
106
	 * @return SharesToken
107
	 */
108
	protected function parseTokensSelectSql($data) {
109
		$sharesToken = new SharesToken();
110
		$sharesToken->import($data);
111
112
		return $sharesToken;
113
	}
114
115
}
116