Rev 1086 | Rev 1148 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
507 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
1086 | daniel-mar | 5 | * Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft |
507 | daniel-mar | 6 | * |
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
1116 | daniel-mar | 20 | namespace ViaThinkSoft\OIDplus; |
21 | |||
1086 | daniel-mar | 22 | // phpcs:disable PSR1.Files.SideEffects |
23 | \defined('INSIDE_OIDPLUS') or die; |
||
1116 | daniel-mar | 24 | // phpcs:enable PSR1.Files.SideEffects |
511 | daniel-mar | 25 | |
507 | daniel-mar | 26 | abstract class OIDplusSqlSlangPlugin extends OIDplusPlugin { |
27 | |||
1116 | daniel-mar | 28 | /** |
29 | * @return string |
||
30 | */ |
||
507 | daniel-mar | 31 | public abstract static function id(): string; |
32 | |||
1116 | daniel-mar | 33 | /** |
34 | * @param string $fieldname |
||
35 | * @param string $order |
||
36 | * @return string |
||
37 | */ |
||
38 | public abstract function natOrder(string $fieldname, string $order='asc'): string; |
||
507 | daniel-mar | 39 | |
1116 | daniel-mar | 40 | /** |
41 | * @return string |
||
42 | */ |
||
507 | daniel-mar | 43 | public abstract function sqlDate(): string; |
44 | |||
1116 | daniel-mar | 45 | /** |
46 | * @param OIDplusDatabaseConnection $db |
||
47 | * @return bool |
||
48 | */ |
||
507 | daniel-mar | 49 | public abstract function detect(OIDplusDatabaseConnection $db): bool; |
50 | |||
1116 | daniel-mar | 51 | /** |
52 | * Please note: This insert_id() function should use SQL to receive |
||
53 | * the last inserted ID. If the database connection provider (e.g. PDO) |
||
54 | * offers a way to fetch the last inserted ID, please use this instead! |
||
55 | * So, please do NOT use OIDplus::db()->getSlang()->insert_id() |
||
56 | * but instead use OIDplus::db()->insert_id() |
||
57 | * This way, the database connection provider can override that function |
||
58 | * with their own method of fetching the last inserted ID. |
||
59 | * @param OIDplusDatabaseConnection $db |
||
60 | * @return int 0 on failure. |
||
61 | */ |
||
507 | daniel-mar | 62 | public abstract function insert_id(OIDplusDatabaseConnection $db): int; |
63 | |||
1116 | daniel-mar | 64 | /** |
65 | * @param string $cont |
||
66 | * @param string $table |
||
67 | * @param string $prefix |
||
68 | * @return string |
||
69 | */ |
||
70 | public abstract function setupSetTablePrefix(string $cont, string $table, string $prefix): string; |
||
507 | daniel-mar | 71 | |
1116 | daniel-mar | 72 | /** |
73 | * @param string $database |
||
74 | * @return string |
||
75 | */ |
||
76 | public abstract function setupCreateDbIfNotExists(string $database): string; |
||
507 | daniel-mar | 77 | |
1116 | daniel-mar | 78 | /** |
79 | * @param string $database |
||
80 | * @return string |
||
81 | */ |
||
82 | public abstract function setupUseDatabase(string $database): string; |
||
507 | daniel-mar | 83 | |
1116 | daniel-mar | 84 | /** |
85 | * @param string $sql |
||
86 | * @return string |
||
87 | */ |
||
88 | public abstract function filterQuery(string $sql): string; |
||
507 | daniel-mar | 89 | |
1116 | daniel-mar | 90 | /** |
91 | * @param bool $bool |
||
92 | * @return string |
||
93 | */ |
||
94 | public abstract function getSQLBool(bool $bool): string; |
||
507 | daniel-mar | 95 | |
1116 | daniel-mar | 96 | /** |
97 | * @param string $str |
||
98 | * @return string |
||
99 | */ |
||
100 | public abstract function escapeString(string $str): string; |
||
507 | daniel-mar | 101 | |
1116 | daniel-mar | 102 | /** |
103 | * @param string $expr1 |
||
104 | * @param string $expr2 |
||
105 | * @return string |
||
106 | */ |
||
107 | public abstract function isNullFunction(string $expr1, string $expr2): string; |
||
108 | |||
109 | } |