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 | * Postgre 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_postgre_utility extends CI_DB_utility { |
| 26 | |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 27 | |
| 28 | /** |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 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($name) |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 36 | { |
admin | 6cec6a5 | 2006-09-25 06:56:49 +0000 | [diff] [blame] | 37 | return "CREATE DATABASE ".$name; |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | // -------------------------------------------------------------------- |
| 41 | |
| 42 | /** |
| 43 | * Drop database |
| 44 | * |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 45 | * @access private |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 46 | * @param string the database name |
| 47 | * @return bool |
| 48 | */ |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 49 | function _drop_database($name) |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 50 | { |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 51 | return "DROP DATABASE ".$name; |
admin | 6ca6f94 | 2006-09-25 02:51:08 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | // -------------------------------------------------------------------- |
| 55 | |
| 56 | /** |
admin | b2a9cec | 2006-10-01 03:38:04 +0000 | [diff] [blame^] | 57 | * List databases |
| 58 | * |
| 59 | * @access private |
| 60 | * @return bool |
| 61 | */ |
| 62 | function _list_databases() |
| 63 | { |
| 64 | return "SELECT datname FROM pg_database"; |
| 65 | } |
| 66 | |
| 67 | // -------------------------------------------------------------------- |
| 68 | |
| 69 | /** |
admin | 4ceac2d | 2006-09-25 06:40:16 +0000 | [diff] [blame] | 70 | * Drop Table |
| 71 | * |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 72 | * @access private |
admin | 4ceac2d | 2006-09-25 06:40:16 +0000 | [diff] [blame] | 73 | * @return bool |
| 74 | */ |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 75 | function _drop_table($table) |
admin | 4ceac2d | 2006-09-25 06:40:16 +0000 | [diff] [blame] | 76 | { |
admin | 83b05a8 | 2006-09-25 21:06:46 +0000 | [diff] [blame] | 77 | return "DROP TABLE ".$this->db->_escape_table($name)." CASCADE"; |
admin | 4ceac2d | 2006-09-25 06:40:16 +0000 | [diff] [blame] | 78 | } |
admin | 7249637 | 2006-09-25 03:44:04 +0000 | [diff] [blame] | 79 | |
| 80 | // -------------------------------------------------------------------- |
| 81 | |
| 82 | /** |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 83 | * Optimize table query |
| 84 | * |
admin | 4a2ed69 | 2006-09-29 01:14:52 +0000 | [diff] [blame] | 85 | * Is table optimization supported in Postgre? |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 86 | * |
| 87 | * @access private |
| 88 | * @param string the table name |
| 89 | * @return object |
| 90 | */ |
| 91 | function _optimize_table($table) |
| 92 | { |
admin | 4a2ed69 | 2006-09-29 01:14:52 +0000 | [diff] [blame] | 93 | return FALSE; |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | // -------------------------------------------------------------------- |
| 97 | |
| 98 | /** |
| 99 | * Repair table query |
| 100 | * |
admin | 4a2ed69 | 2006-09-29 01:14:52 +0000 | [diff] [blame] | 101 | * Are table repairs supported in Postgre? |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 102 | * |
| 103 | * @access private |
| 104 | * @param string the table name |
| 105 | * @return object |
| 106 | */ |
| 107 | function _repair_table($table) |
| 108 | { |
admin | 4a2ed69 | 2006-09-29 01:14:52 +0000 | [diff] [blame] | 109 | return return FALSE; |
admin | ab4f61b | 2006-09-25 22:12:32 +0000 | [diff] [blame] | 110 | } |
| 111 | |
admin | a5e812c | 2006-09-25 02:17:30 +0000 | [diff] [blame] | 112 | |
admin | 7b613c7 | 2006-09-24 18:05:17 +0000 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | ?> |