Commit a42c7888486aaecd3d22cc098ff99b28e85fa11e

Authored by Edmar Moretti
1 parent 88b15e63

--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,7 +150,7 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){
150 if($tabelaExiste == false && $_POST["tipoOperacao"] == "criar"){ 150 if($tabelaExiste == false && $_POST["tipoOperacao"] == "criar"){
151 $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(the_geom geometry"; 151 $sql = "CREATE TABLE ".$_POST["i3GEOuploadesquema"].".".$_POST["tabelaDestino"]."(the_geom geometry";
152 foreach($colunas as $coluna){ 152 foreach($colunas as $coluna){
153 - $sql .= ",".strtolower($coluna)." ".$tipoColuna[$coluna]; 153 + $sql .= ",".remove_accents(strtolower($coluna))." ".$tipoColuna[$coluna];
154 } 154 }
155 $sql .= ")WITH(OIDS=FALSE)"; 155 $sql .= ")WITH(OIDS=FALSE)";
156 $sqltabela[] = $sql; 156 $sqltabela[] = $sql;
@@ -192,8 +192,9 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){ @@ -192,8 +192,9 @@ if (isset($_FILES['i3GEOuploadshp']['name'])){
192 for ($i=0; $i<$numshapes;$i++){ 192 for ($i=0; $i<$numshapes;$i++){
193 $s = $layer->getShape(new resultObj($i)); 193 $s = $layer->getShape(new resultObj($i));
194 $vs = array(); 194 $vs = array();
195 - $escape = ""; 195 +
196 foreach($colunas as $coluna){ 196 foreach($colunas as $coluna){
  197 + $escape = "";
197 if($tipoColuna[$coluna] == "varchar"){ 198 if($tipoColuna[$coluna] == "varchar"){
198 $texto = $s->getValue($layer,$coluna); 199 $texto = $s->getValue($layer,$coluna);
199 //echo $i." - ".mb_detect_encoding($texto)."<br>"; 200 //echo $i." - ".mb_detect_encoding($texto)."<br>";
@@ -204,10 +205,10 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;])){ @@ -204,10 +205,10 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;])){
204 $escape = "E"; 205 $escape = "E";
205 } 206 }
206 if($enc != "" && $enc != $encodingdb){ 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 else{ 210 else{
210 - $textosl = "'".$textosl."'"; 211 + $textosl = "$escape'".$textosl."'";
211 } 212 }
212 if($textosl == "''"){ 213 if($textosl == "''"){
213 $textosl = 'null'; 214 $textosl = 'null';
@@ -264,7 +265,10 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;])){ @@ -264,7 +265,10 @@ if (isset($_FILES[&#39;i3GEOuploadshp&#39;][&#39;name&#39;])){
264 $linha = remove_accents($linha); 265 $linha = remove_accents($linha);
265 $res = $dbh->query($linha); 266 $res = $dbh->query($linha);
266 if($res == false){ 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 else{ 273 else{
270 echo "<br><br><span style=color:red >Linha com acentos removidos: </span>".$linha; 274 echo "<br><br><span style=color:red >Linha com acentos removidos: </span>".$linha;