blob: 9bf2f5aa96e17bc6eff5cf85d97f870010d0af0a [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 * MySQL Utility Class
20 *
21 * @category Database
22 * @author Rick Ellis
23 * @link http://www.codeigniter.com/user_guide/database/
24 */
admina5e812c2006-09-25 02:17:30 +000025class CI_DB_mysql_utility extends CI_DB_utility {
admin7b613c72006-09-24 18:05:17 +000026
admina5e812c2006-09-25 02:17:30 +000027
admin7b613c72006-09-24 18:05:17 +000028 /**
admina5e812c2006-09-25 02:17:30 +000029 * Version number query string
admin7b613c72006-09-24 18:05:17 +000030 *
31 * @access public
admina5e812c2006-09-25 02:17:30 +000032 * @return string
admin7b613c72006-09-24 18:05:17 +000033 */
admina5e812c2006-09-25 02:17:30 +000034 function _version()
admin7b613c72006-09-24 18:05:17 +000035 {
admina5e812c2006-09-25 02:17:30 +000036 return "SELECT version() AS ver";
37 }
38
39 // --------------------------------------------------------------------
40
41 /**
42 * Show table query
43 *
44 * Generates a platform-specific query string so that the table names can be fetched
45 *
46 * @access public
47 * @return string
48 */
49 function _show_tables()
50 {
51 return "SHOW TABLES FROM `".$this->db->database."`";
admin7b613c72006-09-24 18:05:17 +000052 }
53
54 // --------------------------------------------------------------------
55
admina5e812c2006-09-25 02:17:30 +000056 /**
57 * Show columnn query
58 *
59 * Generates a platform-specific query string so that the column names can be fetched
60 *
61 * @access public
62 * @param string the table name
63 * @return string
64 */
65 function _show_columns($table = '')
66 {
67 return "SHOW COLUMNS FROM ".$this->db->_escape_table($table);
68 }
69
70 // --------------------------------------------------------------------
71
72 /**
73 * Field data query
74 *
75 * Generates a platform-specific query so that the column data can be retrieved
76 *
77 * @access public
78 * @param string the table name
79 * @return object
80 */
81 function _field_data($table)
82 {
83 $sql = "SELECT * FROM ".$this->db->_escape_table($table)." LIMIT 1";
84 $query = $this->db->query($sql);
85 return $query->field_data();
86 }
87
88
admin7b613c72006-09-24 18:05:17 +000089}
90
91?>