1. sfMySQLiSessionStorage.class.php
  2. /** * Provides support for session storage using a MySQL brand database * using the MySQL improved API. * * parameters: see sfDatabaseSessionStorage * * @package symfony * @subpackage storage * @author Fabien Potencier * @author Sean Kerr * @author Julien Garand * @version SVN: $Id: sfMySQLiSessionStorage.class.php 24590 2009-11-30 18:28:13Z FabianLange $ */
  3. class sfMySQLiSessionStorage extends sfMySQLSessionStorage
  4. {
  5. /**
  6. * Execute an SQL Query
  7. *
  8. * @param string $query The query to execute
  9. * @return mixed The result of the query
  10. */
  11. protected function db_query($query)
  12. {
  13. return mysqli_query($this->db, $query);
  14. }
  15. /**
  16. * Escape a string before using it in a query statement
  17. *
  18. * @param string $string The string to escape
  19. * @return string The escaped string
  20. */
  21. protected function db_escape($string)
  22. {
  23. return mysqli_real_escape_string($this->db, $string);
  24. }
  25. /**
  26. * Count the rows in a query result
  27. *
  28. * @param resource $result Result of a query
  29. * @return int Number of rows
  30. */
  31. protected function db_num_rows($result)
  32. {
  33. return $result->num_rows;
  34. }
  35. /**
  36. * Extract a row from a query result set
  37. *
  38. * @param resource $result Result of a query
  39. * @return array Extracted row as an indexed array
  40. */
  41. protected function db_fetch_row($result)
  42. {
  43. return $result->fetch_row();
  44. }
  45. /**
  46. * Returns the text of the error message from previous database operation
  47. *
  48. * @return string The error text from the last database function
  49. */
  50. protected function db_error()
  51. {
  52. return mysqli_error($this->db);
  53. }
  54. }

Debug toolbar