当前位置: 首页>>代码示例>>PHP>>正文


PHP dbase_get_record_with_names函数代码示例

本文整理汇总了PHP中dbase_get_record_with_names函数的典型用法代码示例。如果您正苦于以下问题:PHP dbase_get_record_with_names函数的具体用法?PHP dbase_get_record_with_names怎么用?PHP dbase_get_record_with_names使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dbase_get_record_with_names函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importar_ctw

function importar_ctw($db = "ctw10005.dbf", $id = "2007")
{
    //elimina la anterior
    mysql_unbuffered_query("TRUNCATE compacw_importados");
    $pathdbase = CTW_PATH . "/" . $db;
    //$db = dbase_open($ipdbase . $dirdbase . $nombredb . $db, 0);
    $rs = dbase_open($pathdbase, 2);
    //echo $pathdbase;
    $num_rows = dbase_numrecords($rs);
    //$o_num_rows = dbase_numrecords ($rs);
    //$num_rows = 100000;				//Eliminar la Consulta a 50000
    for ($i = 1; $i <= $num_rows; $i++) {
        $field = dbase_get_record_with_names($rs, $i);
        if (trim($field["EJE"]) == $id and trim($field["TIPO"]) == 1) {
            //
            $values_sql = " ('" . $field["CUENTA"] . "', " . $field["IMP1"] . ") ";
            $sql_ex = "INSERT INTO compacw_importados(cuenta, saldo) VALUES " . $values_sql;
            mysql_unbuffered_query($sql_ex);
            //
        }
    }
    //
    //dbase_pack($rs);
    dbase_close($rs);
    echo "<p>DATOS IMPORTADOS:  " . date("H:i:s") . " HRS </p>";
}
开发者ID:Cywaithaka,项目名称:S.A.F.E.-Open-Source-Microfinance-Suite,代码行数:26,代码来源:dbase.inc.php

示例2: ListRead

 public function ListRead()
 {
     $count = dbase_numrecords($this->_dBase);
     for ($i = 1; $i <= $count; $i++) {
         $row = dbase_get_record_with_names($this->_dBase, $i);
     }
 }
开发者ID:josmel,项目名称:adminwap,代码行数:7,代码来源:Dbf.php

示例3: postDailySales

 public function postDailySales()
 {
     $dbf_file = $this->extracted_path . DS . 'CSH_AUDT.DBF';
     if (file_exists($dbf_file)) {
         $db = dbase_open($dbf_file, 0);
         $header = dbase_get_header_info($db);
         $record_numbers = dbase_numrecords($db);
         $last_ds = $this->ds->lastRecord();
         $update = 0;
         for ($i = 1; $i <= $record_numbers; $i++) {
             $row = dbase_get_record_with_names($db, $i);
             $vfpdate = vfpdate_to_carbon(trim($row['TRANDATE']));
             if (is_null($last_ds)) {
                 $attrs = ['date' => $vfpdate->format('Y-m-d'), 'branchid' => session('user.branchid'), 'managerid' => session('user.id'), 'sales' => $row['CSH_SALE'] + $row['CHG_SALE'], 'tips' => $row['TIP'], 'custcount' => $row['CUST_CNT'], 'empcount' => $row['CREW_KIT'] + $row['CREW_DIN']];
                 if ($this->ds->firstOrNew($attrs, ['date', 'branchid'])) {
                 }
                 $update++;
             } else {
                 if ($last_ds->date->lte($vfpdate)) {
                     $attrs = ['date' => $vfpdate->format('Y-m-d'), 'branchid' => session('user.branchid'), 'managerid' => session('user.id'), 'sales' => $row['CSH_SALE'] + $row['CHG_SALE'], 'tips' => $row['TIP'], 'custcount' => $row['CUST_CNT'], 'empcount' => $row['CREW_KIT'] + $row['CREW_DIN']];
                     if ($this->ds->firstOrNew($attrs, ['date', 'branchid'])) {
                     }
                     $update++;
                 }
             }
         }
         dbase_close($db);
         return count($update > 0) ? true : false;
     }
     return false;
 }
开发者ID:jrsalunga,项目名称:gi-manager,代码行数:31,代码来源:PosUploadRepository.php

示例4: get_encabezado_llenado

 function get_encabezado_llenado()
 {
     if ($this->dbf) {
         $numero_registros = dbase_numrecords($this->dbf);
         $this->tabla_sql_data = "INSERT INTO `" . $this->nombre_tabla . "` (\n" . $this->get_campos_str();
         for ($i = 1; $i <= $numero_registros; $i++) {
             $fila = dbase_get_record_with_names($this->dbf, $i);
             $control = 0;
             $this->tabla_sql_data .= "(";
             foreach ($fila as $key => $value) {
                 if ($control < count($fila) - 1) {
                     if ($this->campos[$control]['type'] === 'number') {
                         $this->tabla_sql_data .= $fila[$key];
                     } else {
                         $this->tabla_sql_data .= "'" . $fila[$key] . "'";
                     }
                     if ($control != count($fila) - 2) {
                         $this->tabla_sql_data .= ",";
                     } else {
                         $this->tabla_sql_data .= "),";
                     }
                 }
                 $control++;
             }
         }
         $cad = $this->tabla_sql_data;
         $this->tabla_sql_data = substr($cad, 0, -1);
         $this->tabla_sql_data .= ";";
     }
     //Fin IF Principal
 }
开发者ID:julio899,项目名称:migracionesDBF,代码行数:31,代码来源:dbf.php

示例5: 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;
 }
开发者ID:romi45,项目名称:yii2-russian-banks-handbook,代码行数:66,代码来源:UpdateController.php

示例6: actionImportDbf

 public function actionImportDbf($filename, $region = false)
 {
     $db = @dbase_open($filename, 0);
     if (!$db) {
         $this->stderr("Не удалось открыть DBF файл: '{$filename}'\n");
         return 1;
     }
     $classMap = ['/^.*DADDROBJ\\.DBF$/' => FiasDaddrobj::className(), '/^.*ADDROBJ\\.DBF$/' => FiasAddrobj::className(), '/^.*LANDMARK\\.DBF$/' => FiasLandmark::className(), '/^.*DHOUSE\\.DBF$/' => FiasDhouse::className(), '/^.*HOUSE\\d\\d\\.DBF$/' => FiasHouse::className(), '/^.*DHOUSINT\\.DBF$/' => FiasDhousint::className(), '/^.*HOUSEINT\\.DBF$/' => FiasHouseint::className(), '/^.*DLANDMRK\\.DBF$/' => FiasDlandmrk::className(), '/^.*DNORDOC\\.DBF$/' => FiasDnordoc::className(), '/^.*NORDOC\\d\\d\\.DBF$/' => FiasNordoc::className(), '/^.*ESTSTAT\\.DBF$/' => FiasDhousint::className(), '/^.*ACTSTAT\\.DBF$/' => FiasActstat::className(), '/^.*CENTERST\\.DBF$/' => FiasCenterst::className(), '/^.*ESTSTAT\\.DBF$/' => FiasEststat::className(), '/^.*HSTSTAT\\.DBF$/' => FiasHststat::className(), '/^.*OPERSTAT\\.DBF$/' => FiasOperstat::className(), '/^.*INTVSTAT\\.DBF$/' => FiasIntvstat::className(), '/^.*STRSTAT\\.DBF$/' => FiasStrstat::className(), '/^.*CURENTST\\.DBF$/' => FiasCurentst::className(), '/^.*SOCRBASE\\.DBF$/' => FiasSocrbase::className()];
     $modelClass = false;
     foreach ($classMap as $pattern => $className) {
         if (preg_match($pattern, $filename)) {
             $modelClass = $className;
             break;
         }
     }
     if ($modelClass === false) {
         $this->stderr("Не поддерживаемый DBF файл: '{$filename}'\n");
         return 1;
     }
     $rowsCount = dbase_numrecords($db);
     $this->stdout("Записей в DBF файле '{$filename}' : {$rowsCount}\n");
     $j = 0;
     for ($i = 1; $i <= $rowsCount; $i++) {
         $row = dbase_get_record_with_names($db, $i);
         if ($modelClass == FiasAddrobj::className() && $this->region && intval($row['REGIONCODE']) != intval($this->region)) {
             continue;
         }
         if ($j == 0) {
             $transaction = Yii::$app->db->beginTransaction();
         }
         $model = new $modelClass();
         foreach ($row as $key => $value) {
             if ($key == 'deleted') {
                 continue;
             }
             $key = strtolower($key);
             $model->{$key} = trim(mb_convert_encoding($value, 'UTF-8', 'CP866'));
         }
         $model->save();
         $j++;
         if ($j == 1000) {
             $transaction->commit();
             $j = 0;
             $this->stdout("Обработано {$i} из {$rowsCount} записей\n");
         }
     }
     if ($j != 0) {
         $transaction->commit();
     }
     return 0;
 }
开发者ID:ejen,项目名称:yii2-fias,代码行数:51,代码来源:FiasController.php

示例7: execute

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('<info>Started at ' . date('H:i:s') . '</info>');
        $em = $this->em = $this->getEntityManager('default');

        $this->truncate();

        $db_path = __DIR__ . '/../Resources/KLADR/STREET.DBF';
        $db = dbase_open($db_path, 0) or die("Error! Could not open dbase database file '$db_path'.");
        $record_numbers = dbase_numrecords($db);

        $batchSize = $input->getOption('batch');
        for ($i = 1; $i <= $record_numbers; $i++) {
            $row = dbase_get_record_with_names($db, $i);

            $street = new KladrStreet();
            $street->setTitle(trim(iconv('cp866', 'utf8', $row['NAME'])));

            $code = trim($row['CODE']);
            if(substr($code, -2) != '00')
                continue;

            $code = substr($code, 0, -2);
            $street->setId($code);
            $street->setParentCode(intval(str_pad(substr($code, 0, -4), 11, '0', STR_PAD_RIGHT)));

            $street->setZip(trim($row['INDEX']));
            $street->setOcatd(trim($row['OCATD']));
            $street->setSocr(trim(iconv('cp866', 'utf8', $row['SOCR'])));

            $em->persist($street);

            if (($i % $batchSize) == 0) {
                $em->flush();
                $em->clear();
                $output->writeln('<info>Inserted '. $i. ' records</info>');
            }
        }
        $em->flush();

        $output->writeln('<info>Inserted '. $i. ' records</info>');
        $output->writeln('<info>Success</info>');
        $output->writeln('<info>Deleting dead links</info>');
        $this->deleteNotLinkedElements();
        $output->writeln('<info>Assigning parents</info>');
        $this->updateParents();
        $output->writeln('<info>Success</info>');
    }
开发者ID:n3b,项目名称:Symfony2-KladrBundle,代码行数:48,代码来源:ImportStreetCommand.php

示例8: 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';
     }
 }
开发者ID:enderochoa,项目名称:tortuga,代码行数:46,代码来源:subedbf.php

示例9: import_dbf

function import_dbf($db, $table, $dbf_file)
{
    global $conn;
    if (!($dbf = dbase_open($dbf_file, 0))) {
        die("Could not open {$dbf_file} for import.");
    }
    $num_rec = dbase_numrecords($dbf);
    $num_fields = dbase_numfields($dbf);
    $fields = array();
    for ($i = 1; $i <= $num_rec; $i++) {
        $row = @dbase_get_record_with_names($dbf, $i);
        $q = "insert into {$db}.{$table} values (";
        foreach ($row as $key => $val) {
            if ($key == 'deleted') {
                continue;
            }
            $q .= "'" . addslashes(trim($val)) . "',";
            // Code modified to trim out whitespaces
        }
        if (isset($extra_col_val)) {
            $q .= "'{$extra_col_val}',";
        }
        $q = substr($q, 0, -1);
        $q .= ')';
        //if the query failed - go ahead and print a bunch of debug info
        if (!($result = mysql_query($q, $conn))) {
            print mysql_error() . " SQL: {$q}\n\n";
            print substr_count($q, ',') + 1 . " Fields total.\n\n";
            $problem_q = explode(',', $q);
            $q1 = "desc {$db}.{$table}";
            $result1 = mysql_query($q1, $conn);
            $columns = array();
            $i = 1;
            while ($row1 = mysql_fetch_assoc($result1)) {
                $columns[$i] = $row1['Field'];
                $i++;
            }
            $i = 1;
            foreach ($problem_q as $pq) {
                print "{$i} column: {$columns[$i]} data: {$pq}\n\n";
                $i++;
            }
            die;
        }
    }
}
开发者ID:sipsenachi,项目名称:rep,代码行数:46,代码来源:convert.php

示例10: error_reporting

<?php

error_reporting('-1');
$db = dbase_open('chart.dbf', 0);
if ($db) {
    $record_numbers = dbase_numrecords($db);
    for ($i = 1; $i <= $record_numbers; $i++) {
        $row = dbase_get_record_with_names($db, $i);
        foreach ($row as $key => $value) {
            echo $key . ': ' . $value . '<br/>';
        }
        //      echo print_r($row,true);
        //if ($row['ismember'] == 1) {
        //   echo "Member #$i: " . trim($row['name']) . "\n";
        //}
    }
}
?>

开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:18,代码来源:dbread_etp.php

示例11: getRecord

 public function getRecord($geometry_format = self::GEOMETRY_ARRAY)
 {
     if (ftell($this->shp) >= $this->file_size) {
         return false;
     }
     $record_number = $this->ReadData('N');
     $content_length = $this->ReadData('N');
     $shape_type = $this->ReadData('V');
     if ($shape_type != 0 && $shape_type != $this->shape_type) {
         $this->Error('WRONG_RECORD_TYPE', $shape_type);
     }
     switch ($shape_type) {
         case 0:
             $shp = null;
             break;
         case 1:
             $shp = $this->ReadPoint();
             break;
         case 8:
             $shp = $this->ReadMultiPoint();
             break;
         case 3:
             $shp = $this->ReadPolyLine();
             break;
         case 5:
             $shp = $this->ReadPolygon();
             break;
     }
     if ($geometry_format == self::GEOMETRY_WKT) {
         $shp = $this->WKT($shp);
     }
     return array('shp' => $shp, 'dbf' => dbase_get_record_with_names($this->dbf, $record_number));
 }
开发者ID:alanblins,项目名称:php-shapefile,代码行数:33,代码来源:shapefile.php

示例12: _fetchDBFInformation

 private function _fetchDBFInformation()
 {
     $this->_openDBFFile();
     if ($this->dbf) {
         //En este punto salta un error si el registro 0 está vacio.
         //Ignoramos los errores, ja que aún así todo funciona perfecto.
         $this->dbf_data = dbase_get_record_with_names($this->dbf, $this->record_number);
     } else {
         $this->setError(sprintf(self::INCORRECT_DBF_FILE, $this->file_name));
     }
     $this->_closeDBFFile();
 }
开发者ID:edewaele,项目名称:yapafo,代码行数:12,代码来源:ShapeFileRecord.php

示例13: getRecord

 public function getRecord($record_num)
 {
     $record = dbase_get_record_with_names($this->_fp, $record_num);
     return $record;
 }
开发者ID:buty,项目名称:gmf_trade_server,代码行数:5,代码来源:BaseParse.php

示例14: GetDBFRecByName

 function GetDBFRecByName($i)
 {
     $ret = dbase_get_record_with_names($this->DBFCon, $i) or die("Gagal Mengambil Data");
     return $ret;
 }
开发者ID:anggadjava,项目名称:mitra_siakad,代码行数:5,代码来源:dbf.class.php

示例15: baca_dbf

 function baca_dbf()
 {
     $filez = './uploads/urut.DBF';
     $dbf = dbase_open($filez, 0);
     $column_info = dbase_get_header_info($dbf);
     $loop = dbase_numrecords($dbf);
     for ($i = 1; $i <= $loop; $i++) {
         $row = dbase_get_record_with_names($dbf, $i);
         $data = array("nik" => $row['ID'], "mchID" => $row['IDABS']);
         $this->db->insert("mchID", $data);
         //echo $row['ID']."/".$row['IDABS']."<br>";
     }
     die;
 }
开发者ID:ocpyosep78,项目名称:hris_client,代码行数:14,代码来源:attendance.php


注:本文中的dbase_get_record_with_names函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。