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 | * |
| 31 | * @access public |
| 32 | * @param string the database name |
| 33 | * @return bool |
| 34 | */ |
| 35 | function create_database($name) |
| 36 | { |
| 37 | // ODBC has no "create database" command since it's |
| 38 | // designed to connect to an existing database |
| 39 | return FALSE; |
| 40 | } |
| 41 | |
| 42 | // -------------------------------------------------------------------- |
| 43 | |
| 44 | /** |
| 45 | * Drop database |
| 46 | * |
| 47 | * @access public |
| 48 | * @param string the database name |
| 49 | * @return bool |
| 50 | */ |
| 51 | function drop_database($name) |
| 52 | { |
| 53 | // ODBC has no "drop database" command since it's |
| 54 | // designed to connect to an existing database |
| 55 | return FALSE; |
| 56 | } |
| 57 | |
| 58 | // -------------------------------------------------------------------- |
| 59 | |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 60 | /** |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame] | 61 | * Version number query string |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 62 | * |
| 63 | * @access public |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame] | 64 | * @return string |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 65 | */ |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame] | 66 | function _version() |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 67 | { |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame] | 68 | return "SELECT version() AS ver"; |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | // -------------------------------------------------------------------- |
| 72 | |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame] | 73 | /** |
| 74 | * Show table query |
| 75 | * |
| 76 | * Generates a platform-specific query string so that the table names can be fetched |
| 77 | * |
| 78 | * @access public |
| 79 | * @return string |
| 80 | */ |
| 81 | function _show_tables() |
| 82 | { |
| 83 | return "SHOW TABLES FROM `".$this->db->database."`"; |
| 84 | } |
| 85 | |
| 86 | // -------------------------------------------------------------------- |
| 87 | |
| 88 | /** |
| 89 | * Show columnn query |
| 90 | * |
| 91 | * Generates a platform-specific query string so that the column names can be fetched |
| 92 | * |
| 93 | * @access public |
| 94 | * @param string the table name |
| 95 | * @return string |
| 96 | */ |
| 97 | function _show_columns($table = '') |
| 98 | { |
| 99 | return "SHOW COLUMNS FROM ".$this->db->_escape_table($table); |
| 100 | } |
| 101 | |
| 102 | // -------------------------------------------------------------------- |
| 103 | |
| 104 | /** |
| 105 | * Field data query |
| 106 | * |
| 107 | * Generates a platform-specific query so that the column data can be retrieved |
| 108 | * |
| 109 | * @access public |
| 110 | * @param string the table name |
| 111 | * @return object |
| 112 | */ |
| 113 | function _field_data($table) |
| 114 | { |
| 115 | $sql = "SELECT TOP 1 FROM ".$this->db->_escape_table($table); |
| 116 | $query = $this->db->query($sql); |
| 117 | return $query->field_data(); |
| 118 | } |
| 119 | |
| 120 | |
| 121 | |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | ?> |