|
Revision 24590, 1.9 kB
(checked in by FabianLange, 3 years ago)
|
[1.2, 1.3, 1.4] fixed obtaining error from mysqli session storage (fixes #7737)
|
- Property svn:mime-type set to
text/x-php
- Property svn:eol-style set to
native
- Property svn:keywords set to
Id Rev Date
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
class sfMySQLiSessionStorage extends sfMySQLSessionStorage |
|---|
| 26 |
{ |
|---|
| 27 |
|
|---|
| 28 |
* Execute an SQL Query |
|---|
| 29 |
* |
|---|
| 30 |
* @param string $query The query to execute |
|---|
| 31 |
* @return mixed The result of the query |
|---|
| 32 |
*/ |
|---|
| 33 |
protected function db_query($query) |
|---|
| 34 |
{ |
|---|
| 35 |
return mysqli_query($this->db, $query); |
|---|
| 36 |
} |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
* Escape a string before using it in a query statement |
|---|
| 40 |
* |
|---|
| 41 |
* @param string $string The string to escape |
|---|
| 42 |
* @return string The escaped string |
|---|
| 43 |
*/ |
|---|
| 44 |
protected function db_escape($string) |
|---|
| 45 |
{ |
|---|
| 46 |
return mysqli_real_escape_string($this->db, $string); |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
* Count the rows in a query result |
|---|
| 51 |
* |
|---|
| 52 |
* @param resource $result Result of a query |
|---|
| 53 |
* @return int Number of rows |
|---|
| 54 |
*/ |
|---|
| 55 |
protected function db_num_rows($result) |
|---|
| 56 |
{ |
|---|
| 57 |
return $result->num_rows; |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
* Extract a row from a query result set |
|---|
| 62 |
* |
|---|
| 63 |
* @param resource $result Result of a query |
|---|
| 64 |
* @return array Extracted row as an indexed array |
|---|
| 65 |
*/ |
|---|
| 66 |
protected function db_fetch_row($result) |
|---|
| 67 |
{ |
|---|
| 68 |
return $result->fetch_row(); |
|---|
| 69 |
} |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
* Returns the text of the error message from previous database operation |
|---|
| 73 |
* |
|---|
| 74 |
* @return string The error text from the last database function |
|---|
| 75 |
*/ |
|---|
| 76 |
protected function db_error() |
|---|
| 77 |
{ |
|---|
| 78 |
return mysqli_error($this->db); |
|---|
| 79 |
} |
|---|
| 80 |
} |
|---|
| 81 |
|
|---|