0
|
1 <?php
|
|
2
|
|
3 /**
|
|
4 +-----------------------------------------------------------------------+
|
|
5 | This file is part of the Roundcube Webmail client |
|
|
6 | Copyright (C) 2005-2012, The Roundcube Dev Team |
|
|
7 | |
|
|
8 | Licensed under the GNU General Public License version 3 or |
|
|
9 | any later version with exceptions for skins & plugins. |
|
|
10 | See the README file for a full license statement. |
|
|
11 | |
|
|
12 | PURPOSE: |
|
|
13 | Database wrapper class that implements PHP PDO functions |
|
|
14 | for MS SQL Server database |
|
|
15 +-----------------------------------------------------------------------+
|
|
16 | Author: Aleksander Machniak <alec@alec.pl> |
|
|
17 +-----------------------------------------------------------------------+
|
|
18 */
|
|
19
|
|
20 /**
|
|
21 * Database independent query interface
|
|
22 * This is a wrapper for the PHP PDO
|
|
23 *
|
|
24 * @package Framework
|
|
25 * @subpackage Database
|
|
26 */
|
|
27 class rcube_db_sqlsrv extends rcube_db_mssql
|
|
28 {
|
|
29 /**
|
|
30 * Returns PDO DSN string from DSN array
|
|
31 */
|
|
32 protected function dsn_string($dsn)
|
|
33 {
|
|
34 $params = array();
|
|
35 $result = 'sqlsrv:';
|
|
36
|
|
37 if ($dsn['hostspec']) {
|
|
38 $host = $dsn['hostspec'];
|
|
39
|
|
40 if ($dsn['port']) {
|
|
41 $host .= ',' . $dsn['port'];
|
|
42 }
|
|
43
|
|
44 $params[] = 'Server=' . $host;
|
|
45 }
|
|
46
|
|
47 if ($dsn['database']) {
|
|
48 $params[] = 'Database=' . $dsn['database'];
|
|
49 }
|
|
50
|
|
51 if (!empty($params)) {
|
|
52 $result .= implode(';', $params);
|
|
53 }
|
|
54
|
|
55 return $result;
|
|
56 }
|
|
57 }
|