for ($i = 0; $i < dbase_numrecords($di); $i++) { echo "<tr>"; $r = dbase_get_record_with_names($di, $i + 1); foreach ($r as $c => $v) { echo "<td> {$c}={$v} </td>"; } echo "</tr>"; } echo "</table>"; echo "<br>"; echo "xbase<br>"; echo "index = {$xi} <br>"; echo "column count = " . xbase_numfields($xi) . " <br>"; echo "record count = " . xbase_numrecords($xi) . " <br>"; echo "<table>"; for ($i = 0; $i < xbase_numrecords($xi); $i++) { echo "<tr>"; $r = xbase_get_record_with_names($xi, $i + 1); foreach ($r as $c => $v) { echo "<td> {$c}={$v} </td>"; } echo "</tr>"; } echo "</table>"; dbase_close($di); xbase_close($xi); echo "<br><br>"; $table =& new XBaseTable("test/dbase.dbf"); $table->open(); echo "name: " . $table->name . "<br />"; echo "version: " . $table->version . "<br />";
function dbase_numrecords($dbase_identifier) { return xbase_numrecords($dbase_identifier); }
if (!file_exists($nomeshp)) { echo "<p class='paragrafo'>Erro ao criar arquivo shapefile</p>"; paraAguarde(); } $shapefileObj = ms_newShapefileObj($nomeshp, -2); if ($i3GEOuploaddbftipoarquivo != "dbf") { foreach ($csv->data as $d) { $poPoint = ms_newpointobj(); $poPoint->setXY($d[$i3GEOuploaddbfnomex], $d[$i3GEOuploaddbfnomey]); $shapefileObj->addpoint($poPoint); } } else { require_once dirname(__FILE__) . "/../../pacotes/phpxbase/api_conversion.php"; echo "<p class='paragrafo'>Lendo arquivo </p>"; $dbf = xbase_open($dirmap . "/" . $nome . ".dbf"); $records = xbase_numrecords($dbf); echo "<p class='paragrafo'>Numero de pontos: {$records}</p>"; ob_flush(); flush(); sleep(1); $record = array(); for ($x = 1; $x <= $records; $x++) { $record = xbase_get_record_with_names($dbf, $x); $poPoint = ms_newpointobj(); $poPoint->setXY($record[$nomex], $record[$nomey]); $shapefileObj->addpoint($poPoint); } } $shapefileObj->free(); $novolayer = ms_newLayerObj($mapa); $novolayer->set("data", $nomeshp);
function verificaDBF($arq) { if (function_exists("dbase_open")) { $db = dbase_open($arq, 0); } else { include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php"; $db = xbase_open($arq, 0); } //nas versões novas do PHP open retorna vazio, não dá pra verificar //if ($db) { if (function_exists("dbase_numrecords")) { $record_numbers = dbase_numrecords($db); dbase_close($db); } else { $record_numbers = xbase_numrecords($db); xbase_close($db); } if ($record_numbers > 0) { return true; } else { return false; } //} //else {return false;} }
echo "dbase<br>"; echo "index = $di <br>"; echo "column count = ".dbase_numfields($di)." <br>"; echo "record count = ".dbase_numrecords($di)." <br>"; echo "<table>"; for ($i=0;$i<dbase_numrecords($di);$i++) { echo "<tr>"; $r = dbase_get_record_with_names($di,$i+1); foreach ($r as $c=>$v) { echo "<td> $c=$v </td>"; } echo "</tr>"; } echo "</table>"; echo "<br>"; echo "xbase<br>"; echo "index = $xi <br>"; echo "column count = ".xbase_numfields($xi)." <br>"; echo "record count = ".xbase_numrecords($xi)." <br>"; echo "<table>"; for ($i=0;$i<xbase_numrecords($xi);$i++) { echo "<tr>"; $r = xbase_get_record_with_names($xi,$i+1); foreach ($r as $c=>$v) { echo "<td> $c=$v </td>"; } echo "</tr>"; } echo "</table>"; dbase_close($di); xbase_close($xi); echo "<br><br>"; $table =& new XBaseTable("test/dbase.dbf"); $table->open(); echo "name: ".$table->name."<br />"; echo "version: ".$table->version."<br />"; echo "foxpro: ".($table->foxpro?"yes":"no")."<br />"; echo "modifyDate: ".date("r",$table->modifyDate)."<br />"; echo "recordCount: ".$table->recordCount."<br />"; echo "headerLength: ".$table->headerLength."<br />"; echo "recordByteLength: ".$table->recordByteLength."<br />";