blob: 0c265de16add8e41d630e0b6caddef7e3c8c8aa4 [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 * Postgre 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_postgre_utility extends CI_DB_utility {
26
admin7b613c72006-09-24 18:05:17 +000027
28 /**
admin6ca6f942006-09-25 02:51:08 +000029 * Create database
30 *
admin6cec6a52006-09-25 06:56:49 +000031 * @access private
admin6ca6f942006-09-25 02:51:08 +000032 * @param string the database name
33 * @return bool
34 */
admin6cec6a52006-09-25 06:56:49 +000035 function _create_database($name)
admin6ca6f942006-09-25 02:51:08 +000036 {
admin6cec6a52006-09-25 06:56:49 +000037 return "CREATE DATABASE ".$name;
admin6ca6f942006-09-25 02:51:08 +000038 }
39
40 // --------------------------------------------------------------------
41
42 /**
43 * Drop database
44 *
admin83b05a82006-09-25 21:06:46 +000045 * @access private
admin6ca6f942006-09-25 02:51:08 +000046 * @param string the database name
47 * @return bool
48 */
admin83b05a82006-09-25 21:06:46 +000049 function _drop_database($name)
admin6ca6f942006-09-25 02:51:08 +000050 {
admin83b05a82006-09-25 21:06:46 +000051 return "DROP DATABASE ".$name;
admin6ca6f942006-09-25 02:51:08 +000052 }
53
54 // --------------------------------------------------------------------
55
56 /**
adminb2a9cec2006-10-01 03:38:04 +000057 * 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 /**
admin4ceac2d2006-09-25 06:40:16 +000070 * Drop Table
71 *
admin83b05a82006-09-25 21:06:46 +000072 * @access private
admin4ceac2d2006-09-25 06:40:16 +000073 * @return bool
74 */
admin83b05a82006-09-25 21:06:46 +000075 function _drop_table($table)
admin4ceac2d2006-09-25 06:40:16 +000076 {
admin83b05a82006-09-25 21:06:46 +000077 return "DROP TABLE ".$this->db->_escape_table($name)." CASCADE";
admin4ceac2d2006-09-25 06:40:16 +000078 }
admin72496372006-09-25 03:44:04 +000079
80 // --------------------------------------------------------------------
81
82 /**
adminab4f61b2006-09-25 22:12:32 +000083 * Optimize table query
84 *
admin4a2ed692006-09-29 01:14:52 +000085 * Is table optimization supported in Postgre?
adminab4f61b2006-09-25 22:12:32 +000086 *
87 * @access private
88 * @param string the table name
89 * @return object
90 */
91 function _optimize_table($table)
92 {
admin4a2ed692006-09-29 01:14:52 +000093 return FALSE;
adminab4f61b2006-09-25 22:12:32 +000094 }
95
96 // --------------------------------------------------------------------
97
98 /**
99 * Repair table query
100 *
admin4a2ed692006-09-29 01:14:52 +0000101 * Are table repairs supported in Postgre?
adminab4f61b2006-09-25 22:12:32 +0000102 *
103 * @access private
104 * @param string the table name
105 * @return object
106 */
107 function _repair_table($table)
108 {
admin4a2ed692006-09-29 01:14:52 +0000109 return return FALSE;
adminab4f61b2006-09-25 22:12:32 +0000110 }
111
admin3cad41e2006-10-02 03:21:46 +0000112 // --------------------------------------------------------------------
113
114 /**
115 * Postgre Export
116 *
117 * @access private
118 * @param array Preferences
119 * @return mixed
120 */
121 function _backup($params = array())
122 {
123 // Currently unsupported
124 return $this->db->display_error('db_unsuported_feature');
125 }
admina5e812c2006-09-25 02:17:30 +0000126
admin7b613c72006-09-24 18:05:17 +0000127}
128
129?>