本文整理汇总了PHP中dbase_close函数的典型用法代码示例。如果您正苦于以下问题:PHP dbase_close函数的具体用法?PHP dbase_close怎么用?PHP dbase_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbase_close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* Обновляет справочник банков, используя указанный файл или файл из папки data.
*
* Необходимо расширение dbase. Установить расширение dbase можно так: sudo pecl install dbase
*
* @param null $file
* @return int
*/
public function actionIndex($file = null)
{
if (!extension_loaded('dbase')) {
$this->stdout("Для работы скрипта обновления необходимо установить расширение dbase\n", Console::FG_RED);
return 1;
}
if ($file === null) {
$file = Yii::getAlias(dirname(__FILE__) . '/../data/bnkseek.dbf');
} else {
$file = Yii::getAlias($file);
}
if (!file_exists($file)) {
$this->stdout("Файл {$file} не найден!\n", Console::FG_RED);
return 1;
}
if ($this->confirm("Обновить справочник банков России, используя файл {$file}?")) {
$this->stdout('Выполняю обновление...' . "\n");
$db = dbase_open($file, 0);
if (!$db) {
$this->stdout("Не удалось открыть файл как базу данный dbase!\n", Console::FG_RED);
return 1;
}
$current_db_records_count = Bank::find()->count();
$data_records_count = dbase_numrecords($db);
$data_updated = false;
$this->stdout("Количество банков в текущем справочнике - {$current_db_records_count}.\n");
$this->stdout("Количество банков в файле - {$data_records_count}.\n");
for ($i = 1; $i <= $data_records_count; $i++) {
$rec = dbase_get_record_with_names($db, $i);
/** @var Bank $model */
$model = Yii::createObject(['class' => Bank::className(), 'bik' => $rec["NEWNUM"], 'okpo' => $rec["OKPO"], 'full_name' => iconv('CP866', 'utf-8', $rec["NAMEP"]), 'short_name' => iconv('CP866', 'utf-8', $rec["NAMEN"]), 'ks' => $rec["KSNP"], 'city' => iconv('CP866', 'utf-8', $rec["NNP"]), 'zip' => (int) $rec["IND"], 'address' => iconv('CP866', 'utf-8', $rec["ADR"]), 'tel' => iconv('CP866', 'utf-8', $rec["TELEF"])]);
foreach ($model->getAttributes() as $key => $value) {
$model->{$key} = trim($value);
}
/** @var Bank $exist */
$exist = Bank::findOne($model->bik);
if (!$exist) {
$this->stdout("Добавлен новый банк: {$model->bik} {$model->short_name}\n");
$data_updated = true;
$model->save(false);
} else {
if ($exist->getAttributes() != $model->getAttributes()) {
$exist->setAttributes($model->getAttributes());
$this->stdout("Обновлены данные банка: {$exist->bik} {$exist->short_name}\n");
$data_updated = true;
$exist->save(false);
}
}
}
dbase_close($db);
if ($data_updated) {
$this->stdout('Справочник банков успешно обновлен!' . "\n", Console::FG_GREEN);
} else {
$this->stdout('В справочник банков не было внесено изменений.' . "\n", Console::FG_GREEN);
}
}
return 0;
}
示例2: __destruct
public function __destruct()
{
if ($this->shp) {
fclose($this->shp);
}
if ($this->dbf) {
dbase_close($this->dbf);
}
}
示例3: subedbff
function subedbff($file = 'TRABAJAD.DBF')
{
//nota:hay que modificar el upload_max_file_size=100M del php.ini
//nota:cambiar el tamanano de pres.nacinal a 15 caracteres
//nota:cambiar tamano de carg.descrip a tamano de 100
set_time_limit(3600);
$this->load->dbforge();
$this->load->dbutil();
$filea = explode('.', $file);
$name = $filea[0];
$ext = $filea[1];
$uploadsdir = getcwd() . '/uploads/';
$filedir = $uploadsdir . $file;
$tabla = strtoupper($ext . $name);
if (extension_loaded('dbase')) {
$db = dbase_open($filedir, 0);
$this->dbforge->drop_table($tabla);
if ($db) {
$cols = dbase_numfields($db);
$rows = dbase_numrecords($db);
$row = dbase_get_record_with_names($db, 10);
foreach ($row as $key => $value) {
$fields[trim($key)] = array('type' => 'TEXT');
}
//print_r($fields);
//exit();
$this->dbforge->add_field($fields);
$this->dbforge->create_table($tabla);
$insert = array();
for ($i = 0; $i <= $rows; $i++) {
$r = dbase_get_record_with_names($db, $i);
foreach ($row as $key => $value) {
$a = utf8_encode(trim($r[trim($key)]));
$insert[trim($key)] = $a;
}
$this->db->insert($tabla, $insert);
}
echo $i;
dbase_close($db);
} else {
echo "No pudo abrir el archivo";
}
} else {
echo 'Debe cargar las librerias dbase para poder usar este modulo';
}
}
示例4: mspti
function mspti()
{
$this->layout = 'ajax';
$this->autoRender = FALSE;
// database "definition"
$def = array(array("KDYYSMSPTI", "C", 7), array("KDPTIMSPTI", "C", 6), array("NMPTIMSPTI", "C", 50), array("ALMT1MSPTI", "C", 30), array("ALMT2MSPTI", "C", 30), array("KOTAAMSPTI", "C", 20), array("KDPOSMSPTI", "C", 5), array("TELPOMSPTI", "C", 20), array("FAKSIMSPTI", "C", 20), array("TGPTIMSPTI", "D"), array("NOMSKMSPTI", "C", 30), array("EMAILMSPTI", "C", 40), array("HPAGEMSPTI", "C", 40), array("TGAWLMSPTI", "D"));
$epsbed_file = EPSBED_DIR . 'MSPTI.dbf';
if (!dbase_create($epsbed_file, $def)) {
echo "Error, can't create the database\n";
exit;
} else {
$db = dbase_open($epsbed_file, 2);
if ($db) {
$this->loadModel('Configuration');
$yys = $this->Configuration->getPTI();
$yys['YYS_KODE'] = '';
dbase_add_record($db, array($yys['YYS_KODE'], $yys['PTI_KODE'], $yys['PTI_NAMA'], $yys['PTI_ALAMAT_1'], $yys['PTI_ALAMAT_2'], $yys['PTI_KOTA'], $yys['PTI_KODE_POS'], $yys['PTI_TELEPON'], $yys['PTI_FAX'], str_replace('-', '/', $yys['PTI_TANGGAL_SK']), $yys['PTI_NOMOR_SK'], $yys['PTI_EMAIL'], $yys['PTI_WEBSITE'], str_replace('-', '/', $yys['PTI_TANGGAL_BERDIRI'])));
echo "<a href='files/epsbed/MSPTI.dbf'>Download file MSPTI.dbf</a>";
dbase_close($db);
}
}
}
示例5: substr
default:
if ($this->session->userdata('institucion') != 'A') {
$where = " a where ano = " . $anio . " and substr(e_salud,7,1) = '" . $this->session->userdata('institucion') . "'";
} else {
$where = " a where ano = " . $anio;
}
break;
}
$row = $this->frontend_model->exportarCobertura($param1, $where, $puntero, $limite);
foreach ($row as $data) {
dbase_add_record($dbh, array($data->ANO, $data->SEMANA, '0', $data->COD_EST, $data->EST_NOT, $data->REGION, $data->RED, '', $data->MICRORED, $data->SITUACION, $data->FGENERA, $data->HORANOT));
$contador = $contador + 1;
}
break;
}
dbase_close($dbh);
if ($puntero >= $maximo) {
//Actualizando el registro de auditoria
$this->mantenimiento_model->auditoriaOperador($this->session->userdata('usuario'), 'Descarga de ' . $namet . '_sp.dbf');
/// descarga del dbf generado
$filename = $ruta_db;
if (file_exists($filename)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
if ($namet != "cobertura") {
header('Content-Disposition: attachment; filename=' . $namet . '_sp.dbf');
} else {
header('Content-Disposition: attachment; filename=' . $namet . '.dbf');
}
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
示例6: dbase_open
dbase_close($db16);
} //if db
}else{
$db16 = dbase_open($dbname16, 2);
if ($db16) {
dbase_add_record($db16, array(
$hcode16,
$hn16,
$an16,
$newclinic,
$personid,
$newdateserv,
$drugcode16, // drugcode
$drugname16,
$amount16,
$saleprice,
$unitprice,
$code24,
$unit,
$packing,
$newseq,
$reasondefault,
$pano));
dbase_close($db16);
} //if db
} // if $reason
} // while
//---------------End Dataset16---------------//
} // if check box �Դ�ش����
?>
示例7: __destruct
public function __destruct()
{
dbase_close($this->db);
}
示例8: subedbf
function subedbf($file = 'DATONO02.DBF', $insertar = true)
{
set_time_limit(3600);
$this->load->dbforge();
$this->load->dbutil();
$filea = explode('.', $file);
$name = $filea[0];
$ext = $filea[1];
$uploadsdir = getcwd() . '/uploads/';
$filedir = $uploadsdir . $file;
$tabla = strtoupper($ext . $name);
if (extension_loaded('dbase')) {
$db = @dbase_open($filedir, 0);
$this->dbforge->drop_table($tabla);
if ($db) {
$cols = @dbase_numfields($db);
$rows = @dbase_numrecords($db);
$row = @dbase_get_record_with_names($db, 10);
print_r($row);
count($row);
if (is_array($row) > 0) {
foreach ($row as $key => $value) {
$fields[trim($key)] = array('type' => 'TEXT');
}
//print_r($fields);
//exit();
@$this->dbforge->add_field($fields);
@$this->dbforge->create_table($tabla);
if ($insertar) {
$insert = array();
for ($i = 0; $i <= $rows; $i++) {
$r = @dbase_get_record_with_names($db, $i);
foreach ($row as $key => $value) {
$a = @utf8_encode(trim($r[trim($key)]));
$insert[trim($key)] = $a;
}
@$this->db->insert($tabla, $insert);
echo 1;
}
}
@dbase_close($db);
}
} else {
echo "No pudo abrir el archivo";
}
} else {
echo 'Debe cargar las librerias dbase para poder usar este modulo';
}
}
示例9: dbase_open
$newtimedsc = $newtimedc[0].$newtimedc[1]; // TIMEDSC �����ù�����Ң�����
$dischs=$rows7["dcstatus"]; // DISCHS �����ù�����Ң�����
$discht=substr($rows7["dctype"],0,1); // DISCHT �����ù�����Ң�����
$warddsc=substr($rows7["bedcode"],0,2); // WARDDSC �����ù�����Ң�����
$adm_w=$rows7["adm_w"]; // ADM_W �����ù�����Ң�����
$ucc7="1"; // UCC �����ù�����Ң�����
$db7 = dbase_open($dbname7, 2);
if ($db7) {
dbase_add_record($db7, array(
$hn7,
$an7,
$newdateadm,
$newtimeadm,
$newdatedsc,
$newtimedsc,
$dischs,
$discht,
$warddsc,
$dept,
$adm_w,
$ucc7));
dbase_close($db7);
} //if db
} //while
//--------------------End DataSet7-------------------------//
} // if check box �Դ�ش����
?>
示例10: ms_newShapeFileObj
if (!is_file("/var/webtmp/{$filePre}.zip")) {
$shpFname = "/var/webtmp/{$filePre}";
@unlink($shpFname . ".shp");
@unlink($shpFname . ".shx");
@unlink($shpFname . ".dbf");
@unlink($shpFname . ".zip");
$shpFile = ms_newShapeFileObj($shpFname, MS_SHP_POINT);
$dbfFile = dbase_create($shpFname . ".dbf", array(array("ID", "C", 6), array("NAME", "C", 50), array("NETWORK", "C", 20), array("BEGINTS", "C", 16)));
for ($i = 0; $row = @pg_fetch_array($result, $i); $i++) {
$pt = ms_newPointobj();
$pt->setXY($row["longitude"], $row["latitude"], 0);
$shpFile->addPoint($pt);
dbase_add_record($dbfFile, array($row["id"], $row["name"], $row["network"], substr($row["archive_begin"], 0, 16)));
}
unset($shpFile);
dbase_close($dbfFile);
chdir("/var/webtmp/");
copy("/mesonet/www/apps/iemwebsite/data/gis/meta/4326.prj", $filePre . ".prj");
popen("zip " . $filePre . ".zip " . $filePre . ".shp " . $filePre . ".shx " . $filePre . ".dbf " . $filePre . ".prj", 'r');
}
$table .= "Shapefile Generation Complete.<br>";
$table .= "Please download this <a href=\"/tmp/" . $filePre . ".zip\">zipfile</a>.";
chdir("/mesonet/www/apps/iemwebsite/htdocs/sites/");
} else {
if ($format == "awips") {
if (!$nohtml) {
$table .= "<pre>\n";
}
for ($i = 0; $row = @pg_fetch_array($result, $i); $i++) {
$table .= sprintf("%s|%s|%-30s|%4.1f|%2.5f|%3.5f|GMT|||1||||\n", $row["id"], $row["id"], $row["name"], $row["elevation"], $row["latitude"], $row["longitude"]);
}
示例11: xbase_numfields
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 />";
echo "inTransaction: " . ($table->inTransaction ? "yes" : "no") . "<br />";
echo "encrypted: " . ($table->encrypted ? "yes" : "no") . "<br />";
echo "mdxFlag: " . ord($table->mdxFlag) . "<br />";
echo "languageCode: " . ord($table->languageCode) . "<br />";
示例12: DBFClose
function DBFClose()
{
return dbase_close($this->DBFCon);
}
示例13: mysql_query
mysql_query("delete from d_item where ThAng='{$ta}' and kdsatker='{$kdsatkerunit}' ");
$i = 0;
$no == 0;
while ($i <= $jml) {
$vdata = dbase_get_record_with_names($data, $i);
$thang = $vdata["THANG"];
$kdsatker = $vdata["KDSATKER"];
$jumlah = $vdata['JUMLAH'];
if ($kdsatker == $kdsatkerunit and $thang == $ta) {
echo 'kode satker sesuia';
$no == $no + 1;
mysql_query("insert into d_item(ThAng,kdsatker,jumlah)\r\n values('{$ta}','{$kdsatker}','{$jumlah}')");
}
$i++;
}
dbase_close($data);
$datadipa = mysql_query("select * from d_item where ThAng='{$ta}' and kdsatker='{$kodesatker}'");
$jumlahdata = mysql_num_rows($datadipa);
if ($jumlahdata = 0) {
}
} else {
// header("location:../setup/logup2.php");
}
// header("location:Upload_Dipa.php");
}
if ($_REQUEST['batal']) {
header("location:Upload_Dipa.php");
}
?>
<LINK href="../css/style.css" type=text/css rel=stylesheet>
示例14: writeDbf
function writeDbf($dbfFileName, $dbfFieldList, $valueList)
{
$defList = array();
foreach ($dbfFieldList as $name => $def) {
$defList[] = array_merge(array(substr($name, 0, 10)), $def);
}
pm_logDebug(3, $defList, 'defList');
$dbfFile = dbase_create($dbfFileName, $defList);
//array(array('PROG_ID', 'N', 5, 0)));
foreach ($valueList as $row) {
pm_logDebug(3, $row, 'row');
dbase_add_record($dbfFile, $row);
}
dbase_close($dbfFile);
}
示例15: 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);
}