blob: 2932da87441be04f6ef027bd6e6cf835a7e22ef0 [file] [log] [blame]
admin7b613c72006-09-24 18:05:17 +00001<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2/**
3 * Code Igniter
4 *
5 * An open source application development framework for PHP 4.3.2 or newer
6 *
7 * @package CodeIgniter
8 * @author Rick Ellis
9 * @copyright Copyright (c) 2006, pMachine, Inc.
10 * @license http://www.codeignitor.com/user_guide/license.html
11 * @link http://www.codeigniter.com
12 * @since Version 1.0
13 * @filesource
14 */
15
16// ------------------------------------------------------------------------
17
18/**
19 * ODBC Utility Class
20 *
21 * @category Database
22 * @author Rick Ellis
23 * @link http://www.codeigniter.com/database/
24 */
admina5e812c2006-09-25 02:17:30 +000025class CI_DB_odbc_utility extends CI_DB_utility {
26
admin6ca6f942006-09-25 02:51:08 +000027
28 /**
29 * Create database
30 *
admin6cec6a52006-09-25 06:56:49 +000031 * @access private
admin6ca6f942006-09-25 02:51:08 +000032 * @param string the database name
33 * @return bool
34 */
admin6cec6a52006-09-25 06:56:49 +000035 function _create_database()
admin6ca6f942006-09-25 02:51:08 +000036 {
37 // ODBC has no "create database" command since it's
38 // designed to connect to an existing database
admin72496372006-09-25 03:44:04 +000039 if ($this->db_debug)
40 {
41 return $this->display_error('db_unsuported_feature');
42 }
admin6ca6f942006-09-25 02:51:08 +000043 return FALSE;
44 }
45
46 // --------------------------------------------------------------------
47
48 /**
49 * Drop database
50 *
admin83b05a82006-09-25 21:06:46 +000051 * @access private
admin6ca6f942006-09-25 02:51:08 +000052 * @param string the database name
53 * @return bool
54 */
admin83b05a82006-09-25 21:06:46 +000055 function _drop_database($name)
admin6ca6f942006-09-25 02:51:08 +000056 {
57 // ODBC has no "drop database" command since it's
admin72496372006-09-25 03:44:04 +000058 // designed to connect to an existing database
59 if ($this->db_debug)
60 {
61 return $this->display_error('db_unsuported_feature');
62 }
63 return FALSE;
64 }
65
66 // --------------------------------------------------------------------
67
68 /**
69 * List databases
70 *
admin83b05a82006-09-25 21:06:46 +000071 * @access private
admin72496372006-09-25 03:44:04 +000072 * @return bool
73 */
admin83b05a82006-09-25 21:06:46 +000074 function _list_databases()
admin72496372006-09-25 03:44:04 +000075 {
76 // Not sure if ODBC lets you list all databases...
77 if ($this->db_debug)
78 {
79 return $this->display_error('db_unsuported_feature');
80 }
admin6ca6f942006-09-25 02:51:08 +000081 return FALSE;
82 }
83
84 // --------------------------------------------------------------------
85
admin7b613c72006-09-24 18:05:17 +000086 /**
admin4ceac2d2006-09-25 06:40:16 +000087 * Drop Table
88 *
admin83b05a82006-09-25 21:06:46 +000089 * @access private
admin4ceac2d2006-09-25 06:40:16 +000090 * @return bool
91 */
admin83b05a82006-09-25 21:06:46 +000092 function _drop_table($table)
admin4ceac2d2006-09-25 06:40:16 +000093 {
94 // Not a supported ODBC feature
95 if ($this->db_debug)
96 {
97 return $this->display_error('db_unsuported_feature');
98 }
99 return FALSE;
100 }
101
102 // --------------------------------------------------------------------
103
104 /**
admina5e812c2006-09-25 02:17:30 +0000105 * Version number query string
admin7b613c72006-09-24 18:05:17 +0000106 *
107 * @access public
admina5e812c2006-09-25 02:17:30 +0000108 * @return string
admin7b613c72006-09-24 18:05:17 +0000109 */
admina5e812c2006-09-25 02:17:30 +0000110 function _version()
admin7b613c72006-09-24 18:05:17 +0000111 {
admina5e812c2006-09-25 02:17:30 +0000112 return "SELECT version() AS ver";
admin7b613c72006-09-24 18:05:17 +0000113 }
114
115 // --------------------------------------------------------------------
116
admina5e812c2006-09-25 02:17:30 +0000117 /**
118 * Show table query
119 *
120 * Generates a platform-specific query string so that the table names can be fetched
121 *
122 * @access public
123 * @return string
124 */
125 function _show_tables()
126 {
127 return "SHOW TABLES FROM `".$this->db->database."`";
128 }
129
130 // --------------------------------------------------------------------
131
132 /**
133 * Show columnn query
134 *
135 * Generates a platform-specific query string so that the column names can be fetched
136 *
137 * @access public
138 * @param string the table name
139 * @return string
140 */
141 function _show_columns($table = '')
142 {
143 return "SHOW COLUMNS FROM ".$this->db->_escape_table($table);
144 }
145
146 // --------------------------------------------------------------------
147
148 /**
149 * Field data query
150 *
151 * Generates a platform-specific query so that the column data can be retrieved
152 *
153 * @access public
154 * @param string the table name
155 * @return object
156 */
157 function _field_data($table)
158 {
admin6cec6a52006-09-25 06:56:49 +0000159 return "SELECT TOP 1 FROM ".$this->db->_escape_table($table);
admina5e812c2006-09-25 02:17:30 +0000160 }
161
adminab4f61b2006-09-25 22:12:32 +0000162 // --------------------------------------------------------------------
163
164 /**
165 * Optimize table query
166 *
167 * Generates a platform-specific query so that a table can be optimized
168 *
169 * @access private
170 * @param string the table name
171 * @return object
172 */
173 function _optimize_table($table)
174 {
175 // Not a supported ODBC feature
176 if ($this->db_debug)
177 {
178 return $this->display_error('db_unsuported_feature');
179 }
180 return FALSE;
181 }
182
183 // --------------------------------------------------------------------
184
185 /**
186 * Repair table query
187 *
188 * Generates a platform-specific query so that a table can be repaired
189 *
190 * @access private
191 * @param string the table name
192 * @return object
193 */
194 function _repair_table($table)
195 {
196 // Not a supported ODBC feature
197 if ($this->db_debug)
198 {
199 return $this->display_error('db_unsuported_feature');
200 }
201 return FALSE;
202 }
admina5e812c2006-09-25 02:17:30 +0000203
204
admin7b613c72006-09-24 18:05:17 +0000205}
206
207?>