admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 1 | <?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 | */ |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame] | 25 | class CI_DB_odbc_utility extends CI_DB_utility { |
| 26 | |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Create database |
| 30 | * |
admin | 6cec6a5 | 2006-09-25 06:56:49 +0000 | [diff] [blame] | 31 | * @access private |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 32 | * @param string the database name |
| 33 | * @return bool |
| 34 | */ |
admin | 6cec6a5 | 2006-09-25 06:56:49 +0000 | [diff] [blame] | 35 | function _create_database() |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 36 | { |
| 37 | // ODBC has no "create database" command since it's |
| 38 | // designed to connect to an existing database |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 39 | if ($this->db->db_debug) |
admin | 7249637 | 2006-09-25 03:44:04 +0000 | [diff] [blame] | 40 | { |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 41 | return $this->db->display_error('db_unsuported_feature'); |
admin | 7249637 | 2006-09-25 03:44:04 +0000 | [diff] [blame] | 42 | } |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 43 | return FALSE; |
| 44 | } |
| 45 | |
| 46 | // -------------------------------------------------------------------- |
| 47 | |
| 48 | /** |
| 49 | * Drop database |
| 50 | * |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 51 | * @access private |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 52 | * @param string the database name |
| 53 | * @return bool |
| 54 | */ |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 55 | function _drop_database($name) |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 56 | { |
| 57 | // ODBC has no "drop database" command since it's |
admin | 7249637 | 2006-09-25 03:44:04 +0000 | [diff] [blame] | 58 | // designed to connect to an existing database |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 59 | if ($this->db->db_debug) |
admin | 7249637 | 2006-09-25 03:44:04 +0000 | [diff] [blame] | 60 | { |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 61 | return $this->db->display_error('db_unsuported_feature'); |
admin | 7249637 | 2006-09-25 03:44:04 +0000 | [diff] [blame] | 62 | } |
| 63 | return FALSE; |
| 64 | } |
| 65 | |
| 66 | // -------------------------------------------------------------------- |
| 67 | |
| 68 | /** |
admin | b2a9cec | 2006-10-01 03:38:04 +0000 | [diff] [blame] | 69 | * List databases |
| 70 | * |
| 71 | * @access private |
| 72 | * @return bool |
| 73 | */ |
| 74 | function _list_databases() |
| 75 | { |
| 76 | // Not sure if ODBC lets you list all databases... |
| 77 | if ($this->db->db_debug) |
| 78 | { |
| 79 | return $this->db->display_error('db_unsuported_feature'); |
| 80 | } |
| 81 | return FALSE; |
| 82 | } |
| 83 | |
| 84 | // -------------------------------------------------------------------- |
| 85 | |
| 86 | /** |
admin | 4ceac2d | 2006-09-25 06:40:16 +0000 | [diff] [blame] | 87 | * Drop Table |
| 88 | * |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 89 | * @access private |
admin | 4ceac2d | 2006-09-25 06:40:16 +0000 | [diff] [blame] | 90 | * @return bool |
| 91 | */ |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 92 | function _drop_table($table) |
admin | 4ceac2d | 2006-09-25 06:40:16 +0000 | [diff] [blame] | 93 | { |
| 94 | // Not a supported ODBC feature |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 95 | if ($this->db->db_debug) |
admin | 4ceac2d | 2006-09-25 06:40:16 +0000 | [diff] [blame] | 96 | { |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 97 | return $this->db->display_error('db_unsuported_feature'); |
admin | 4ceac2d | 2006-09-25 06:40:16 +0000 | [diff] [blame] | 98 | } |
| 99 | return FALSE; |
| 100 | } |
| 101 | |
| 102 | // -------------------------------------------------------------------- |
| 103 | |
| 104 | /** |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 105 | * Optimize table query |
| 106 | * |
| 107 | * Generates a platform-specific query so that a table can be optimized |
| 108 | * |
| 109 | * @access private |
| 110 | * @param string the table name |
| 111 | * @return object |
| 112 | */ |
| 113 | function _optimize_table($table) |
| 114 | { |
| 115 | // Not a supported ODBC feature |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 116 | if ($this->db->db_debug) |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 117 | { |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 118 | return $this->db->display_error('db_unsuported_feature'); |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 119 | } |
| 120 | return FALSE; |
| 121 | } |
| 122 | |
| 123 | // -------------------------------------------------------------------- |
| 124 | |
| 125 | /** |
| 126 | * Repair table query |
| 127 | * |
| 128 | * Generates a platform-specific query so that a table can be repaired |
| 129 | * |
| 130 | * @access private |
| 131 | * @param string the table name |
| 132 | * @return object |
| 133 | */ |
| 134 | function _repair_table($table) |
| 135 | { |
| 136 | // Not a supported ODBC feature |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 137 | if ($this->db->db_debug) |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 138 | { |
admin | 3dd978f | 2006-09-30 19:24:45 +0000 | [diff] [blame] | 139 | return $this->db->display_error('db_unsuported_feature'); |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 140 | } |
| 141 | return FALSE; |
| 142 | } |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame] | 143 | |
| 144 | |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | ?> |