本文整理汇总了PHP中dbase_get_record函数的典型用法代码示例。如果您正苦于以下问题:PHP dbase_get_record函数的具体用法?PHP dbase_get_record怎么用?PHP dbase_get_record使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbase_get_record函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prueba
public function prueba()
{
$conex = dbase_open('C:\\mficha.DBF', 0);
//return dbase_get_header_info($conex);
$total_registros = dbase_numrecords($conex);
for ($i = 1; $i <= $total_registros; $i++) {
echo dbase_get_record($conex, $i)[0] . '<br>';
}
}
示例2: volcarDBF
function volcarDBF($db = "ctw10005")
{
$results = array();
$mFile = $db . date("Ymd") . ".txt";
//Abrir el Archivo para Escribir
$TFile = fopen(PATH_TMP . $mFile, "a");
$pathdbase = CTW_PATH . vLITERAL_SEPARATOR . $db . ".dbf";
//$db = dbase_open($ipdbase . $dirdbase . $nombredb . $db, 0);
$rs = dbase_open($pathdbase, 0);
//echo $pathdbase;
$results[SYS_MSG] .= "Abrir {$pathdbase} <br />";
$num_rows = dbase_numrecords($rs);
//$o_num_rows = dbase_numrecords ($rs);
if ($num_rows > 100000) {
//$num_rows = 100000; //Eliminar la Consulta a 50000
}
$results[SYS_MSG] .= "Numero de Filas {$num_rows} <br />";
if (isset($rs)) {
$results[SYS_MSG] .= "Cerrando " . dbase_get_header_info($rs) . " <br />";
for ($i = 1; $i <= $num_rows; $i++) {
//$field = dbase_get_record_with_names($rs, $i);
$field = dbase_get_record($rs, $i);
$lim = sizeof($field);
$strW = "";
for ($a = 0; $a < $lim; $a++) {
if ($a == 0) {
$strW .= trim($field[$a]);
} else {
$strW .= STD_LITERAL_DIVISOR . trim($field[$a]);
}
}
$strW .= "\n";
@fwrite($TFile, $strW);
//if (dbase_delete_record ($rs, $i)) {
// print "Registro $i Marcado para Eliminar de un total de $o_num_rows; se Busco $field[$key]. <br >";
//break; # Exit the loop
//}
}
} else {
//dbase_get_header_info($rs);
}
//dbase_pack($rs);
//$results[SYS_MSG] .= " <br />";
dbase_close($rs);
$results[SYS_MSG] .= "Cerrando {$pathdbase} <br />";
fclose($TFile);
$results[SYS_MSG] .= "Cerrando {$mFile} <br />";
return $results;
}
示例3: convert
public function convert()
{
$delayed_objects = array();
$num_records = dbase_numrecords($this->_link);
for ($i = 1; $i <= $num_records; $i++) {
$record = dbase_get_record($this->_link, $i);
if ('skip_record' === ($obj = $this->_parseRecord($record))) {
continue;
}
if ('delay_object' === $this->_insertObject($obj)) {
$delayed_objects[] = $obj;
}
}
foreach ($delayed_objects as $obj) {
$this->_insertObject($obj, true);
}
//var_export($this->_region_abbrs);
//var_export($this->_local_abbrs);
return $this;
}
示例4: fetchInto
/**
* Places a row from the result set into the given array
*
* Formating of the array and the data therein are configurable.
* See DB_result::fetchInto() for more information.
*
* This method is not meant to be called directly. Use
* DB_result::fetchInto() instead. It can't be declared "protected"
* because DB_result is a separate object.
*
* @param resource $result the query result resource
* @param array $arr the referenced array to put the data in
* @param int $fetchmode how the resulting array should be indexed
* @param int $rownum the row number to fetch (0 = first row)
*
* @return mixed DB_OK on success, NULL when the end of a result set is
* reached or on failure
*
* @see DB_result::fetchInto()
*/
function fetchInto($result, &$arr, $fetchmode, $rownum = null)
{
if ($rownum === null) {
$rownum = $this->res_row[(int) $result]++;
}
if ($fetchmode & DB_FETCHMODE_ASSOC) {
$arr = @dbase_get_record_with_names($this->connection, $rownum);
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE && $arr) {
$arr = array_change_key_case($arr, CASE_LOWER);
}
} else {
$arr = @dbase_get_record($this->connection, $rownum);
}
if (!$arr) {
return null;
}
if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
$this->_rtrimArrayValues($arr);
}
if ($this->options['portability'] & DB_PORTABILITY_NULL_TO_EMPTY) {
$this->_convertNullArrayValuesToEmpty($arr);
}
return DB_OK;
}
示例5: fetchInto
function fetchInto($res, &$row, $fetchmode, $rownum = null)
{
if ($rownum === null) {
$rownum = $this->res_row[$res]++;
}
if ($fetchmode & DB_FETCHMODE_ASSOC) {
$row = @dbase_get_record_with_names($this->connection, $rownum);
} else {
$row = @dbase_get_record($this->connection, $rownum);
}
if (!$row) {
return null;
}
return DB_OK;
}
示例6: buscar
public function buscar($id)
{
return dbase_get_record($this->conexao, $id);
}
示例7: end
<?php
$db = false;
if (!empty($argc)) {
$file = end($argv);
$db = dbase_open($file, 0);
}
if ($db) {
$iconvFrom = '866';
$iconvTo = 'UTF-8';
$delimetr = ',';
$info = dbase_get_header_info($db);
$fields = dbase_numfields($db);
$fieldsCount = sizeof($fields);
$records = dbase_numrecords($db);
//for ($i = 1; $i <= 10; $i++) { # test
for ($i = 1; $i <= $records; $i++) {
$row = dbase_get_record($db, $i);
$line = array();
for ($j = 0; $j < $fields; $j++) {
$line[] = addslashes(iconv($iconvFrom, $iconvTo, trim($row[$j])));
}
echo implode($delimetr, $line);
echo PHP_EOL;
}
dbase_close($db);
}
示例8: affiche_debug
if ($en_tete[$i] == $tabchamps[$k]) {
$tabindice[] = $i;
}
}
}
affiche_debug("<table border=\"1\">\n");
affiche_debug("<tr><td>Num.</td><td>ABSTYPE</td><td>ELENOET</td><td>ABSDATD</td><td>ABSDATF</td><td>ABSSEQD</td><td>ABSSEQF</td><td>ABSHEUR</td><td>ABSJUST</td><td>ABSMOTI</td><td>ABSACTI</td></tr>\n");
//=========================
// AJOUT: boireaus 20071202
$previous_eleve = "";
//=========================
$nb_reg_no = 0;
$nb_record = 0;
for ($k = 1; $k < $nblignes + 1; $k++) {
// echo "<tr><td>$k</td>\n";
$ligne = dbase_get_record($fp, $k);
for ($i = 0; $i < count($tabchamps); $i++) {
$affiche[$i] = dbase_filter(trim($ligne[$tabindice[$i]]));
}
// premier tri sur les dates
if ($affiche[2] >= $datedebut and $affiche[3] <= $datefin) {
if ($temp = array_search($affiche[1], $tab)) {
affiche_debug("<tr>\n");
affiche_debug("<td>{$k}</td>\n");
for ($loop = 0; $loop < count($affiche); $loop++) {
affiche_debug("<td>{$affiche[$loop]}</td>\n");
}
affiche_debug("</tr>\n");
// Pour que les erreurs s'affichent au bon niveau:
affiche_debug("<tr>\n");
affiche_debug("<td colspan='11'>\n");
示例9: fetch_array
function fetch_array($query, $arraytype = CDE_NUM)
{
$this->error = "";
//Set the errors to none
if ($this->debug) {
$this->debugmsg("Fetching array on " . $this->dbtype . " database....", "blue");
$this->debugmsg($query, "purple");
}
switch ($this->dbtype) {
/* Firebird Functionality */
case "firebird":
if ($arraytype == 0) {
$query = ibase_fetch_assoc($query);
} else {
if ($arraytype == 1) {
$query = ibase_fetch_row($query);
} else {
$query1 = ibase_fetch_assoc($query);
$query2 = ibase_fetch_row($query);
$query = array_merge($query1, $query2);
}
}
break;
/* SQLite Functionality */
/* SQLite Functionality */
case "sqlite":
$query = sqlite_fetch_array($query, $arraytype);
break;
/*DBASE - this uses the record counter - currentrecord */
/*DBASE - this uses the record counter - currentrecord */
case "dbase":
if ($this->currentrecord <= $this->num_rows($none)) {
$query = dbase_get_record($this->dbh, $this->currentrecord);
$this->currentrecord++;
} else {
$query = false;
}
if ($query) {
foreach ($query as $name => $value) {
$value = str_replace("'", "''", $value);
$query[$name] = trim($value);
}
}
break;
/* MYSQL Functionality */
/* MYSQL Functionality */
case "mysql":
if ($arraytype == "CDE_NUM") {
$myarr = MYSQL_NUM;
} elseif ($arraytype == "CDE_ASSOC") {
$myarr = MYSQL_ASSOC;
} else {
$myarr = MYSQL_BOTH;
}
$query = mysql_fetch_array($query, $myarr);
break;
/* Oracle Functionality */
/* Oracle Functionality */
case "oracle":
$query = oci_fetch_array($query, $arraytype);
break;
/* MSSQL Functionality */
/* MSSQL Functionality */
case "mssql":
$query = mssql_fetch_array($query, $arraytype);
break;
case "pgsql":
$query = pg_fetch_array($query, $arraytype);
break;
}
if ($this->debug) {
$this->debugmsg("Fetched array on " . $this->dbtype . " database....", "green");
$this->debugmsg($this->pre_r($query), "purple");
}
return $query;
}
示例10: get_row
public function get_row($recnum)
{
return dbase_get_record($this->_handler, $recnum);
}
示例11: print_r
echo 'row before inserting is: ';
print_r($row);
// Replace the record
dbase_replace_record($db, $row, 1);
echo 'trying record num 1: ';
$rec = dbase_get_record($db, 1);
$nf = dbase_numfields($db);
for ($i = 0; $i < $nf; $i++) {
echo $rec[$i], "\n";
}
echo 'deleting row 2. before deletion: ';
$rec = dbase_get_record($db, 2);
$nf = dbase_numfields($db);
for ($i = 0; $i < $nf; $i++) {
echo $rec[$i], "\n";
}
echo dbase_delete_record($db, 2);
echo 'before db pack';
echo dbase_pack($db);
echo 'after pack, trying to fetch record 2';
$rec = dbase_get_record($db, 2);
$nf = dbase_numfields($db);
for ($i = 0; $i < $nf; $i++) {
echo $rec[$i], "\n";
}
dbase_close($db);
}
?>
示例12: ProcessDBF
function ProcessDBF($AName)
{
$vResult = 0;
$vHandle = dbase_open($AName, 0);
if ($vHandle === FALSE) {
throw new Exception('Невозможно открыть файл базы данных');
}
try {
$vFieldList = GetFieldList($vHandle);
$vSurgeryIDIdx = FindFieldIdx($vFieldList, 'MYSURGERYID', false);
$vCaseIDIdx = FindFieldIdx($vFieldList, 'MYCASEID');
$vDateIdx = FindFieldIdx($vFieldList, 'DATEIN');
$vSendIdx = FindFieldIdx($vFieldList, 'SEND');
$vErrorIdx = FindFieldIdx($vFieldList, 'ERROR');
$vCnt = dbase_numrecords($vHandle);
for ($i = 1; $i <= $vCnt; $i++) {
$vRecord = dbase_get_record($vHandle, $i);
ProcessDBFRecord(trim(@$vRecord[$vSurgeryIDIdx]), trim(@$vRecord[$vCaseIDIdx]), DBF2Date(trim(@$vRecord[$vDateIdx])), trim(@$vRecord[$vSendIdx]), iconv('CP866', 'UTF-8', trim(@$vRecord[$vErrorIdx])));
$vResult++;
}
} catch (Exception $e) {
dbase_close($vHandle);
throw $e;
}
dbase_close($vHandle);
return $vResult;
}
示例13: ImportSaldosCW
function ImportSaldosCW()
{
//Elimina los Datos de la DB del Catalogo
$sqlDelC = "DELETE FROM contable_saldos";
my_query($sqlDelC);
$rechazados = 0;
$aceptados = 0;
/**
* Genera le Nuevo esquema de Naturaleza Contable
*/
$pathdbase = CTW_PATH . vLITERAL_SEPARATOR . "CTW10005.dbf";
$rs = dbase_open($pathdbase, 0);
$results[SYS_MSG] .= "Abrir {$pathdbase} <br />";
$num_rows = dbase_numrecords($rs);
if ($num_rows > 100000) {
//$num_rows = 1000000;
}
$results[SYS_MSG] .= "Numero de Filas {$num_rows} <br />";
//Conversion del Tipo de Movimientos
if (isset($rs)) {
for ($i = 1; $i <= $num_rows; $i++) {
$field = dbase_get_record($rs, $i);
if (trim($field[0]) != "" and trim($field[0]) != 0) {
$cuenta = trim($field[0]);
if ($cuenta == "_CUADRE") {
$cuenta = CUENTA_DE_CUADRE;
}
$sql = "INSERT INTO contable_saldos(cuenta, \n \t\t\t\tejercicio, tipo, saldo_inicial, imp1, imp2, imp3, imp4, imp5, imp6, imp7, imp8, imp9, imp10, imp11, imp12, imp13, imp14, captado) \n \t\t\t\t\t\t\t\t\t\t\t\t\tVALUES({$cuenta}, \n \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[1]) . ", " . trim($field[2]) . ",\n \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[3]) . ", " . trim($field[4]) . ", \n \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[5]) . ", " . trim($field[6]) . ", \n \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[7]) . ", " . trim($field[8]) . ",\n \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[9]) . ", " . trim($field[10]) . ", \n \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[11]) . ", " . trim($field[12]) . ", \n \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[13]) . ", " . trim($field[14]) . ", \n \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[15]) . ", " . trim($field[16]) . ", \n \t\t\t\t\t\t\t\t\t\t\t\t\t" . trim($field[17]) . ", '" . trim($field[18]) . "')";
my_query($sql);
$aceptados++;
} else {
$rechazados++;
}
}
} else {
$results[SYS_MSG] .= "No se Pudo Abrir la DB";
}
dbase_close($rs);
$results[SYS_MSG] .= "{$aceptados} Registros fueron Agregados a la Base de Datos <br />";
$results[SYS_MSG] .= "{$rechazados} Registros fueron rechazados por no Contener Valores Validos <br />";
$results[SYS_MSG] .= "Cerrando {$pathdbase} <br />";
return $results;
}
示例14: gravaDbf
private function gravaDbf($importacaoID)
{
$this->load->model('tbhandle/Handle_model', 'handle');
$dados = $this->import->get_by_id($importacaoID);
$arquivo = 'C:/xampp/htdocs/new_s4w/arquivos/' . $dados->locatarioID . "/" . $dados->clienteID . "/" . $dados->obraID . "/" . $dados->etapaID . "/" . $dados->subetapaID . "/" . $dados->importacaoNr . "/" . $dados->arquivo;
$dbcon = dbase_open($arquivo, 0) or die("Não foi possível abrir o arquivo dbf");
$n = 0;
$dbrows = dbase_numrecords($dbcon);
for ($c = 1; $c <= $dbrows; $c++) {
$dbreg = dbase_get_record($dbcon, $c);
// pega o contéudo da linha (registro)
$attibutes[$c] = array('PROJETO' => 1, 'HANDLE' => 'NÃO SEI', 'FLG_REC' => $dbreg[0], 'NUM_COM' => $dbreg[1], 'DES_COM' => $dbreg[2], 'LOT_COM' => $dbreg[3], 'DLO_COM' => $dbreg[4], 'CLI_COM' => $dbreg[5], 'IND_COM' => $dbreg[6], 'DT1_COM' => $dbreg[7], 'DT2_COM' => $dbreg[8], 'NUM_DIS' => $dbreg[9], 'DES_DIS' => $dbreg[10], 'NOM_DIS' => $dbreg[11], 'REV_DIS' => $dbreg[12], 'DAT_DIS' => $dbreg[13], 'TRA_PEZ' => $dbreg[14], 'SBA_PEZ' => $dbreg[15], 'DES_SBA' => $dbreg[16], 'TIP_PEZ' => $dbreg[17], 'MAR_PEZ' => $dbreg[18], 'MBU_PEZ' => $dbreg[19], 'DES_PEZ' => $dbreg[20], 'POS_PEZ' => $dbreg[21], 'NOT_PEZ' => $dbreg[22], 'ING_PEZ' => $dbreg[23], 'MAX_LEN' => $dbreg[24], 'QTA_PEZ' => $dbreg[25], 'QT1_PEZ' => $dbreg[26], 'MCL_PEZ' => $dbreg[27], 'COD_PEZ' => $dbreg[28], 'COS_PEZ' => $dbreg[29], 'NOM_PRO' => $dbreg[30], 'LUN_PRO' => $dbreg[31], 'LAR_PRO' => $dbreg[32], 'SPE_PRO' => $dbreg[33], 'MAT_PRO' => $dbreg[34], 'TIP_BUL' => $dbreg[35], 'DIA_BUL' => $dbreg[36], 'LUN_BUL' => $dbreg[37], 'PRB_BUL' => $dbreg[38], 'PUN_LIS' => $dbreg[39], 'SUN_LIS' => $dbreg[40], 'PRE_LIS' => $dbreg[41], 'FLG_DWG' => $dbreg[42], 'obra' => $dados->obraID, 'id' => 0, 'fklote' => 0, 'fkestagio' => $dados->subetapaID, 'grp' => $dbreg[46], 'nome_file1' => $dados->arquivo, 'nome_file2' => '', 'nome_file3' => '', 'nome_file4' => '', 'fketapa' => $dados->etapaID, 'CATEPERFIL' => $dbreg[48], 'fkImportacao' => $importacaoID, 'fkpreparacao' => 0, 'fkmedicao' => 0);
}
if ($this->handle->insert($attibutes)) {
return true;
}
return false;
}
示例15: dbase_open
<?php
// Path to dbase file
$db_path = "/tmp/base/shbase.dbf";
// Open dbase file
$dbh = dbase_open($db_path, 0) or die("Error! Could not open dbase database file '{$db_path}'.");
// Get column information
$column_info = dbase_get_header_info($dbh);
// Display information
print_r($column_info);
if ($dbh) {
$record_numbers = dbase_numrecords($dbh);
for ($i = 1; $i <= $record_numbers; $i++) {
$row = dbase_get_record_with_names($dbh, $i);
print_r($row);
$row = dbase_get_record($dbh, $i);
print_r($row);
break;
}
$row = dbase_get_record($dbh, 9);
print_r($row);
}
?>