@@ -16,10 +16,16 @@ discard block |
||
| 16 | 16 | protected static $connections = [], |
| 17 | 17 | $current = 'default'; |
| 18 | 18 | |
| 19 | + /** |
|
| 20 | + * @param string $name |
|
| 21 | + */ |
|
| 19 | 22 | public static function register($name, $dsn, $username=null, $password=null, $options=[]){ |
| 20 | 23 | return self::$connections[$name] = new SQLConnection($dsn, $username, $password, $options); |
| 21 | 24 | } |
| 22 | 25 | |
| 26 | + /** |
|
| 27 | + * @param string $dsn |
|
| 28 | + */ |
|
| 23 | 29 | public static function connect($dsn, $username=null, $password=null, $options=[]){ |
| 24 | 30 | return self::register('default', $dsn, $username, $password, $options); |
| 25 | 31 | } |
@@ -41,6 +47,9 @@ discard block |
||
| 41 | 47 | } else return false; |
| 42 | 48 | } |
| 43 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string $name |
|
| 52 | + */ |
|
| 44 | 53 | public static function using($name){ |
| 45 | 54 | if (empty(self::$connections[$name])) throw new \Exception("[SQL] Unknown connection named '$name'."); |
| 46 | 55 | return self::$connections[$name]; |