File modules/cms/base/DB.class.php

Last commit: Fri Apr 15 14:51:22 2022 +0200	dankert	Refactoring: User,Config and Database info is now stored in the Request, because so there is no session required for clients which are using Basic Authorization.
1 <?php 2 3 namespace cms\base; 4 5 use RuntimeException; 6 use util\Request; 7 use util\Session; 8 9 class DB { 10 11 /** 12 * Turns a SQL query into a Statement. 13 * 14 * @param $sql SQL-query 15 * @return \database\Statement SQL-Statement 16 */ 17 public static function sql( $sql ) { 18 return self::get()->sql( $sql ); 19 } 20 21 /** 22 * Returns the database connection. 23 * @return \database\Database 24 */ 25 public static function get() { 26 27 $db = Request::getDatabase(); 28 29 if (!is_object($db)) 30 throw new RuntimeException('no database available'); 31 32 return $db; 33 } 34 }
Download modules/cms/base/DB.class.php
History Fri, 15 Apr 2022 14:51:22 +0200 dankert Refactoring: User,Config and Database info is now stored in the Request, because so there is no session required for clients which are using Basic Authorization. Sat, 26 Sep 2020 02:26:39 +0200 Jan Dankert Refactoring: No global functions any more, the database object is read from the Db class. Fri, 18 Sep 2020 22:48:46 +0200 Jan Dankert Refactoring: Every project has 1 publishing target.