You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rcube_db_sqlsrv.php 1.8KB

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