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_sqlite.class.php,v 1.4 2005/11/30 23:02:18 tamlyn Exp $
8 */
9  
10 //include the 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 SQLite 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_sqlite extends sgIOsql
20 {
21 /**
22 * Database resource pointer
23 */
24 var $db;
25  
26 /**
27 * @param sgConfig pointer to a {@link sgConfig} object representing
28 * the current script configuration
29 */
30 function sgIO_sqlite()
31 {
32 $this->config =& sgConfig::getInstance();
33 $this->db = sqlite_open($this->config->base_path.$this->config->pathto_data_dir."sqlite.dat");
34 }
35  
36 /**
37 * Name of IO backend.
38 */
39 function getName()
40 {
41 return "SQLite";
42 }
43  
44 /**
45 * Version of IO backend.
46 */
47 function getVersion()
48 {
49 return "$Revision: 1.4 $";
50 }
51  
52 /**
53 * Author of IO backend.
54 */
55 function getAuthor()
56 {
57 return "Tamlyn Rhodes";
58 }
59  
60 /**
61 * Brief description of IO backend and it's requirements.
62 */
63 function getDescription()
64 {
65 return "Uses a SQLite database. Requires only the SQLite PHP extension which incorporates the database server.";
66 }
67  
68 function query($query)
69 {
70 return sqlite_query($this->db, $query);
71 }
72  
73 function escape_string($query)
74 {
75 return sqlite_escape_string($query);
76 }
77  
78 function fetch_array($res)
79 {
80 return sqlite_fetch_array($res);
81 }
82  
83 function num_rows($res)
84 {
85 return sqlite_num_rows($res);
86 }
87  
88 function error()
89 {
90 return sqlite_error_string(sqlite_last_error($this->db));
91 }
92  
93 }
94  
95 ?>