Commit a42c7888486aaecd3d22cc098ff99b28e85fa11e
1 parent
88b15e63
Exists in
master
and in
7 other branches
--no commit message
Showing
1 changed file
with
9 additions
and
5 deletions
Show diff stats
admin/php/metaestat_uploadshp_submit.php
| ... | ... | @@ -150,7 +150,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 150 | 150 | if($tabelaExiste == false && $_POST["tipoOperacao"] == "criar"){ |
| 151 | 151 | $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(the_geom geometry"; |
| 152 | 152 | foreach($colunas as $coluna){ |
| 153 | - $sql .= ",".strtolower($coluna)." ".$tipoColuna[$coluna]; | |
| 153 | + $sql .= ",".remove_accents(strtolower($coluna))." ".$tipoColuna[$coluna]; | |
| 154 | 154 | } |
| 155 | 155 | $sql .= ")WITH(OIDS=FALSE)"; |
| 156 | 156 | $sqltabela[] = $sql; |
| ... | ... | @@ -192,8 +192,9 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 192 | 192 | for ($i=0; $i<$numshapes;$i++){ |
| 193 | 193 | $s = $layer->getShape(new resultObj($i)); |
| 194 | 194 | $vs = array(); |
| 195 | - $escape = ""; | |
| 195 | + | |
| 196 | 196 | foreach($colunas as $coluna){ |
| 197 | + $escape = ""; | |
| 197 | 198 | if($tipoColuna[$coluna] == "varchar"){ |
| 198 | 199 | $texto = $s->getValue($layer,$coluna); |
| 199 | 200 | //echo $i." - ".mb_detect_encoding($texto)."<br>"; |
| ... | ... | @@ -204,10 +205,10 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 204 | 205 | $escape = "E"; |
| 205 | 206 | } |
| 206 | 207 | if($enc != "" && $enc != $encodingdb){ |
| 207 | - $textosl = "'".mb_convert_encoding($textosl,$encodingdb,$enc)."'"; | |
| 208 | + $textosl = "$escape'".mb_convert_encoding($textosl,$encodingdb,$enc)."'"; | |
| 208 | 209 | } |
| 209 | 210 | else{ |
| 210 | - $textosl = "'".$textosl."'"; | |
| 211 | + $textosl = "$escape'".$textosl."'"; | |
| 211 | 212 | } |
| 212 | 213 | if($textosl == "''"){ |
| 213 | 214 | $textosl = 'null'; |
| ... | ... | @@ -264,7 +265,10 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ |
| 264 | 265 | $linha = remove_accents($linha); |
| 265 | 266 | $res = $dbh->query($linha); |
| 266 | 267 | if($res == false){ |
| 267 | - echo "<br><br><span style=color:red >Erro em: </span>".$linha; | |
| 268 | + $res = pg_query($bdcon,$linha); | |
| 269 | + if($res == false){ | |
| 270 | + echo "<br><br><span style=color:red >Erro em: </span>".$linha; | |
| 271 | + } | |
| 268 | 272 | } |
| 269 | 273 | else{ |
| 270 | 274 | echo "<br><br><span style=color:red >Linha com acentos removidos: </span>".$linha; | ... | ... |