@@ -27,46 +27,46 @@ |
||
27 | 27 | namespace OC\DB; |
28 | 28 | |
29 | 29 | class AdapterPgSql extends Adapter { |
30 | - protected $compatModePre9_5 = null; |
|
30 | + protected $compatModePre9_5 = null; |
|
31 | 31 | |
32 | - public function lastInsertId($table) { |
|
33 | - return $this->conn->fetchColumn('SELECT lastval()'); |
|
34 | - } |
|
32 | + public function lastInsertId($table) { |
|
33 | + return $this->conn->fetchColumn('SELECT lastval()'); |
|
34 | + } |
|
35 | 35 | |
36 | - const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)'; |
|
37 | - public function fixupStatement($statement) { |
|
38 | - $statement = str_replace( '`', '"', $statement ); |
|
39 | - $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement ); |
|
40 | - return $statement; |
|
41 | - } |
|
36 | + const UNIX_TIMESTAMP_REPLACEMENT = 'cast(extract(epoch from current_timestamp) as integer)'; |
|
37 | + public function fixupStatement($statement) { |
|
38 | + $statement = str_replace( '`', '"', $statement ); |
|
39 | + $statement = str_ireplace( 'UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement ); |
|
40 | + return $statement; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @suppress SqlInjectionChecker |
|
45 | - */ |
|
46 | - public function insertIgnoreConflict(string $table,array $values) : int { |
|
47 | - if($this->isPre9_5CompatMode() === true) { |
|
48 | - return parent::insertIgnoreConflict($table, $values); |
|
49 | - } |
|
43 | + /** |
|
44 | + * @suppress SqlInjectionChecker |
|
45 | + */ |
|
46 | + public function insertIgnoreConflict(string $table,array $values) : int { |
|
47 | + if($this->isPre9_5CompatMode() === true) { |
|
48 | + return parent::insertIgnoreConflict($table, $values); |
|
49 | + } |
|
50 | 50 | |
51 | - // "upsert" is only available since PgSQL 9.5, but the generic way |
|
52 | - // would leave error logs in the DB. |
|
53 | - $builder = $this->conn->getQueryBuilder(); |
|
54 | - $builder->insert($table); |
|
55 | - foreach ($values as $key => $value) { |
|
56 | - $builder->setValue($key, $builder->createNamedParameter($value)); |
|
57 | - } |
|
58 | - $queryString = $builder->getSQL() . ' ON CONFLICT DO NOTHING'; |
|
59 | - return $this->conn->executeUpdate($queryString, $builder->getParameters(), $builder->getParameterTypes()); |
|
60 | - } |
|
51 | + // "upsert" is only available since PgSQL 9.5, but the generic way |
|
52 | + // would leave error logs in the DB. |
|
53 | + $builder = $this->conn->getQueryBuilder(); |
|
54 | + $builder->insert($table); |
|
55 | + foreach ($values as $key => $value) { |
|
56 | + $builder->setValue($key, $builder->createNamedParameter($value)); |
|
57 | + } |
|
58 | + $queryString = $builder->getSQL() . ' ON CONFLICT DO NOTHING'; |
|
59 | + return $this->conn->executeUpdate($queryString, $builder->getParameters(), $builder->getParameterTypes()); |
|
60 | + } |
|
61 | 61 | |
62 | - protected function isPre9_5CompatMode(): bool { |
|
63 | - if($this->compatModePre9_5 !== null) { |
|
64 | - return $this->compatModePre9_5; |
|
65 | - } |
|
62 | + protected function isPre9_5CompatMode(): bool { |
|
63 | + if($this->compatModePre9_5 !== null) { |
|
64 | + return $this->compatModePre9_5; |
|
65 | + } |
|
66 | 66 | |
67 | - $version = $this->conn->fetchColumn('SHOW SERVER_VERSION'); |
|
68 | - $this->compatModePre9_5 = version_compare($version, '9.5', '<'); |
|
67 | + $version = $this->conn->fetchColumn('SHOW SERVER_VERSION'); |
|
68 | + $this->compatModePre9_5 = version_compare($version, '9.5', '<'); |
|
69 | 69 | |
70 | - return $this->compatModePre9_5; |
|
71 | - } |
|
70 | + return $this->compatModePre9_5; |
|
71 | + } |
|
72 | 72 | } |
@@ -24,14 +24,14 @@ |
||
24 | 24 | namespace OC\DB\QueryBuilder\ExpressionBuilder; |
25 | 25 | |
26 | 26 | class SqliteExpressionBuilder extends ExpressionBuilder { |
27 | - /** |
|
28 | - * @inheritdoc |
|
29 | - */ |
|
30 | - public function like($x, $y, $type = null) { |
|
31 | - return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
32 | - } |
|
27 | + /** |
|
28 | + * @inheritdoc |
|
29 | + */ |
|
30 | + public function like($x, $y, $type = null) { |
|
31 | + return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
32 | + } |
|
33 | 33 | |
34 | - public function iLike($x, $y, $type = null) { |
|
35 | - return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type); |
|
36 | - } |
|
34 | + public function iLike($x, $y, $type = null) { |
|
35 | + return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type); |
|
36 | + } |
|
37 | 37 | } |
@@ -28,11 +28,11 @@ |
||
28 | 28 | namespace OC\Authentication\Token; |
29 | 29 | |
30 | 30 | interface INamedToken extends IToken { |
31 | - /** |
|
32 | - * Set token name |
|
33 | - * |
|
34 | - * @param string $name |
|
35 | - * @return void |
|
36 | - */ |
|
37 | - public function setName(string $name): void; |
|
31 | + /** |
|
32 | + * Set token name |
|
33 | + * |
|
34 | + * @param string $name |
|
35 | + * @return void |
|
36 | + */ |
|
37 | + public function setName(string $name): void; |
|
38 | 38 | } |