33 * SQL database management to be used by several providers at the same time.
44 *
55 * @author Josantonius <[email protected] > 6- * @copyright 2017 (c) Josantonius - PHP-Database
6+ * @copyright 2017 - 2018 (c) Josantonius - PHP-Database
77 * @license https://opensource.org/licenses/MIT - The MIT License (MIT)
88 * @link https://github.com/Josantonius/PHP-Database
99 * @since 1.0.0
1414
1515/**
1616 * Database handler.
17- *
18- * @since 1.0.0
1917 */
2018class Database
2119{
@@ -31,35 +29,27 @@ class Database
3129 /**
3230 * Database provider.
3331 *
34- * @since 1.0.0
35- *
3632 * @var object
3733 */
3834 public $ provider ;
3935
4036 /**
4137 * Last insert id of the last query.
4238 *
43- * @since 1.0.0
44- *
4539 * @var int
4640 */
4741 public $ lastInsertId ;
4842
4943 /**
5044 * Get number of rows affected of the last query.
5145 *
52- * @since 1.0.0
53- *
5446 * @var int
5547 */
5648 public $ rowCount ;
5749
5850 /**
5951 * Configurations for queries.
6052 *
61- * @since 1.0.0
62- *
6353 * @var null|array
6454 */
6555 protected $ settings = [
@@ -83,35 +73,27 @@ class Database
8373 /**
8474 * Database connection.
8575 *
86- * @since 1.0.0
87- *
8876 * @var array
8977 */
9078 private static $ conn ;
9179
9280 /**
9381 * Query.
9482 *
95- * @since 1.0.0
96- *
9783 * @var string
9884 */
9985 private $ query ;
10086
10187 /**
10288 * Query response.
10389 *
104- * @since 1.0.0
105- *
10690 * @var object
10791 */
10892 private $ response ;
10993
11094 /**
11195 * Database provider constructor.
11296 *
113- * @since 1.0.0
114- *
11597 * @param string $provider → name of provider class
11698 * @param string $host → database host
11799 * @param string $user → database user
@@ -152,8 +134,6 @@ protected function __construct(
152134
153135 /**
154136 * Close connection to database.
155- *
156- * @since 1.0.0
157137 */
158138 public function __destruct ()
159139 {
@@ -165,8 +145,6 @@ public function __destruct()
165145 *
166146 * Create a new if it doesn't exist or another provider is used.
167147 *
168- * @since 1.0.0
169- *
170148 * @param string $id → identifying name for the database
171149 * @param string $provider → name of provider class
172150 * @param string $host → database host
@@ -214,8 +192,6 @@ public static function getConnection(
214192 /**
215193 * Process query and prepare it for the provider.
216194 *
217- * @since 1.0.0
218- *
219195 * @param string $query → query
220196 * @param array $statements → null by default or array for statements
221197 *
@@ -254,8 +230,6 @@ public function query($query, $statements = null, $result = 'obj')
254230 /**
255231 * Create table statement.
256232 *
257- * @since 1.0.0
258- *
259233 * @param array $data → column name and configuration for data types
260234 *
261235 * @return object
@@ -365,8 +339,6 @@ public function charset($type)
365339 /**
366340 * Select statement.
367341 *
368- * @since 1.0.0
369- *
370342 * @param mixed $columns → column/s name
371343 *
372344 * @return object
@@ -382,8 +354,6 @@ public function select($columns = '*')
382354 /**
383355 * Insert into statement.
384356 *
385- * @since 1.0.0
386- *
387357 * @param array $data → column name and value
388358 * @param array $statements → null by default or array for statements
389359 *
@@ -401,8 +371,6 @@ public function insert($data, $statements = null)
401371 /**
402372 * Update statement.
403373 *
404- * @since 1.0.0
405- *
406374 * @param array $data → column name and value
407375 * @param array $statements → null by default or array for statements
408376 *
@@ -420,8 +388,6 @@ public function update($data, $statements = null)
420388 /**
421389 * Replace a row in a table if it exists or insert a new row if not exist.
422390 *
423- * @since 1.0.0
424- *
425391 * @param array $data → column name and value
426392 * @param array $statements → null by default or array for statements
427393 *
@@ -439,8 +405,6 @@ public function replace($data, $statements = null)
439405 /**
440406 * Delete statement.
441407 *
442- * @since 1.0.0
443- *
444408 * @return object
445409 */
446410 public function delete ()
@@ -453,8 +417,6 @@ public function delete()
453417 /**
454418 * Truncate table statement.
455419 *
456- * @since 1.0.0
457- *
458420 * @return object
459421 */
460422 public function truncate ()
@@ -467,8 +429,6 @@ public function truncate()
467429 /**
468430 * Drop table statement.
469431 *
470- * @since 1.0.0
471- *
472432 * @return object
473433 */
474434 public function drop ()
@@ -481,8 +441,6 @@ public function drop()
481441 /**
482442 * Set database table name.
483443 *
484- * @since 1.0.0
485- *
486444 * @param string $table → table name
487445 *
488446 * @return object
@@ -497,8 +455,6 @@ public function in($table)
497455 /**
498456 * Set database table name.
499457 *
500- * @since 1.0.0
501- *
502458 * @param string $table → table name
503459 *
504460 * @return object
@@ -513,8 +469,6 @@ public function table($table)
513469 /**
514470 * Set database table name.
515471 *
516- * @since 1.0.0
517- *
518472 * @param string $table → table name
519473 *
520474 * @return object
@@ -529,8 +483,6 @@ public function from($table)
529483 /**
530484 * Where clauses.
531485 *
532- * @since 1.0.0
533- *
534486 * @param mixed $clauses → column name and value
535487 * @param array $statements → null by default or array for statements
536488 *
@@ -555,8 +507,6 @@ public function where($clauses, $statements = null)
555507 /**
556508 * Set SELECT order.
557509 *
558- * @since 1.0.0
559- *
560510 * @param string $type → query sort parameters
561511 *
562512 * @return object
@@ -571,8 +521,6 @@ public function order($type)
571521 /**
572522 * Set SELECT limit.
573523 *
574- * @since 1.0.0
575- *
576524 * @param int $number → query limiting parameters
577525 *
578526 * @return object
@@ -587,8 +535,6 @@ public function limit($number)
587535 /**
588536 * Execute query.
589537 *
590- * @since 1.0.0
591- *
592538 * @param string $result → 'obj' → result as object
593539 * → 'array_num' → result as numeric array
594540 * → 'array_assoc' → result as associative array
@@ -680,8 +626,6 @@ public function execute($result = 'obj')
680626 /**
681627 * Query handler.
682628 *
683- * @since 1.0.0
684- *
685629 * @return object → returns query to be executed by provider class
686630 */
687631 private function implement ()
@@ -695,8 +639,6 @@ private function implement()
695639
696640 /**
697641 * Run query with prepared statements.
698- *
699- * @since 1.0.0
700642 */
701643 private function implementPrepareStatements ()
702644 {
@@ -708,8 +650,6 @@ private function implementPrepareStatements()
708650
709651 /**
710652 * Run query without prepared statements.
711- *
712- * @since 1.0.0
713653 */
714654 private function implementQuery ()
715655 {
@@ -722,8 +662,6 @@ private function implementQuery()
722662 /**
723663 * Get response after executing the query.
724664 *
725- * @since 1.0.0
726- *
727665 * @throws DBException → error executing query
728666 *
729667 * @return mixed → result as object, array, int...
@@ -746,8 +684,6 @@ private function getResponse()
746684 /**
747685 * Process query as object or numeric or associative array.
748686 *
749- * @since 1.0.0
750- *
751687 * @return mixed|bool → results
752688 */
753689 private function fetchResponse ()
@@ -777,8 +713,6 @@ private function fetchResponse()
777713
778714 /**
779715 * Reset query parameters.
780- *
781- * @since 1.0.0
782716 */
783717 private function reset ()
784718 {
0 commit comments