/libraries/joomla/database/iterator/sqlsrv.php

https://gitlab.com/vitaliylukin91/text · PHP · 55 lines · 17 code · 4 blank · 34 comment · 0 complexity · be6dec09a4ef82c2463fd291a64d098a MD5 · raw file

  1. <?php
  2. /**
  3. * @package Joomla.Platform
  4. * @subpackage Database
  5. *
  6. * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE
  8. */
  9. defined('JPATH_PLATFORM') or die;
  10. /**
  11. * SQL server database iterator.
  12. *
  13. * @since 12.1
  14. */
  15. class JDatabaseIteratorSqlsrv extends JDatabaseIterator
  16. {
  17. /**
  18. * Get the number of rows in the result set for the executed SQL given by the cursor.
  19. *
  20. * @return integer The number of rows in the result set.
  21. *
  22. * @since 12.1
  23. * @see Countable::count()
  24. */
  25. public function count()
  26. {
  27. return sqlsrv_num_rows($this->cursor);
  28. }
  29. /**
  30. * Method to fetch a row from the result set cursor as an object.
  31. *
  32. * @return mixed Either the next row from the result set or false if there are no more rows.
  33. *
  34. * @since 12.1
  35. */
  36. protected function fetchObject()
  37. {
  38. return sqlsrv_fetch_object($this->cursor, $this->class);
  39. }
  40. /**
  41. * Method to free up the memory used for the result set.
  42. *
  43. * @return void
  44. *
  45. * @since 12.1
  46. */
  47. protected function freeResult()
  48. {
  49. sqlsrv_free_stmt($this->cursor);
  50. }
  51. }