@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @param string $table |
| 96 | 96 | * @return boolean |
| 97 | 97 | */ |
| 98 | - public function table_exists($table, $schema='') |
|
| 98 | + public function table_exists($table, $schema = '') |
|
| 99 | 99 | { |
| 100 | 100 | $table = addslashes("$table"); |
| 101 | 101 | if ($schema == '') { |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | $sql_new = $sql; |
| 120 | 120 | |
| 121 | 121 | if (isset($params['limit']) && is_numeric($params['limit'])) { |
| 122 | - $sql_new.=" LIMIT $params[limit]"; |
|
| 122 | + $sql_new .= " LIMIT $params[limit]"; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (isset($params['offset']) && is_numeric($params['offset'])) { |
| 126 | - $sql_new.=" OFFSET $params[offset]"; |
|
| 126 | + $sql_new .= " OFFSET $params[offset]"; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | return $sql_new; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @param string $table |
| 136 | 136 | * @return boolean |
| 137 | 137 | */ |
| 138 | - public function drop_table($table, $if_exists=true) |
|
| 138 | + public function drop_table($table, $if_exists = true) |
|
| 139 | 139 | { |
| 140 | 140 | if ($if_exists) { |
| 141 | 141 | return $this->query("DROP TABLE IF EXISTS $table"); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param array $definition |
| 158 | 158 | * @return boolean |
| 159 | 159 | */ |
| 160 | - public function create_table($table, $definition, $index=array()) |
|
| 160 | + public function create_table($table, $definition, $index = array()) |
|
| 161 | 161 | { |
| 162 | 162 | $create_sql = "CREATE TABLE $table ("; |
| 163 | 163 | if (!is_array($definition)) { |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | $create_lines[] = "`$field` " . $field_def['type'] . $size . ' ' . $not_null . ' ' . $extra; |
| 209 | 209 | } |
| 210 | - $create_sql.= join(',', $create_lines); |
|
| 210 | + $create_sql .= join(',', $create_lines); |
|
| 211 | 211 | $last_lines = array(); |
| 212 | 212 | if (count($primary)) { |
| 213 | 213 | $last_lines[] = 'PRIMARY KEY(' . join(",", $primary) . ')'; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $last_lines[] = join(',', $unique_index); |
| 220 | 220 | } |
| 221 | 221 | if (count($last_lines)) { |
| 222 | - $create_sql.= ',' . join(',', $last_lines) . ')'; |
|
| 222 | + $create_sql .= ',' . join(',', $last_lines) . ')'; |
|
| 223 | 223 | } |
| 224 | 224 | return $this->query($create_sql); |
| 225 | 225 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @param string $table |
| 241 | 241 | * @return array |
| 242 | 242 | */ |
| 243 | - public function describe_table($table, $schema='') |
|
| 243 | + public function describe_table($table, $schema = '') |
|
| 244 | 244 | { |
| 245 | 245 | if ($schema == '') { |
| 246 | 246 | $describe = $this->fetch_all("DESCRIBE `$table`"); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param string $table |
| 118 | 118 | * @return boolean |
| 119 | 119 | */ |
| 120 | - public function drop_table($table, $if_exists=true) |
|
| 120 | + public function drop_table($table, $if_exists = true) |
|
| 121 | 121 | { |
| 122 | 122 | if ($if_exists) { |
| 123 | 123 | if ($this->table_exists($table)) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @param array $definition |
| 143 | 143 | * @return boolean |
| 144 | 144 | */ |
| 145 | - public function create_table($table, $definition, $index=array()) |
|
| 145 | + public function create_table($table, $definition, $index = array()) |
|
| 146 | 146 | { |
| 147 | 147 | $create_sql = "CREATE TABLE $table ("; |
| 148 | 148 | if (!is_array($definition)) { |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | $create_lines[] = "$field " . $field_def['type'] . $size . ' ' . $not_null . ' ' . $extra; |
| 194 | 194 | } |
| 195 | - $create_sql.= join(',', $create_lines); |
|
| 195 | + $create_sql .= join(',', $create_lines); |
|
| 196 | 196 | $last_lines = array(); |
| 197 | 197 | if (count($primary)) { |
| 198 | 198 | $last_lines[] = 'PRIMARY KEY(' . join(",", $primary) . ')'; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $last_lines[] = join(',', $unique_index); |
| 205 | 205 | } |
| 206 | 206 | if (count($last_lines)) { |
| 207 | - $create_sql.= ',' . join(',', $last_lines) . ')'; |
|
| 207 | + $create_sql .= ',' . join(',', $last_lines) . ')'; |
|
| 208 | 208 | } |
| 209 | 209 | return $this->query($create_sql); |
| 210 | 210 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * |
| 225 | 225 | * @return integer |
| 226 | 226 | */ |
| 227 | - public function last_insert_id($table='', $primary_key='') |
|
| 227 | + public function last_insert_id($table = '', $primary_key = '') |
|
| 228 | 228 | { |
| 229 | 229 | /** |
| 230 | 230 | * Oracle No soporta columnas autonuméricas |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * @param string $table |
| 244 | 244 | * @return boolean |
| 245 | 245 | */ |
| 246 | - function table_exists($table, $schema='') |
|
| 246 | + function table_exists($table, $schema = '') |
|
| 247 | 247 | { |
| 248 | 248 | $num = $this->fetch_one("SELECT COUNT(*) FROM ALL_TABLES WHERE TABLE_NAME = '" . strtoupper($table) . "'"); |
| 249 | 249 | return $num[0]; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @param string $table |
| 256 | 256 | * @return array |
| 257 | 257 | */ |
| 258 | - public function describe_table($table, $schema='') |
|
| 258 | + public function describe_table($table, $schema = '') |
|
| 259 | 259 | { |
| 260 | 260 | /** |
| 261 | 261 | * Soporta schemas? |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @param string $table |
| 93 | 93 | * @return boolean |
| 94 | 94 | */ |
| 95 | - public function table_exists($table, $schema='') |
|
| 95 | + public function table_exists($table, $schema = '') |
|
| 96 | 96 | { |
| 97 | 97 | $table = addslashes("$table"); |
| 98 | 98 | $num = $this->fetch_one("SELECT COUNT(*) FROM sysobjects WHERE type = 'U' AND name = '$table'"); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | { |
| 110 | 110 | $params = Util::getParams(func_get_args()); |
| 111 | 111 | |
| 112 | - if(!isset($params['offset']) && isset($params['limit'])){ |
|
| 112 | + if (!isset($params['offset']) && isset($params['limit'])) { |
|
| 113 | 113 | return str_ireplace("SELECT ", "SELECT TOP $params[limit] ", $sql); |
| 114 | 114 | } |
| 115 | 115 | $orderby = stristr($sql, 'ORDER BY'); |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | $sql = preg_replace('/^SELECT\s/i', 'SELECT TOP ' . $params[offset] . ' ', $sql); |
| 122 | 122 | $sql = 'SELECT * FROM (SELECT TOP ' . $params[limit] . ' * FROM (' . $sql . ') AS itable'; |
| 123 | 123 | if ($orderby !== false) { |
| 124 | - $sql.= ' ORDER BY ' . $order . ' '; |
|
| 125 | - $sql.= ( stripos($sort, 'asc') !== false) ? 'DESC' : 'ASC'; |
|
| 124 | + $sql .= ' ORDER BY ' . $order . ' '; |
|
| 125 | + $sql .= (stripos($sort, 'asc') !== false) ? 'DESC' : 'ASC'; |
|
| 126 | 126 | } |
| 127 | - $sql.= ') AS otable'; |
|
| 127 | + $sql .= ') AS otable'; |
|
| 128 | 128 | if ($orderby !== false) { |
| 129 | - $sql.=' ORDER BY ' . $order . ' ' . $sort; |
|
| 129 | + $sql .= ' ORDER BY ' . $order . ' ' . $sort; |
|
| 130 | 130 | } |
| 131 | 131 | return $sql; |
| 132 | 132 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param string $table |
| 138 | 138 | * @return boolean |
| 139 | 139 | */ |
| 140 | - public function drop_table($table, $if_exists=true) |
|
| 140 | + public function drop_table($table, $if_exists = true) |
|
| 141 | 141 | { |
| 142 | 142 | if ($if_exists) { |
| 143 | 143 | if ($this->table_exists($table)) { |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param array $definition |
| 164 | 164 | * @return boolean |
| 165 | 165 | */ |
| 166 | - public function create_table($table, $definition, $index=array()) |
|
| 166 | + public function create_table($table, $definition, $index = array()) |
|
| 167 | 167 | { |
| 168 | 168 | $create_sql = "CREATE TABLE $table ("; |
| 169 | 169 | if (!is_array($definition)) { |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | $create_lines[] = "$field " . $field_def['type'] . $size . ' ' . $not_null . ' ' . $extra; |
| 215 | 215 | } |
| 216 | - $create_sql.= join(',', $create_lines); |
|
| 216 | + $create_sql .= join(',', $create_lines); |
|
| 217 | 217 | $last_lines = array(); |
| 218 | 218 | if (count($primary)) { |
| 219 | 219 | $last_lines[] = 'PRIMARY KEY(' . join(",", $primary) . ')'; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $last_lines[] = join(',', $unique_index); |
| 226 | 226 | } |
| 227 | 227 | if (count($last_lines)) { |
| 228 | - $create_sql.= ',' . join(',', $last_lines) . ')'; |
|
| 228 | + $create_sql .= ',' . join(',', $last_lines) . ')'; |
|
| 229 | 229 | } |
| 230 | 230 | return $this->query($create_sql); |
| 231 | 231 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @param string $table |
| 247 | 247 | * @return array |
| 248 | 248 | */ |
| 249 | - public function describe_table($table, $schema='') |
|
| 249 | + public function describe_table($table, $schema = '') |
|
| 250 | 250 | { |
| 251 | 251 | $describe_table = $this->fetch_all("exec sp_columns @table_name = '$table'"); |
| 252 | 252 | $final_describe = array(); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @return integer |
| 277 | 277 | */ |
| 278 | - public function last_insert_id($table='', $primary_key='') |
|
| 278 | + public function last_insert_id($table = '', $primary_key = '') |
|
| 279 | 279 | { |
| 280 | 280 | /** |
| 281 | 281 | * Porque no funciona SELECT SCOPE_IDENTITY()? |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function exec($sql); |
| 47 | 47 | |
| 48 | - public function fetch_array($resultQuery=NULL, $opt=''); |
|
| 48 | + public function fetch_array($resultQuery = NULL, $opt = ''); |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @return bool |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | * @param resource $result_query |
| 59 | 59 | * @return integer |
| 60 | 60 | */ |
| 61 | - public function num_rows($result_query=NULL); |
|
| 61 | + public function num_rows($result_query = NULL); |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * @param resource $resultQuery |
| 65 | 65 | * @return string |
| 66 | 66 | */ |
| 67 | - public function field_name($number, $resultQuery=NULL); |
|
| 67 | + public function field_name($number, $resultQuery = NULL); |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * Este metodo no esta soportado por PDO, usar fetch_all y luego contar con count() |
@@ -72,22 +72,22 @@ discard block |
||
| 72 | 72 | * @param resource $result_query |
| 73 | 73 | * @return boolean |
| 74 | 74 | */ |
| 75 | - public function data_seek($number, $result_query=NULL); |
|
| 75 | + public function data_seek($number, $result_query = NULL); |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * @return integer |
| 79 | 79 | */ |
| 80 | - public function affected_rows($result_query=NULL); |
|
| 80 | + public function affected_rows($result_query = NULL); |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * @return string |
| 84 | 84 | */ |
| 85 | - public function error($err=''); |
|
| 85 | + public function error($err = ''); |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * @return integer |
| 89 | 89 | */ |
| 90 | - public function no_error($number=0); |
|
| 90 | + public function no_error($number = 0); |
|
| 91 | 91 | |
| 92 | 92 | public function in_query($sql); |
| 93 | 93 | |
@@ -99,19 +99,19 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | public function fetch_all($sql); |
| 101 | 101 | |
| 102 | - public function last_insert_id($name=''); |
|
| 102 | + public function last_insert_id($name = ''); |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * @return integer |
| 106 | 106 | */ |
| 107 | - public function insert($table, $values, $pk=''); |
|
| 107 | + public function insert($table, $values, $pk = ''); |
|
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * @param string $where_condition |
| 111 | 111 | * |
| 112 | 112 | * @return integer |
| 113 | 113 | */ |
| 114 | - public function update($table, $fields, $values, $where_condition=null); |
|
| 114 | + public function update($table, $fields, $values, $where_condition = null); |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * @param string $where_condition |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | public function limit($sql); |
| 124 | 124 | |
| 125 | - public function create_table($table, $definition, $index=array()); |
|
| 125 | + public function create_table($table, $definition, $index = array()); |
|
| 126 | 126 | |
| 127 | - public function drop_table($table, $if_exists=false); |
|
| 127 | + public function drop_table($table, $if_exists = false); |
|
| 128 | 128 | |
| 129 | - public function table_exists($table, $schema=''); |
|
| 129 | + public function table_exists($table, $schema = ''); |
|
| 130 | 130 | |
| 131 | - public function describe_table($table, $schema=''); |
|
| 131 | + public function describe_table($table, $schema = ''); |
|
| 132 | 132 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * |
| 95 | 95 | * @return integer |
| 96 | 96 | */ |
| 97 | - public function last_insert_id($table='', $primary_key='') |
|
| 97 | + public function last_insert_id($table = '', $primary_key = '') |
|
| 98 | 98 | { |
| 99 | 99 | return $this->pdo->lastInsertId("{$table}_{$primary_key}_seq"); |
| 100 | 100 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param string $table |
| 106 | 106 | * @return boolean |
| 107 | 107 | */ |
| 108 | - function table_exists($table, $schema='') |
|
| 108 | + function table_exists($table, $schema = '') |
|
| 109 | 109 | { |
| 110 | 110 | $table = addslashes(strtolower($table)); |
| 111 | 111 | if (strpos($table, ".")) { |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | $sql_new = $sql; |
| 133 | 133 | |
| 134 | 134 | if (isset($params['limit']) && is_numeric($params['limit'])) { |
| 135 | - $sql_new.=" LIMIT $params[limit]"; |
|
| 135 | + $sql_new .= " LIMIT $params[limit]"; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (isset($params['offset']) && is_numeric($params['offset'])) { |
| 139 | - $sql_new.=" OFFSET $params[offset]"; |
|
| 139 | + $sql_new .= " OFFSET $params[offset]"; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | return $sql_new; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @param string $table |
| 149 | 149 | * @return boolean |
| 150 | 150 | */ |
| 151 | - public function drop_table($table, $if_exists=true) |
|
| 151 | + public function drop_table($table, $if_exists = true) |
|
| 152 | 152 | { |
| 153 | 153 | if ($if_exists) { |
| 154 | 154 | if ($this->table_exists($table)) { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @param array $definition |
| 174 | 174 | * @return boolean |
| 175 | 175 | */ |
| 176 | - public function create_table($table, $definition, $index=array()) |
|
| 176 | + public function create_table($table, $definition, $index = array()) |
|
| 177 | 177 | { |
| 178 | 178 | $create_sql = "CREATE TABLE $table ("; |
| 179 | 179 | if (!is_array($definition)) { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | $create_lines[] = "$field " . $field_def['type'] . $size . ' ' . $not_null . ' ' . $extra; |
| 225 | 225 | } |
| 226 | - $create_sql.= join(',', $create_lines); |
|
| 226 | + $create_sql .= join(',', $create_lines); |
|
| 227 | 227 | $last_lines = array(); |
| 228 | 228 | if (count($primary)) { |
| 229 | 229 | $last_lines[] = 'PRIMARY KEY(' . join(",", $primary) . ')'; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $last_lines[] = join(',', $unique_index); |
| 236 | 236 | } |
| 237 | 237 | if (count($last_lines)) { |
| 238 | - $create_sql.= ',' . join(',', $last_lines) . ')'; |
|
| 238 | + $create_sql .= ',' . join(',', $last_lines) . ')'; |
|
| 239 | 239 | } |
| 240 | 240 | return $this->query($create_sql); |
| 241 | 241 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param string $table |
| 265 | 265 | * @return array |
| 266 | 266 | */ |
| 267 | - public function describe_table($table, $schema='') |
|
| 267 | + public function describe_table($table, $schema = '') |
|
| 268 | 268 | { |
| 269 | 269 | $describe = $this->fetch_all("SELECT a.attname AS Field, t.typname AS Type, |
| 270 | 270 | CASE WHEN attnotnull=false THEN 'YES' ELSE 'NO' END AS Null, |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @param string $table |
| 90 | 90 | * @return boolean |
| 91 | 91 | */ |
| 92 | - public function table_exists($table, $schema='') |
|
| 92 | + public function table_exists($table, $schema = '') |
|
| 93 | 93 | { |
| 94 | 94 | /** |
| 95 | 95 | * Informix no soporta schemas |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | { |
| 110 | 110 | $params = Util::getParams(func_get_args()); |
| 111 | 111 | |
| 112 | - $limit =''; |
|
| 113 | - if(isset($params['offset'])){ |
|
| 112 | + $limit = ''; |
|
| 113 | + if (isset($params['offset'])) { |
|
| 114 | 114 | $limit .= " SKIP $params[offset]"; |
| 115 | 115 | } |
| 116 | - if(isset($params['limit'])){ |
|
| 116 | + if (isset($params['limit'])) { |
|
| 117 | 117 | $limit .= " FIRST $params[limit]"; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param string $table |
| 127 | 127 | * @return boolean |
| 128 | 128 | */ |
| 129 | - public function drop_table($table, $if_exists=true) |
|
| 129 | + public function drop_table($table, $if_exists = true) |
|
| 130 | 130 | { |
| 131 | 131 | if ($if_exists) { |
| 132 | 132 | if ($this->table_exists($table)) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @param array $definition |
| 154 | 154 | * @return boolean |
| 155 | 155 | */ |
| 156 | - public function create_table($table, $definition, $index=array()) |
|
| 156 | + public function create_table($table, $definition, $index = array()) |
|
| 157 | 157 | { |
| 158 | 158 | $create_sql = "CREATE TABLE $table ("; |
| 159 | 159 | if (!is_array($definition)) { |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | $create_lines[] = "$field " . $field_def['type'] . $size . ' ' . $not_null . ' ' . $extra; |
| 205 | 205 | } |
| 206 | - $create_sql.= join(',', $create_lines); |
|
| 206 | + $create_sql .= join(',', $create_lines); |
|
| 207 | 207 | $last_lines = array(); |
| 208 | 208 | if (count($primary)) { |
| 209 | 209 | $last_lines[] = 'PRIMARY KEY(' . join(",", $primary) . ')'; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $last_lines[] = join(',', $unique_index); |
| 216 | 216 | } |
| 217 | 217 | if (count($last_lines)) { |
| 218 | - $create_sql.= ',' . join(',', $last_lines) . ')'; |
|
| 218 | + $create_sql .= ',' . join(',', $last_lines) . ')'; |
|
| 219 | 219 | } |
| 220 | 220 | return $this->query($create_sql); |
| 221 | 221 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @param string $table |
| 237 | 237 | * @return array |
| 238 | 238 | */ |
| 239 | - public function describe_table($table, $schema='') |
|
| 239 | + public function describe_table($table, $schema = '') |
|
| 240 | 240 | { |
| 241 | 241 | /** |
| 242 | 242 | * Informix no soporta schemas |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param string $table |
| 92 | 92 | * @return boolean |
| 93 | 93 | */ |
| 94 | - public function table_exists($table, $schema='') |
|
| 94 | + public function table_exists($table, $schema = '') |
|
| 95 | 95 | { |
| 96 | 96 | $table = strtolower($table); |
| 97 | 97 | $num = $this->fetch_one("SELECT COUNT(*) FROM sqlite_master WHERE name = '$table'"); |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | $sql_new = $sql; |
| 111 | 111 | |
| 112 | 112 | if (isset($params['limit']) && is_numeric($params['limit'])) { |
| 113 | - $sql_new.=" LIMIT $params[limit]"; |
|
| 113 | + $sql_new .= " LIMIT $params[limit]"; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | if (isset($params['offset']) && is_numeric($params['offset'])) { |
| 117 | - $sql_new.=" OFFSET $params[offset]"; |
|
| 117 | + $sql_new .= " OFFSET $params[offset]"; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | return $sql_new; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param string $table |
| 127 | 127 | * @return boolean |
| 128 | 128 | */ |
| 129 | - public function drop_table($table, $if_exists=true) |
|
| 129 | + public function drop_table($table, $if_exists = true) |
|
| 130 | 130 | { |
| 131 | 131 | if ($if_exists) { |
| 132 | 132 | return $this->query("DROP TABLE IF EXISTS $table"); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param array $definition |
| 148 | 148 | * @return boolean |
| 149 | 149 | */ |
| 150 | - public function create_table($table, $definition, $index=array()) |
|
| 150 | + public function create_table($table, $definition, $index = array()) |
|
| 151 | 151 | { |
| 152 | 152 | $create_sql = "CREATE TABLE $table ("; |
| 153 | 153 | if (!is_array($definition)) { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | } |
| 198 | 198 | $create_lines[] = "$field " . $field_def['type'] . $size . ' ' . $not_null . ' ' . $extra; |
| 199 | 199 | } |
| 200 | - $create_sql.= join(',', $create_lines); |
|
| 200 | + $create_sql .= join(',', $create_lines); |
|
| 201 | 201 | $last_lines = array(); |
| 202 | 202 | if (count($primary)) { |
| 203 | 203 | $last_lines[] = 'PRIMARY KEY(' . join(",", $primary) . ')'; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $last_lines[] = join(',', $unique_index); |
| 210 | 210 | } |
| 211 | 211 | if (count($last_lines)) { |
| 212 | - $create_sql.= ',' . join(',', $last_lines) . ')'; |
|
| 212 | + $create_sql .= ',' . join(',', $last_lines) . ')'; |
|
| 213 | 213 | } |
| 214 | 214 | return $this->exec($create_sql); |
| 215 | 215 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @param string $table |
| 233 | 233 | * @return array |
| 234 | 234 | */ |
| 235 | - public function describe_table($table, $schema='') |
|
| 235 | + public function describe_table($table, $schema = '') |
|
| 236 | 236 | { |
| 237 | 237 | $fields = array(); |
| 238 | 238 | if (!$schema) { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param int $opt |
| 178 | 178 | * @return array |
| 179 | 179 | */ |
| 180 | - public function fetch_array($result_query='', $opt=MYSQL_BOTH) |
|
| 180 | + public function fetch_array($result_query = '', $opt = MYSQL_BOTH) |
|
| 181 | 181 | { |
| 182 | 182 | |
| 183 | 183 | if (!$result_query) { |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | /** |
| 203 | 203 | * Devuelve el numero de filas de un select |
| 204 | 204 | */ |
| 205 | - public function num_rows($result_query='') |
|
| 205 | + public function num_rows($result_query = '') |
|
| 206 | 206 | { |
| 207 | 207 | |
| 208 | 208 | if (!$result_query) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @param resource $result_query |
| 226 | 226 | * @return string |
| 227 | 227 | */ |
| 228 | - public function field_name($number, $result_query='') |
|
| 228 | + public function field_name($number, $result_query = '') |
|
| 229 | 229 | { |
| 230 | 230 | |
| 231 | 231 | if (!$result_query) { |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * @param resource $result_query |
| 249 | 249 | * @return boolean |
| 250 | 250 | */ |
| 251 | - public function data_seek($number, $result_query='') |
|
| 251 | + public function data_seek($number, $result_query = '') |
|
| 252 | 252 | { |
| 253 | 253 | if (!$result_query) { |
| 254 | 254 | $result_query = $this->last_result_query; |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @param resource $result_query |
| 270 | 270 | * @return int |
| 271 | 271 | */ |
| 272 | - public function affected_rows($result_query='') |
|
| 272 | + public function affected_rows($result_query = '') |
|
| 273 | 273 | { |
| 274 | 274 | if (($numberRows = mysql_affected_rows()) !== false) { |
| 275 | 275 | return $numberRows; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | * |
| 284 | 284 | * @return string |
| 285 | 285 | */ |
| 286 | - public function error($err='') |
|
| 286 | + public function error($err = '') |
|
| 287 | 287 | { |
| 288 | 288 | if (!$this->id_connection) { |
| 289 | 289 | $this->last_error = mysql_error() ? mysql_error() : "[Error Desconocido en MySQL: $err]"; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | return $this->last_error; |
| 294 | 294 | } |
| 295 | 295 | $this->last_error = mysql_error() ? mysql_error() : "[Error Desconocido en MySQL: $err]"; |
| 296 | - $this->last_error.= $err; |
|
| 296 | + $this->last_error .= $err; |
|
| 297 | 297 | if ($this->logger) { |
| 298 | 298 | Logger::error($this->last_error); |
| 299 | 299 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * |
| 316 | 316 | * @return int |
| 317 | 317 | */ |
| 318 | - public function last_insert_id($table='', $primary_key='') |
|
| 318 | + public function last_insert_id($table = '', $primary_key = '') |
|
| 319 | 319 | { |
| 320 | 320 | return mysql_insert_id($this->id_connection); |
| 321 | 321 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * @param string $table |
| 327 | 327 | * @return boolean |
| 328 | 328 | */ |
| 329 | - public function table_exists($table, $schema='') |
|
| 329 | + public function table_exists($table, $schema = '') |
|
| 330 | 330 | { |
| 331 | 331 | $table = addslashes("$table"); |
| 332 | 332 | if ($schema == '') { |
@@ -350,11 +350,11 @@ discard block |
||
| 350 | 350 | $sql_new = $sql; |
| 351 | 351 | |
| 352 | 352 | if (isset($params['limit']) && is_numeric($params['limit'])) { |
| 353 | - $sql_new.=" LIMIT $params[limit]"; |
|
| 353 | + $sql_new .= " LIMIT $params[limit]"; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | if (isset($params['offset']) && is_numeric($params['offset'])) { |
| 357 | - $sql_new.=" OFFSET $params[offset]"; |
|
| 357 | + $sql_new .= " OFFSET $params[offset]"; |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | return $sql_new; |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | * @param string $table |
| 367 | 367 | * @return boolean |
| 368 | 368 | */ |
| 369 | - public function drop_table($table, $if_exists=true) |
|
| 369 | + public function drop_table($table, $if_exists = true) |
|
| 370 | 370 | { |
| 371 | 371 | if ($if_exists) { |
| 372 | 372 | return $this->query("DROP TABLE IF EXISTS $table"); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | * @param array $definition |
| 389 | 389 | * @return boolean |
| 390 | 390 | */ |
| 391 | - public function create_table($table, $definition, $index=array()) |
|
| 391 | + public function create_table($table, $definition, $index = array()) |
|
| 392 | 392 | { |
| 393 | 393 | $create_sql = "CREATE TABLE $table ("; |
| 394 | 394 | if (!is_array($definition)) { |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | } |
| 439 | 439 | $create_lines[] = "`$field` " . $field_def['type'] . $size . ' ' . $not_null . ' ' . $extra; |
| 440 | 440 | } |
| 441 | - $create_sql.= join(',', $create_lines); |
|
| 441 | + $create_sql .= join(',', $create_lines); |
|
| 442 | 442 | $last_lines = array(); |
| 443 | 443 | if (count($primary)) { |
| 444 | 444 | $last_lines[] = 'PRIMARY KEY(' . join(",", $primary) . ')'; |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | $last_lines[] = join(',', $unique_index); |
| 451 | 451 | } |
| 452 | 452 | if (count($last_lines)) { |
| 453 | - $create_sql.= ',' . join(',', $last_lines) . ')'; |
|
| 453 | + $create_sql .= ',' . join(',', $last_lines) . ')'; |
|
| 454 | 454 | } |
| 455 | 455 | return $this->query($create_sql); |
| 456 | 456 | } |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | * @param string $table |
| 472 | 472 | * @return array |
| 473 | 473 | */ |
| 474 | - public function describe_table($table, $schema='') |
|
| 474 | + public function describe_table($table, $schema = '') |
|
| 475 | 475 | { |
| 476 | 476 | if ($schema == '') { |
| 477 | 477 | return $this->fetch_all("DESCRIBE `$table`"); |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | * @param string $class clase de objeto |
| 488 | 488 | * @return object |
| 489 | 489 | */ |
| 490 | - public function fetch_object($result_query=null, $class='stdClass') |
|
| 490 | + public function fetch_object($result_query = null, $class = 'stdClass') |
|
| 491 | 491 | { |
| 492 | 492 | if (!$result_query) { |
| 493 | 493 | $result_query = $this->last_result_query; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param int $opt |
| 194 | 194 | * @return array |
| 195 | 195 | */ |
| 196 | - public function fetch_array($result_query=NULL, $opt=2) |
|
| 196 | + public function fetch_array($result_query = NULL, $opt = 2) |
|
| 197 | 197 | { |
| 198 | 198 | |
| 199 | 199 | if (!$result_query) { |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @param resource $result_query |
| 254 | 254 | * @return int |
| 255 | 255 | */ |
| 256 | - public function num_rows($result_query=NULL) |
|
| 256 | + public function num_rows($result_query = NULL) |
|
| 257 | 257 | { |
| 258 | 258 | |
| 259 | 259 | if (!$result_query) { |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param resource $result_query |
| 283 | 283 | * @return string |
| 284 | 284 | */ |
| 285 | - public function field_name($number, $result_query=NULL) |
|
| 285 | + public function field_name($number, $result_query = NULL) |
|
| 286 | 286 | { |
| 287 | 287 | |
| 288 | 288 | if (!$result_query) { |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * @param resource $result_query |
| 309 | 309 | * @return boolean |
| 310 | 310 | */ |
| 311 | - public function data_seek($number, $result_query=NULL) |
|
| 311 | + public function data_seek($number, $result_query = NULL) |
|
| 312 | 312 | { |
| 313 | 313 | if (!$result_query) { |
| 314 | 314 | $result_query = $this->last_result_query; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @param resource $result_query |
| 330 | 330 | * @return int |
| 331 | 331 | */ |
| 332 | - public function affected_rows($result_query=NULL) |
|
| 332 | + public function affected_rows($result_query = NULL) |
|
| 333 | 333 | { |
| 334 | 334 | if (!$result_query) { |
| 335 | 335 | $result_query = $this->last_result_query; |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | * |
| 350 | 350 | * @return string |
| 351 | 351 | */ |
| 352 | - public function error($err='') |
|
| 352 | + public function error($err = '') |
|
| 353 | 353 | { |
| 354 | 354 | if (!$this->id_connection) { |
| 355 | 355 | $this->last_error = ifx_errormsg() ? ifx_errormsg() : "[Error Desconocido en Informix: $err]"; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | return $this->last_error; |
| 360 | 360 | } |
| 361 | 361 | $this->last_error = ifx_errormsg($this->id_connection) ? ifx_errormsg($this->id_connection) : "[Error Desconocido en Informix: $err]"; |
| 362 | - $this->last_error.= $err; |
|
| 362 | + $this->last_error .= $err; |
|
| 363 | 363 | if ($this->logger) { |
| 364 | 364 | Logger::error($this->last_error); |
| 365 | 365 | } |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | * |
| 382 | 382 | * @return int |
| 383 | 383 | */ |
| 384 | - public function last_insert_id($table='', $primary_key='') |
|
| 384 | + public function last_insert_id($table = '', $primary_key = '') |
|
| 385 | 385 | { |
| 386 | 386 | $sqlca = ifx_getsqlca($this->last_result_query); |
| 387 | 387 | return $sqlca["sqlerrd1"]; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | * @param string $table |
| 394 | 394 | * @return integer |
| 395 | 395 | */ |
| 396 | - public function table_exists($table, $schema='') |
|
| 396 | + public function table_exists($table, $schema = '') |
|
| 397 | 397 | { |
| 398 | 398 | // Informix no soporta schemas |
| 399 | 399 | $table = addslashes("$table"); |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | * @param string $sql |
| 408 | 408 | * @return string |
| 409 | 409 | */ |
| 410 | - public function limit($sql){ |
|
| 410 | + public function limit($sql) { |
|
| 411 | 411 | /** |
| 412 | 412 | * No esta soportado por Informix |
| 413 | 413 | */ |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | * @param string $table |
| 422 | 422 | * @return boolean |
| 423 | 423 | */ |
| 424 | - public function drop_table($table, $if_exists=true) |
|
| 424 | + public function drop_table($table, $if_exists = true) |
|
| 425 | 425 | { |
| 426 | 426 | if ($if_exists) { |
| 427 | 427 | if ($this->table_exists($table)) { |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | * @param array $definition |
| 450 | 450 | * @return resource |
| 451 | 451 | */ |
| 452 | - public function create_table($table, $definition, $index=array()) |
|
| 452 | + public function create_table($table, $definition, $index = array()) |
|
| 453 | 453 | { |
| 454 | 454 | $create_sql = "CREATE TABLE $table ("; |
| 455 | 455 | if (!is_array($definition)) { |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | } |
| 500 | 500 | $create_lines[] = "$field " . $field_def['type'] . $size . ' ' . $not_null . ' ' . $extra; |
| 501 | 501 | } |
| 502 | - $create_sql.= join(',', $create_lines); |
|
| 502 | + $create_sql .= join(',', $create_lines); |
|
| 503 | 503 | $last_lines = array(); |
| 504 | 504 | if (count($primary)) { |
| 505 | 505 | $last_lines[] = 'PRIMARY KEY(' . join(",", $primary) . ')'; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | $last_lines[] = join(',', $unique_index); |
| 512 | 512 | } |
| 513 | 513 | if (count($last_lines)) { |
| 514 | - $create_sql.= ',' . join(',', $last_lines) . ')'; |
|
| 514 | + $create_sql .= ',' . join(',', $last_lines) . ')'; |
|
| 515 | 515 | } |
| 516 | 516 | $this->set_return_rows(false); |
| 517 | 517 | return $this->query($create_sql); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | * @param string $table |
| 534 | 534 | * @return array |
| 535 | 535 | */ |
| 536 | - public function describe_table($table, $schema='') |
|
| 536 | + public function describe_table($table, $schema = '') |
|
| 537 | 537 | { |
| 538 | 538 | |
| 539 | 539 | // Informix no soporta schemas |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | * @param array $fields |
| 583 | 583 | * @return boolean |
| 584 | 584 | */ |
| 585 | - public function insert($table, $values, $fields=null) |
|
| 585 | + public function insert($table, $values, $fields = null) |
|
| 586 | 586 | { |
| 587 | 587 | $this->set_return_rows(false); |
| 588 | 588 | return parent::insert($table, $values, $fields); |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | * @param string $where_condition |
| 598 | 598 | * @return boolean |
| 599 | 599 | */ |
| 600 | - public function update($table, $fields, $values, $where_condition=null) |
|
| 600 | + public function update($table, $fields, $values, $where_condition = null) |
|
| 601 | 601 | { |
| 602 | 602 | $this->set_return_rows(false); |
| 603 | 603 | return parent::update($table, $fields, $values, $where_condition); |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | * |
| 621 | 621 | * @param boolean $value |
| 622 | 622 | */ |
| 623 | - public function set_return_rows($value=true) |
|
| 623 | + public function set_return_rows($value = true) |
|
| 624 | 624 | { |
| 625 | 625 | $this->return_rows = $value; |
| 626 | 626 | } |