Rev Author Line No. Line
228 kaklik 1 <?php
2  
3 /**
4 * IO class.
5 * @license http://opensource.org/licenses/gpl-license.php GNU General Public License
6 * @copyright (c)2003, 2004 Tamlyn Rhodes
7 * @version $Id: io_mysql.class.php,v 1.7 2005/11/30 23:02:18 tamlyn Exp $
8 */
9  
10 //include the base IO class and generic SQL class
11 require_once dirname(__FILE__)."/iosql.class.php";
12  
13 /**
14 * Class used to read and write data to and from a MySQL database.
15 * @package singapore
16 * @author Tamlyn Rhodes <tam at zenology dot co dot uk>
17 * @copyright (c)2004 Tamlyn Rhodes
18 */
19 class sgIO_mysql extends sgIOsql
20 {
21 /**
22 * @param sgConfig pointer to a {@link sgConfig} object representing
23 * the current script configuration
24 */
25 function sgIO_mysql()
26 {
27 $this->config =& sgConfig::getInstance();
28 mysql_connect($this->config->sql_host, $this->config->sql_user, $this->config->sql_pass);
29 mysql_select_db($this->config->sql_database);
30 }
31  
32 /**
33 * Name of IO backend.
34 */
35 function getName()
36 {
37 return "MySQL";
38 }
39  
40 /**
41 * Version of IO backend.
42 */
43 function getVersion()
44 {
45 return "$Revision: 1.7 $";
46 }
47  
48 /**
49 * Author of IO backend.
50 */
51 function getAuthor()
52 {
53 return "Tamlyn Rhodes";
54 }
55  
56 /**
57 * Brief description of IO backend and it's requirements.
58 */
59 function getDescription()
60 {
61 return "Uses a MySQL database. Requires a MySQL database server and the MySQL PHP extension.";
62 }
63  
64 function query($query)
65 {
66 return mysql_query($query);
67 }
68  
69 function escape_string($query)
70 {
71 return mysql_escape_string($query);
72 }
73  
74 function fetch_array($res)
75 {
76 return mysql_fetch_array($res);
77 }
78  
79 function num_rows($res)
80 {
81 return mysql_num_rows($res);
82 }
83  
84 function error()
85 {
86 return mysql_error();
87 }
88  
89 }
90  
91 ?>