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 | * MySQLi Utility Class |
| 20 | * |
| 21 | * @category Database |
| 22 | * @author Rick Ellis |
| 23 | * @link http://www.codeigniter.com/user_guide/database/ |
| 24 | */ |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame^] | 25 | class CI_DB_mysqli_utility extends CI_DB_utility { |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 26 | |
| 27 | /** |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame^] | 28 | * Version number query string |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 29 | * |
| 30 | * @access public |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame^] | 31 | * @return string |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 32 | */ |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame^] | 33 | function _version() |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 34 | { |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame^] | 35 | return "SELECT version() AS ver"; |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | // -------------------------------------------------------------------- |
| 39 | |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame^] | 40 | /** |
| 41 | * Show table query |
| 42 | * |
| 43 | * Generates a platform-specific query string so that the table names can be fetched |
| 44 | * |
| 45 | * @access public |
| 46 | * @return string |
| 47 | */ |
| 48 | function _show_tables() |
| 49 | { |
| 50 | return "SHOW TABLES FROM `".$this->db->database."`"; |
| 51 | } |
| 52 | |
| 53 | // -------------------------------------------------------------------- |
| 54 | |
| 55 | /** |
| 56 | * Show columnn query |
| 57 | * |
| 58 | * Generates a platform-specific query string so that the column names can be fetched |
| 59 | * |
| 60 | * @access public |
| 61 | * @param string the table name |
| 62 | * @return string |
| 63 | */ |
| 64 | function _show_columns($table = '') |
| 65 | { |
| 66 | return "SHOW COLUMNS FROM ".$this->db->_escape_table($table); |
| 67 | } |
| 68 | |
| 69 | // -------------------------------------------------------------------- |
| 70 | |
| 71 | /** |
| 72 | * Field data query |
| 73 | * |
| 74 | * Generates a platform-specific query so that the column data can be retrieved |
| 75 | * |
| 76 | * @access public |
| 77 | * @param string the table name |
| 78 | * @return object |
| 79 | */ |
| 80 | function _field_data($table) |
| 81 | { |
| 82 | $sql = "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1"; |
| 83 | $query = $this->db->query($sql); |
| 84 | return $query->field_data(); |
| 85 | } |
| 86 | |
| 87 | |
| 88 | |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | ?> |