@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | $attributes = array_change_key_case($attributes, CASE_UPPER); |
83 | 83 | |
84 | - $sql .= "\n\t\"" . $this->db->_protect_identifiers($field) . "\""; |
|
84 | + $sql .= "\n\t\"".$this->db->_protect_identifiers($field)."\""; |
|
85 | 85 | |
86 | 86 | if (array_key_exists('NAME', $attributes)) |
87 | 87 | { |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | // If there is a PK defined |
186 | 186 | if (count($primary_keys) > 0) |
187 | 187 | { |
188 | - $key_name = "pk_" . $table . "_" . |
|
188 | + $key_name = "pk_".$table."_". |
|
189 | 189 | $this->db->_protect_identifiers(implode('_', $primary_keys)); |
190 | 190 | |
191 | 191 | $primary_keys = $this->db->_protect_identifiers($primary_keys); |
192 | - $sql .= ",\n\tCONSTRAINT " . $key_name . " PRIMARY KEY(" . implode(', ', $primary_keys) . ")"; |
|
192 | + $sql .= ",\n\tCONSTRAINT ".$key_name." PRIMARY KEY(".implode(', ', $primary_keys).")"; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | if (is_array($keys) && count($keys) > 0) |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $key = array($key_name); |
208 | 208 | } |
209 | 209 | |
210 | - $sql .= ",\n\tKEY \"{$key_name}\" (" . implode(', ', $key) . ")"; |
|
210 | + $sql .= ",\n\tKEY \"{$key_name}\" (".implode(', ', $key).")"; |
|
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | if ($after_field != '') |
260 | 260 | { |
261 | - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); |
|
261 | + $sql .= ' AFTER '.$this->db->_protect_identifiers($after_field); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | return $sql; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -76,8 +78,7 @@ discard block |
||
76 | 78 | if (is_numeric($field)) |
77 | 79 | { |
78 | 80 | $sql .= "\n\t$attributes"; |
79 | - } |
|
80 | - else |
|
81 | + } else |
|
81 | 82 | { |
82 | 83 | $attributes = array_change_key_case($attributes, CASE_UPPER); |
83 | 84 | |
@@ -128,8 +129,7 @@ discard block |
||
128 | 129 | if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) |
129 | 130 | { |
130 | 131 | $sql .= ' NULL'; |
131 | - } |
|
132 | - else |
|
132 | + } else |
|
133 | 133 | { |
134 | 134 | $sql .= ' NOT NULL'; |
135 | 135 | } |
@@ -200,8 +200,7 @@ discard block |
||
200 | 200 | { |
201 | 201 | $key_name = $this->db->_protect_identifiers(implode('_', $key)); |
202 | 202 | $key = $this->db->_protect_identifiers($key); |
203 | - } |
|
204 | - else |
|
203 | + } else |
|
205 | 204 | { |
206 | 205 | $key_name = $this->db->_protect_identifiers($key); |
207 | 206 | $key = array($key_name); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param mixed primary key(s) |
74 | 74 | * @param mixed key(s) |
75 | 75 | * @param boolean should 'IF NOT EXISTS' be added to the SQL |
76 | - * @return bool |
|
76 | + * @return string |
|
77 | 77 | */ |
78 | 78 | function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) |
79 | 79 | { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param string the default value |
204 | 204 | * @param boolean should 'NOT NULL' be added |
205 | 205 | * @param string the field after which we should add the new field |
206 | - * @return object |
|
206 | + * @return string |
|
207 | 207 | */ |
208 | 208 | function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') |
209 | 209 | { |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | |
84 | 84 | while ($field = cubrid_fetch_field($this->result_id)) |
85 | 85 | { |
86 | - $F = new stdClass(); |
|
86 | + $F = new stdClass(); |
|
87 | 87 | $F->name = $field->name; |
88 | 88 | $F->type = $field->type; |
89 | - $F->default = $field->def; |
|
90 | - $F->max_length = $field->max_length; |
|
89 | + $F->default = $field->def; |
|
90 | + $F->max_length = $field->max_length; |
|
91 | 91 | |
92 | 92 | // At this moment primary_key property is not returned when |
93 | 93 | // cubrid_fetch_field is called. The following code will |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | // The query will search for exact single columns, thus |
104 | 104 | // compound PK is not supported. |
105 | 105 | $res = cubrid_query($this->conn_id, |
106 | - "SELECT COUNT(*) FROM db_index WHERE class_name = '" . $field->table . |
|
107 | - "' AND is_primary_key = 'YES' AND index_name = 'pk_" . |
|
108 | - $field->table . "_" . $field->name . "'" |
|
106 | + "SELECT COUNT(*) FROM db_index WHERE class_name = '".$field->table. |
|
107 | + "' AND is_primary_key = 'YES' AND index_name = 'pk_". |
|
108 | + $field->table."_".$field->name."'" |
|
109 | 109 | ); |
110 | 110 | |
111 | 111 | if ($res) |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | function free_result() |
141 | 141 | { |
142 | - if(is_resource($this->result_id) || |
|
142 | + if (is_resource($this->result_id) || |
|
143 | 143 | get_resource_type($this->result_id) == "Unknown" && |
144 | 144 | preg_match('/Resource id #/', strval($this->result_id))) |
145 | 145 | { |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -112,8 +114,7 @@ discard block |
||
112 | 114 | { |
113 | 115 | $row = cubrid_fetch_array($res, CUBRID_NUM); |
114 | 116 | $F->primary_key = ($row[0] > 0 ? 1 : null); |
115 | - } |
|
116 | - else |
|
117 | + } else |
|
117 | 118 | { |
118 | 119 | $F->primary_key = null; |
119 | 120 | } |
@@ -86,12 +86,12 @@ |
||
86 | 86 | $retval = array(); |
87 | 87 | for ($i = 0; $i < $this->num_fields(); $i++) |
88 | 88 | { |
89 | - $F = new stdClass(); |
|
89 | + $F = new stdClass(); |
|
90 | 90 | $F->name = pg_field_name($this->result_id, $i); |
91 | 91 | $F->type = pg_field_type($this->result_id, $i); |
92 | - $F->max_length = pg_field_size($this->result_id, $i); |
|
92 | + $F->max_length = pg_field_size($this->result_id, $i); |
|
93 | 93 | $F->primary_key = 0; |
94 | - $F->default = ''; |
|
94 | + $F->default = ''; |
|
95 | 95 | |
96 | 96 | $retval[] = $F; |
97 | 97 | } |
@@ -121,7 +121,7 @@ |
||
121 | 121 | * result set starts at zero |
122 | 122 | * |
123 | 123 | * @access private |
124 | - * @return array |
|
124 | + * @return boolean |
|
125 | 125 | */ |
126 | 126 | function _data_seek($n = 0) |
127 | 127 | { |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /* |
3 | 5 | | ------------------------------------------------------------------- |
4 | 6 | | AUTO-LOADER |
@@ -86,12 +86,12 @@ |
||
86 | 86 | $retval = array(); |
87 | 87 | while ($field = mssql_fetch_field($this->result_id)) |
88 | 88 | { |
89 | - $F = new stdClass(); |
|
89 | + $F = new stdClass(); |
|
90 | 90 | $F->name = $field->name; |
91 | 91 | $F->type = $field->type; |
92 | - $F->max_length = $field->max_length; |
|
92 | + $F->max_length = $field->max_length; |
|
93 | 93 | $F->primary_key = 0; |
94 | - $F->default = ''; |
|
94 | + $F->default = ''; |
|
95 | 95 | |
96 | 96 | $retval[] = $F; |
97 | 97 | } |
@@ -121,7 +121,7 @@ |
||
121 | 121 | * result set starts at zero |
122 | 122 | * |
123 | 123 | * @access private |
124 | - * @return array |
|
124 | + * @return boolean |
|
125 | 125 | */ |
126 | 126 | function _data_seek($n = 0) |
127 | 127 | { |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /* |
3 | 5 | | ------------------------------------------------------------------- |
4 | 6 | | AUTO-LOADER |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $sql .= "\n\t".$this->db->_protect_identifiers($field); |
92 | 92 | |
93 | - $sql .= ' '.$attributes['TYPE']; |
|
93 | + $sql .= ' '.$attributes['TYPE']; |
|
94 | 94 | |
95 | 95 | if (array_key_exists('CONSTRAINT', $attributes)) |
96 | 96 | { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | if (count($primary_keys) > 0) |
133 | 133 | { |
134 | 134 | $primary_keys = $this->db->_protect_identifiers($primary_keys); |
135 | - $sql .= ",\n\tPRIMARY KEY (" . implode(', ', $primary_keys) . ")"; |
|
135 | + $sql .= ",\n\tPRIMARY KEY (".implode(', ', $primary_keys).")"; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | if (is_array($keys) && count($keys) > 0) |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $key = array($this->db->_protect_identifiers($key)); |
149 | 149 | } |
150 | 150 | |
151 | - $sql .= ",\n\tUNIQUE COLUMNS (" . implode(', ', $key) . ")"; |
|
151 | + $sql .= ",\n\tUNIQUE COLUMNS (".implode(', ', $key).")"; |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | if ($after_field != '') |
218 | 218 | { |
219 | - $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field); |
|
219 | + $sql .= ' AFTER '.$this->db->_protect_identifiers($after_field); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return $sql; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param mixed primary key(s) |
74 | 74 | * @param mixed key(s) |
75 | 75 | * @param boolean should 'IF NOT EXISTS' be added to the SQL |
76 | - * @return bool |
|
76 | + * @return string |
|
77 | 77 | */ |
78 | 78 | function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists) |
79 | 79 | { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param string the default value |
204 | 204 | * @param boolean should 'NOT NULL' be added |
205 | 205 | * @param string the field after which we should add the new field |
206 | - * @return object |
|
206 | + * @return string |
|
207 | 207 | */ |
208 | 208 | function _alter_table($alter_type, $table, $column_name, $column_definition = '', $default_value = '', $null = '', $after_field = '') |
209 | 209 | { |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * CodeIgniter |
4 | 6 | * |
@@ -96,8 +98,7 @@ discard block |
||
96 | 98 | if (is_numeric($field)) |
97 | 99 | { |
98 | 100 | $sql .= "\n\t$attributes"; |
99 | - } |
|
100 | - else |
|
101 | + } else |
|
101 | 102 | { |
102 | 103 | $attributes = array_change_key_case($attributes, CASE_UPPER); |
103 | 104 | |
@@ -123,8 +124,7 @@ discard block |
||
123 | 124 | if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE) |
124 | 125 | { |
125 | 126 | $sql .= ' NULL'; |
126 | - } |
|
127 | - else |
|
127 | + } else |
|
128 | 128 | { |
129 | 129 | $sql .= ' NOT NULL'; |
130 | 130 | } |
@@ -155,8 +155,7 @@ discard block |
||
155 | 155 | if (is_array($key)) |
156 | 156 | { |
157 | 157 | $key = $this->db->_protect_identifiers($key); |
158 | - } |
|
159 | - else |
|
158 | + } else |
|
160 | 159 | { |
161 | 160 | $key = array($this->db->_protect_identifiers($key)); |
162 | 161 | } |
@@ -208,8 +207,7 @@ discard block |
||
208 | 207 | if ($null === NULL) |
209 | 208 | { |
210 | 209 | $sql .= ' NULL'; |
211 | - } |
|
212 | - else |
|
210 | + } else |
|
213 | 211 | { |
214 | 212 | $sql .= ' NOT NULL'; |
215 | 213 | } |
@@ -112,10 +112,10 @@ |
||
112 | 112 | $retval = array(); |
113 | 113 | for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++) |
114 | 114 | { |
115 | - $F = new stdClass(); |
|
115 | + $F = new stdClass(); |
|
116 | 116 | $F->name = oci_field_name($this->stmt_id, $c); |
117 | 117 | $F->type = oci_field_type($this->stmt_id, $c); |
118 | - $F->max_length = oci_field_size($this->stmt_id, $c); |
|
118 | + $F->max_length = oci_field_size($this->stmt_id, $c); |
|
119 | 119 | |
120 | 120 | $retval[] = $F; |
121 | 121 | } |
@@ -121,7 +121,7 @@ |
||
121 | 121 | * result set starts at zero |
122 | 122 | * |
123 | 123 | * @access private |
124 | - * @return array |
|
124 | + * @return boolean |
|
125 | 125 | */ |
126 | 126 | function _data_seek($n = 0) |
127 | 127 | { |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /* |
3 | 5 | | ------------------------------------------------------------------- |
4 | 6 | | AUTO-LOADER |
@@ -94,9 +94,9 @@ |
||
94 | 94 | $F = new stdClass(); |
95 | 95 | $F->name = $field->Field; |
96 | 96 | $F->type = $type; |
97 | - $F->default = $field->Default; |
|
98 | - $F->max_length = $length; |
|
99 | - $F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 ); |
|
97 | + $F->default = $field->Default; |
|
98 | + $F->max_length = $length; |
|
99 | + $F->primary_key = ($field->Key == 'PRI' ? 1 : 0); |
|
100 | 100 | |
101 | 101 | $retval[] = $F; |
102 | 102 | } |
@@ -121,7 +121,7 @@ |
||
121 | 121 | * result set starts at zero |
122 | 122 | * |
123 | 123 | * @access private |
124 | - * @return array |
|
124 | + * @return boolean |
|
125 | 125 | */ |
126 | 126 | function _data_seek($n = 0) |
127 | 127 | { |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /* |
3 | 5 | | ------------------------------------------------------------------- |
4 | 6 | | AUTO-LOADER |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | function list_fields() |
64 | 64 | { |
65 | 65 | $field_names = array(); |
66 | - foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) |
|
66 | + foreach (sqlsrv_field_metadata($this->result_id) as $offset => $field) |
|
67 | 67 | { |
68 | 68 | $field_names[] = $field['Name']; |
69 | 69 | } |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | function field_data() |
85 | 85 | { |
86 | 86 | $retval = array(); |
87 | - foreach(sqlsrv_field_metadata($this->result_id) as $offset => $field) |
|
87 | + foreach (sqlsrv_field_metadata($this->result_id) as $offset => $field) |
|
88 | 88 | { |
89 | 89 | $F = new stdClass(); |
90 | 90 | $F->name = $field['Name']; |
91 | 91 | $F->type = $field['Type']; |
92 | - $F->max_length = $field['Size']; |
|
92 | + $F->max_length = $field['Size']; |
|
93 | 93 | $F->primary_key = 0; |
94 | - $F->default = ''; |
|
94 | + $F->default = ''; |
|
95 | 95 | |
96 | 96 | $retval[] = $F; |
97 | 97 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /* |
3 | 5 | | ------------------------------------------------------------------- |
4 | 6 | | AUTO-LOADER |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | class CI_DB_utility extends CI_DB_forge { |
26 | 26 | |
27 | 27 | var $db; |
28 | - var $data_cache = array(); |
|
28 | + var $data_cache = array(); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Constructor |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | function __construct() |
37 | 37 | { |
38 | 38 | // Assign the main database object to $this->db |
39 | - $CI =& get_instance(); |
|
40 | - $this->db =& $CI->db; |
|
39 | + $CI = & get_instance(); |
|
40 | + $this->db = & $CI->db; |
|
41 | 41 | |
42 | 42 | log_message('debug', "Database Utility Class Initialized"); |
43 | 43 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | extract($params); |
261 | 261 | |
262 | 262 | // Load the xml helper |
263 | - $CI =& get_instance(); |
|
263 | + $CI = & get_instance(); |
|
264 | 264 | $CI->load->helper('xml'); |
265 | 265 | |
266 | 266 | // Generate the result |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | // Is the encoder supported? If not, we'll either issue an |
346 | 346 | // error or use plain text depending on the debug settings |
347 | 347 | if (($prefs['format'] == 'gzip' AND ! @function_exists('gzencode')) |
348 | - OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress'))) |
|
348 | + OR ($prefs['format'] == 'zip' AND ! @function_exists('gzcompress'))) |
|
349 | 349 | { |
350 | 350 | if ($this->db->db_debug) |
351 | 351 | { |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | // Load the Zip class and output it |
401 | 401 | |
402 | - $CI =& get_instance(); |
|
402 | + $CI = & get_instance(); |
|
403 | 403 | $CI->load->library('zip'); |
404 | 404 | $CI->zip->add_data($prefs['filename'], $this->_backup($prefs)); |
405 | 405 | return $CI->zip->get_zip(); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('BASEPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | // ------------------------------------------------------------------------ |
4 | 6 | |
@@ -59,8 +61,7 @@ discard block |
||
59 | 61 | if ($download == "") |
60 | 62 | { |
61 | 63 | return $str; |
62 | - } |
|
63 | - else |
|
64 | + } else |
|
64 | 65 | { |
65 | 66 | echo $str; |
66 | 67 | } |