@@ -107,8 +107,7 @@ discard block |
||
| 107 | 107 | if (!is_null($this->config["dbf_list"])) { |
| 108 | 108 | if (is_array($this->config["dbf_list"])) { |
| 109 | 109 | $this->config["dbf_list"] = array_map("strtolower", $this->config["dbf_list"]); |
| 110 | - } |
|
| 111 | - else { |
|
| 110 | + } else { |
|
| 112 | 111 | $this->writeLog("<red>Error in config:<default> dbf list should be array or null"); |
| 113 | 112 | exit; |
| 114 | 113 | } |
@@ -137,8 +136,7 @@ discard block |
||
| 137 | 136 | try { |
| 138 | 137 | $this->db = new PDO("mysql:host=".$this->config["db_host"].";port=".$this->config["db_port"].";dbname=" . $this->config["db_name"], |
| 139 | 138 | $this->config["db_username"], $this->config["db_password"], $db_options); |
| 140 | - } |
|
| 141 | - catch (PDOException $e) { |
|
| 139 | + } catch (PDOException $e) { |
|
| 142 | 140 | $this->writeLog("<red>Error in MySQL connection:<default> ".$e->getMessage()); |
| 143 | 141 | exit; |
| 144 | 142 | } |
@@ -188,8 +186,7 @@ discard block |
||
| 188 | 186 | case "0": |
| 189 | 187 | if ($column["decimal"]) { |
| 190 | 188 | $line[] = $name." decimal(".($column["length"] + $column["decimal"]).", ".$column["decimal"].") NULL DEFAULT 0"; |
| 191 | - } |
|
| 192 | - else { |
|
| 189 | + } else { |
|
| 193 | 190 | $line[] = $name." bigint(".$column["length"].") NULL DEFAULT 0"; |
| 194 | 191 | } |
| 195 | 192 | break; |
@@ -225,8 +222,7 @@ discard block |
||
| 225 | 222 | COMMENT='Converted DBF file: ".$this->dbfHeaders["table"].".dbf'"); |
| 226 | 223 | if ($result !== false) { |
| 227 | 224 | $this->writeLog("Table <yellow>".$this->dbfHeaders["table"]."<default> successfully created"); |
| 228 | - } |
|
| 229 | - else { |
|
| 225 | + } else { |
|
| 230 | 226 | $this->writeLog("<red>Error in MySQL:<default> ".print_r($this->db->errorInfo(), true)); |
| 231 | 227 | } |
| 232 | 228 | } |
@@ -264,13 +260,11 @@ discard block |
||
| 264 | 260 | $deleted = false; |
| 265 | 261 | if ($this->config["deleted_records"]) { |
| 266 | 262 | $result->execute($record); |
| 267 | - } |
|
| 268 | - else { |
|
| 263 | + } else { |
|
| 269 | 264 | if (!$record["deleted"]) { |
| 270 | 265 | unset($record["deleted"]); |
| 271 | 266 | $result->execute($record); |
| 272 | - } |
|
| 273 | - else { |
|
| 267 | + } else { |
|
| 274 | 268 | $deleted = true; |
| 275 | 269 | } |
| 276 | 270 | } |
@@ -330,8 +324,7 @@ discard block |
||
| 330 | 324 | $type = "tinyint"; |
| 331 | 325 | } |
| 332 | 326 | } |
| 333 | - } |
|
| 334 | - else { |
|
| 327 | + } else { |
|
| 335 | 328 | if (!$column["decimal"]) { |
| 336 | 329 | $type = "bigint"; |
| 337 | 330 | if ($result["min"] >= -128 && $result["max"] <= 127) { |
@@ -348,8 +341,7 @@ discard block |
||
| 348 | 341 | if ($column["decimal"] && $unsigned) { |
| 349 | 342 | $lines[] = "CHANGE `".$column["name"]."` `".$column["name"]."` decimal(".($column["length"] + $column["decimal"]).", ".$column["decimal"].") UNSIGNED |
| 350 | 343 | NULL DEFAULT '0'"; |
| 351 | - } |
|
| 352 | - else { |
|
| 344 | + } else { |
|
| 353 | 345 | $lines[] = "CHANGE `".$column["name"]."` `".$column["name"]."` ".$type."(".$column["length"].")".($unsigned ? " UNSIGNED" : "")." |
| 354 | 346 | NULL DEFAULT '0'"; |
| 355 | 347 | } |