1: <?php
2: /**
3: * ManiaLive - TrackMania dedicated server manager in PHP
4: *
5: * @copyright Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
6: * @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
7: * @version $Revision: 449 $:
8: * @author $Author: melot.philippe@gmail.com $:
9: * @date $Date: 2012-09-06 15:20:52 +0200 (jeu., 06 sept. 2012) $:
10: */
11:
12: namespace ManiaLive\Database\MySQL;
13:
14: class RecordSet extends \ManiaLive\Database\RecordSet
15: {
16: const FETCH_ASSOC = MYSQL_ASSOC;
17: const FETCH_NUM = MYSQL_NUM;
18: const FETCH_BOTH = MYSQL_BOTH;
19:
20: protected $result;
21:
22: function __construct($result)
23: {
24: $this->result = $result;
25: }
26:
27: function fetchRow()
28: {
29: return mysql_fetch_row($this->result);
30: }
31:
32: function fetchAssoc()
33: {
34: return mysql_fetch_assoc($this->result);
35: }
36:
37: function fetchArray($resultType = self::FETCH_ASSOC)
38: {
39: return mysql_fetch_array($this->result, $resultType);
40: }
41:
42: /**
43: * @deprecated
44: */
45: function fetchStdObject()
46: {
47: return $this->fetchObject(null);
48: }
49:
50: function fetchObject($className='\\stdClass', array $params=array())
51: {
52: if($className)
53: {
54: if($params)
55: {
56: return mysql_fetch_object($this->result, $className, $params);
57: }
58: else
59: {
60: return mysql_fetch_object($this->result, $className);
61: }
62: }
63: else
64: {
65: return mysql_fetch_object($this->result);
66: }
67: }
68:
69: function recordCount()
70: {
71: return mysql_num_rows($this->result);
72: }
73:
74: function recordAvailable()
75: {
76: return mysql_num_rows($this->result) > 0;
77: }
78: }
79:
80: ?>