1 | <?php |
||
53 | class DB{ |
||
54 | |||
55 | /** |
||
56 | * DB constructor. |
||
57 | * @param Application $app |
||
58 | * @param string $dsn @see \PDO |
||
59 | * @param string $username @see \PDO |
||
60 | * @param string $password @see \PDO |
||
61 | * @param array $options @see \PDO |
||
62 | */ |
||
63 | |||
64 | static public function connect(Application $app, |
||
79 | |||
80 | 56 | public function __construct(Application $app, $connection) |
|
85 | |||
86 | /** |
||
87 | * select('column0', 'column1') => "SELECT column0,column1" |
||
88 | * select(['column0', 'column1']) => "SELECT column0,column1" |
||
89 | * |
||
90 | * @param string $column0 |
||
91 | * @return \PhpBoot\DB\rules\select\FromRule |
||
92 | */ |
||
93 | 28 | function select($column0=null, $_=null){ |
|
110 | /** |
||
111 | * insertInto('table') => "INSERT INTO table" |
||
112 | * |
||
113 | * @param string $table |
||
114 | * @return \PhpBoot\DB\rules\insert\ValuesRule |
||
115 | */ |
||
116 | 8 | public function insertInto($table) { |
|
120 | /** |
||
121 | * update('table') => "UPDATE table" |
||
122 | * @param string $table |
||
123 | * @return \PhpBoot\DB\rules\update\UpdateSetRule |
||
124 | */ |
||
125 | 11 | public function update($table) { |
|
129 | |||
130 | /** |
||
131 | * deleteFrom('table') => "DELETE FROM table" |
||
132 | * @param string $table |
||
133 | * @return \PhpBoot\DB\rules\basic\WhereRule |
||
134 | */ |
||
135 | 7 | public function deleteFrom($table){ |
|
139 | /** |
||
140 | * replaceInto('table') => "REPLACE INTO table" |
||
141 | * @param string $table |
||
142 | * @return \PhpBoot\DB\rules\replace\ValuesRule |
||
143 | */ |
||
144 | 2 | public function replaceInto($table){ |
|
148 | |||
149 | /** |
||
150 | * @param callable $callback |
||
151 | * @return mixed return |
||
152 | * @throws \Exception |
||
153 | */ |
||
154 | public function transaction(callable $callback) |
||
171 | /** |
||
172 | * @return \PDO |
||
173 | */ |
||
174 | public function getConnection() |
||
178 | /** |
||
179 | * Splice sql use raw string(without escaping) |
||
180 | * for example: |
||
181 | * where('time>?', 'now()') => " WHERE time > 'now()' " |
||
182 | * where('time>?', Sql::raw('now()')) => " WHERE time > now() " |
||
183 | * @param string $str |
||
184 | * @return Raw |
||
185 | */ |
||
186 | 13 | static public function raw($str){ |
|
204 | |||
205 | /** |
||
206 | * @return Application |
||
207 | */ |
||
208 | 11 | public function getApp() |
|
212 | const ORDER_BY_ASC ='ASC'; |
||
213 | const ORDER_BY_DESC ='DESC'; |
||
214 | |||
215 | /** |
||
216 | * @var \PDO |
||
217 | */ |
||
218 | protected $connection; |
||
219 | |||
220 | /** |
||
221 | * @var Application |
||
222 | */ |
||
223 | protected $app; |
||
224 | |||
225 | protected $inTransaction = false; |
||
226 | } |
||
227 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.